Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/outdev/pixel.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <vcl/metaact.hxx>
21
#include <vcl/virdev.hxx>
22
23
#include <CoordinateMapper.hxx>
24
#include <drawmode.hxx>
25
#include <salgdi.hxx>
26
27
#include <cassert>
28
29
Color OutputDevice::GetPixel(const Point& rPoint) const
30
471k
{
31
471k
    Color aColor;
32
33
471k
    if (mpGraphics || AcquireGraphics())
34
471k
    {
35
471k
        assert(mpGraphics);
36
471k
        if (mbInitClipRegion)
37
0
            const_cast<OutputDevice*>(this)->InitClipRegion();
38
39
471k
        if (!mbOutputClipped)
40
471k
        {
41
471k
            const tools::Long nX = mpMapper->LogicToDevicePixelX(rPoint.X());
42
471k
            const tools::Long nY = mpMapper->LogicToDevicePixelY(rPoint.Y());
43
471k
            aColor = mpGraphics->GetPixel(nX, nY, *this);
44
471k
        }
45
471k
    }
46
471k
    return aColor;
47
471k
}
48
49
void OutputDevice::DrawPixel( const Point& rPt )
50
1.15k
{
51
1.15k
    assert(!is_double_buffered_window());
52
53
1.15k
    if ( mpMetaFile )
54
0
        mpMetaFile->AddAction( new MetaPointAction( rPt ) );
55
56
1.15k
    if ( !IsDeviceOutputNecessary() || !mbLineColor || ImplIsRecordLayout() )
57
707
        return;
58
59
448
    Point aPt = LogicToDevicePixel(rPt);
60
61
448
    if ( !mpGraphics && !AcquireGraphics() )
62
0
        return;
63
448
    assert(mpGraphics);
64
65
448
    if ( mbInitClipRegion )
66
303
        InitClipRegion();
67
68
448
    if ( mbOutputClipped )
69
197
        return;
70
71
251
    if ( mbInitLineColor )
72
109
        InitLineColor();
73
74
251
    mpGraphics->DrawPixel( aPt.X(), aPt.Y(), *this );
75
251
}
76
77
void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
78
457k
{
79
457k
    assert(!is_double_buffered_window());
80
81
457k
    Color aColor = vcl::drawmode::GetLineColor(rColor, GetDrawMode(), GetSettings().GetStyleSettings());
82
83
457k
    if ( mpMetaFile )
84
0
        mpMetaFile->AddAction( new MetaPixelAction( rPt, aColor ) );
85
86
457k
    if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
87
0
        return;
88
89
457k
    Point aPt = LogicToDevicePixel(rPt);
90
91
457k
    if ( !mpGraphics && !AcquireGraphics() )
92
0
        return;
93
457k
    assert(mpGraphics);
94
95
457k
    if ( mbInitClipRegion )
96
90
        InitClipRegion();
97
98
457k
    if ( mbOutputClipped )
99
56
        return;
100
101
457k
    mpGraphics->DrawPixel( aPt.X(), aPt.Y(), aColor, *this );
102
457k
}
103
104
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */