Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.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 <drawinglayer/primitive2d/PolyPolygonHairlinePrimitive2D.hxx>
21
#include <drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx>
22
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
23
24
#include <basegfx/polygon/b2dpolypolygontools.hxx>
25
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
26
#include <utility>
27
28
using namespace com::sun::star;
29
30
namespace drawinglayer::primitive2d
31
{
32
Primitive2DReference PolyPolygonHairlinePrimitive2D::create2DDecomposition(
33
    const geometry::ViewInformation2D& /*rViewInformation*/) const
34
196
{
35
196
    const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
36
196
    const sal_uInt32 nCount(aPolyPolygon.count());
37
38
196
    Primitive2DContainer aContainer;
39
392
    for (sal_uInt32 a(0); a < nCount; a++)
40
196
    {
41
196
        aContainer.push_back(
42
196
            new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor()));
43
196
    }
44
196
    return new GroupPrimitive2D(std::move(aContainer));
45
196
}
46
47
PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(basegfx::B2DPolyPolygon aPolyPolygon,
48
                                                               const basegfx::BColor& rBColor)
49
578
    : maPolyPolygon(std::move(aPolyPolygon))
50
578
    , maBColor(rBColor)
51
578
{
52
578
}
53
54
bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
55
141
{
56
141
    if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
57
141
    {
58
141
        const PolyPolygonHairlinePrimitive2D& rCompare
59
141
            = static_cast<const PolyPolygonHairlinePrimitive2D&>(rPrimitive);
60
61
141
        return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
62
141
                && getBColor() == rCompare.getBColor());
63
141
    }
64
65
0
    return false;
66
141
}
67
68
basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(
69
    const geometry::ViewInformation2D& /*rViewInformation*/) const
70
523
{
71
    // return range
72
523
    return getB2DPolyPolygon().getB2DRange();
73
523
}
74
75
// provide unique ID
76
sal_uInt32 PolyPolygonHairlinePrimitive2D::getPrimitive2DID() const
77
478
{
78
478
    return PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D;
79
478
}
80
81
} // end drawinglayer::primitive2d namespace
82
83
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */