Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/outdev/curvedshapes.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 <salgdi.hxx>
24
25
#include <cassert>
26
27
void OutputDevice::DrawEllipse( const tools::Rectangle& rRect )
28
30.9k
{
29
30.9k
    assert(!is_double_buffered_window());
30
31
30.9k
    if ( mpMetaFile )
32
29.7k
        mpMetaFile->AddAction( new MetaEllipseAction( rRect ) );
33
34
30.9k
    if  ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
35
30.9k
        return;
36
37
0
    tools::Rectangle aRect(LogicToDevicePixel(rRect));
38
0
    if ( aRect.IsEmpty() )
39
0
        return;
40
41
    // we need a graphics
42
0
    if ( !mpGraphics && !AcquireGraphics() )
43
0
        return;
44
0
    assert(mpGraphics);
45
46
0
    if ( mbInitClipRegion )
47
0
        InitClipRegion();
48
0
    if ( mbOutputClipped )
49
0
        return;
50
51
0
    if ( mbInitLineColor )
52
0
        InitLineColor();
53
54
0
    tools::Polygon aRectPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
55
0
    if ( aRectPoly.GetSize() >= 2 )
56
0
    {
57
0
        Point* pPtAry = aRectPoly.GetPointAry();
58
0
        if ( !mbFillColor )
59
0
            mpGraphics->DrawPolyLine( aRectPoly.GetSize(), pPtAry, *this );
60
0
        else
61
0
        {
62
0
            if ( mbInitFillColor )
63
0
                InitFillColor();
64
0
            mpGraphics->DrawPolygon( aRectPoly.GetSize(), pPtAry, *this );
65
0
        }
66
0
    }
67
0
}
68
69
void OutputDevice::DrawArc( const tools::Rectangle& rRect,
70
                            const Point& rStartPt, const Point& rEndPt )
71
43.1k
{
72
43.1k
    assert(!is_double_buffered_window());
73
74
43.1k
    if ( mpMetaFile )
75
35.5k
        mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) );
76
77
43.1k
    if ( !IsDeviceOutputNecessary() || !mbLineColor || ImplIsRecordLayout() )
78
43.1k
        return;
79
80
0
    tools::Rectangle aRect(LogicToDevicePixel(rRect));
81
0
    if ( aRect.IsEmpty() )
82
0
        return;
83
84
    // we need a graphics
85
0
    if ( !mpGraphics && !AcquireGraphics() )
86
0
        return;
87
0
    assert(mpGraphics);
88
89
0
    if ( mbInitClipRegion )
90
0
        InitClipRegion();
91
0
    if ( mbOutputClipped )
92
0
        return;
93
94
0
    if ( mbInitLineColor )
95
0
        InitLineColor();
96
97
0
    const Point aStart(LogicToDevicePixel(rStartPt));
98
0
    const Point aEnd(LogicToDevicePixel(rEndPt));
99
0
    tools::Polygon aArcPoly( aRect, aStart, aEnd, PolyStyle::Arc );
100
101
0
    if ( aArcPoly.GetSize() >= 2 )
102
0
    {
103
0
        Point* pPtAry = aArcPoly.GetPointAry();
104
0
        mpGraphics->DrawPolyLine( aArcPoly.GetSize(), pPtAry, *this );
105
0
    }
106
0
}
107
108
void OutputDevice::DrawPie( const tools::Rectangle& rRect,
109
                            const Point& rStartPt, const Point& rEndPt )
110
0
{
111
0
    assert(!is_double_buffered_window());
112
113
0
    if ( mpMetaFile )
114
0
        mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) );
115
116
0
    if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
117
0
        return;
118
119
0
    tools::Rectangle aRect(LogicToDevicePixel(rRect));
120
0
    if ( aRect.IsEmpty() )
121
0
        return;
122
123
    // we need a graphics
124
0
    if ( !mpGraphics && !AcquireGraphics() )
125
0
        return;
126
0
    assert(mpGraphics);
127
128
0
    if ( mbInitClipRegion )
129
0
        InitClipRegion();
130
0
    if ( mbOutputClipped )
131
0
        return;
132
133
0
    if ( mbInitLineColor )
134
0
        InitLineColor();
135
136
0
    const Point aStart(LogicToDevicePixel(rStartPt));
137
0
    const Point aEnd(LogicToDevicePixel(rEndPt));
138
0
    tools::Polygon aPiePoly( aRect, aStart, aEnd, PolyStyle::Pie );
139
140
0
    if ( aPiePoly.GetSize() >= 2 )
141
0
    {
142
0
        Point* pPtAry = aPiePoly.GetPointAry();
143
0
        if ( !mbFillColor )
144
0
            mpGraphics->DrawPolyLine( aPiePoly.GetSize(), pPtAry, *this );
145
0
        else
146
0
        {
147
0
            if ( mbInitFillColor )
148
0
                InitFillColor();
149
0
            mpGraphics->DrawPolygon( aPiePoly.GetSize(), pPtAry, *this );
150
0
        }
151
0
    }
152
0
}
153
154
void OutputDevice::DrawChord( const tools::Rectangle& rRect,
155
                              const Point& rStartPt, const Point& rEndPt )
156
0
{
157
0
    assert(!is_double_buffered_window());
158
159
0
    if ( mpMetaFile )
160
0
        mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) );
161
162
0
    if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
163
0
        return;
164
165
0
    tools::Rectangle aRect(LogicToDevicePixel(rRect));
166
0
    if ( aRect.IsEmpty() )
167
0
        return;
168
169
    // we need a graphics
170
0
    if ( !mpGraphics && !AcquireGraphics() )
171
0
        return;
172
0
    assert(mpGraphics);
173
174
0
    if ( mbInitClipRegion )
175
0
        InitClipRegion();
176
0
    if ( mbOutputClipped )
177
0
        return;
178
179
0
    if ( mbInitLineColor )
180
0
        InitLineColor();
181
182
0
    const Point aStart(LogicToDevicePixel(rStartPt));
183
0
    const Point aEnd(LogicToDevicePixel(rEndPt));
184
0
    tools::Polygon aChordPoly( aRect, aStart, aEnd, PolyStyle::Chord );
185
186
0
    if ( aChordPoly.GetSize() >= 2 )
187
0
    {
188
0
        Point* pPtAry = aChordPoly.GetPointAry();
189
0
        if ( !mbFillColor )
190
0
            mpGraphics->DrawPolyLine( aChordPoly.GetSize(), pPtAry, *this );
191
0
        else
192
0
        {
193
0
            if ( mbInitFillColor )
194
0
                InitFillColor();
195
0
            mpGraphics->DrawPolygon( aChordPoly.GetSize(), pPtAry, *this );
196
0
        }
197
0
    }
198
0
}
199
200
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */