Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/source/processor2d/baseprocessor2d.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/Primitive2DContainer.hxx>
21
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
22
#include <utility>
23
24
25
namespace drawinglayer::processor2d
26
{
27
        void BaseProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& /*rCandidate*/)
28
0
        {
29
0
        }
30
31
        BaseProcessor2D::BaseProcessor2D(geometry::ViewInformation2D aViewInformation)
32
59.4k
        :   maViewInformation2D(std::move(aViewInformation))
33
59.4k
        {
34
59.4k
        }
35
36
        BaseProcessor2D::~BaseProcessor2D()
37
59.4k
        {
38
59.4k
        }
39
40
        void BaseProcessor2D::process(const primitive2d::BasePrimitive2D& rCandidate)
41
373k
        {
42
            // use the visitor API to avoid the cost of constructing Primitive2DContainers
43
373k
            rCandidate.get2DDecomposition(*this, getViewInformation2D());
44
373k
        }
45
46
        // Primitive2DDecompositionVisitor
47
        void BaseProcessor2D::visit(const primitive2d::Primitive2DReference& rCandidate)
48
352k
        {
49
352k
            if (rCandidate)
50
23.9k
                processBasePrimitive2D(*rCandidate);
51
352k
        }
52
        void BaseProcessor2D::visit(const primitive2d::Primitive2DContainer& rContainer)
53
19.6k
        {
54
19.6k
            process(rContainer);
55
19.6k
        }
56
        void BaseProcessor2D::visit(primitive2d::Primitive2DContainer&& rCandidate)
57
0
        {
58
0
            process(rCandidate);
59
0
        }
60
61
        void BaseProcessor2D::process(const primitive2d::Primitive2DContainer& rSource)
62
80.7k
        {
63
80.7k
            for (const primitive2d::Primitive2DReference& rCandidate : rSource)
64
366k
            {
65
                // Skip, if not visible
66
366k
                if (rCandidate && rCandidate->getVisible())
67
366k
                    processBasePrimitive2D(*rCandidate);
68
366k
            }
69
80.7k
        }
70
71
        void BaseProcessor2D::setViewInformation2D(const geometry::ViewInformation2D& rNew)
72
932
        {
73
932
            if (rNew != maViewInformation2D)
74
932
            {
75
                // set if changed
76
932
                maViewInformation2D = rNew;
77
78
                // allow reaction on change
79
932
                onViewInformation2DChanged();
80
932
            }
81
932
        }
82
} // end of namespace
83
84
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */