Coverage Report

Created: 2026-11-06 11:29

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
390k
{
31
390k
    Color aColor;
32
33
390k
    if (mpGraphics || AcquireGraphics())
34
390k
    {
35
390k
        assert(mpGraphics);
36
390k
        if (mbInitClipRegion)
37
0
            const_cast<OutputDevice*>(this)->InitClipRegion();
38
39
390k
        if (!mbOutputClipped)
40
390k
        {
41
390k
            const tools::Long nX = mpMapper->LogicToDevicePixelX(rPoint.X());
42
390k
            const tools::Long nY = mpMapper->LogicToDevicePixelY(rPoint.Y());
43
390k
            aColor = mpGraphics->GetPixel(nX, nY, *this);
44
390k
        }
45
390k
    }
46
390k
    return aColor;
47
390k
}
48
49
void OutputDevice::DrawPixel( const Point& rPt )
50
1.10k
{
51
1.10k
    assert(!is_double_buffered_window());
52
53
1.10k
    if ( mpMetaFile )
54
0
        mpMetaFile->AddAction( new MetaPointAction( rPt ) );
55
56
1.10k
    if ( !IsDeviceOutputNecessary() || !mbLineColor || ImplIsRecordLayout() )
57
1.10k
        return;
58
59
0
    Point aPt = LogicToDevicePixel(rPt);
60
61
0
    if ( !mpGraphics && !AcquireGraphics() )
62
0
        return;
63
0
    assert(mpGraphics);
64
65
0
    if ( mbInitClipRegion )
66
0
        InitClipRegion();
67
68
0
    if ( mbOutputClipped )
69
0
        return;
70
71
0
    if ( mbInitLineColor )
72
0
        InitLineColor();
73
74
0
    mpGraphics->DrawPixel( aPt.X(), aPt.Y(), *this );
75
0
}
76
77
void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
78
379k
{
79
379k
    assert(!is_double_buffered_window());
80
81
379k
    Color aColor = vcl::drawmode::GetLineColor(rColor, GetDrawMode(), GetSettings().GetStyleSettings());
82
83
379k
    if ( mpMetaFile )
84
0
        mpMetaFile->AddAction( new MetaPixelAction( rPt, aColor ) );
85
86
379k
    if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
87
0
        return;
88
89
379k
    Point aPt = LogicToDevicePixel(rPt);
90
91
379k
    if ( !mpGraphics && !AcquireGraphics() )
92
0
        return;
93
379k
    assert(mpGraphics);
94
95
379k
    if ( mbInitClipRegion )
96
0
        InitClipRegion();
97
98
379k
    if ( mbOutputClipped )
99
0
        return;
100
101
379k
    mpGraphics->DrawPixel( aPt.X(), aPt.Y(), aColor, *this );
102
379k
}
103
104
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */