Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/inc/processor3d/defaultprocessor3d.hxx
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
#pragma once
21
22
#include <drawinglayer/processor3d/baseprocessor3d.hxx>
23
#include <basegfx/range/b2drange.hxx>
24
#include <basegfx/color/bcolormodifier.hxx>
25
26
// predefines
27
28
namespace basegfx {
29
    class B3DPolygon;
30
    class B3DPolyPolygon;
31
}
32
33
namespace drawinglayer::attribute {
34
    class SdrSceneAttribute;
35
    class SdrLightingAttribute;
36
    class MaterialAttribute3D;
37
}
38
39
namespace drawinglayer::primitive3d {
40
    class PolygonHairlinePrimitive3D;
41
    class PolyPolygonMaterialPrimitive3D;
42
    class GradientTexturePrimitive3D;
43
    class HatchTexturePrimitive3D;
44
    class BitmapTexturePrimitive3D;
45
    class TransformPrimitive3D;
46
    class ModifiedColorPrimitive3D;
47
}
48
49
namespace drawinglayer::texture {
50
    class GeoTexSvx;
51
}
52
53
54
namespace drawinglayer::processor3d
55
    {
56
        /** DefaultProcessor3D class
57
58
            This processor renders all fed primitives to a 2D raster where for all
59
            primitives the two basic methods rasterconvertB3DPolygon for hairlines and
60
            rasterconvertB3DPolyPolygon for filled geometry is called. It is a baseclass to
61
            e.g. base a Z-Buffer supported renderer on the 3D primitive processing.
62
         */
63
        class DefaultProcessor3D : public BaseProcessor3D
64
        {
65
        protected:
66
            /// read-only scene infos (normal handling, etc...)
67
            const attribute::SdrSceneAttribute&                 mrSdrSceneAttribute;
68
69
            /// read-only light infos (lights, etc...)
70
            const attribute::SdrLightingAttribute&              mrSdrLightingAttribute;
71
72
            /// renderer range. Need to be correctly set by the derived implementations
73
            /// normally the (0, 0, W, H) range from mpBZPixelRaster
74
            basegfx::B2DRange                                   maRasterRange;
75
76
            /// the modifiedColorPrimitive stack
77
            basegfx::BColorModifierStack                        maBColorModifierStack;
78
79
            /// the current active texture
80
            std::shared_ptr< texture::GeoTexSvx >             mpGeoTexSvx;
81
82
            /// the current active transparence texture
83
            std::shared_ptr< texture::GeoTexSvx >             mpTransparenceGeoTexSvx;
84
85
            /// counter for entered transparence textures
86
            sal_uInt32                                          mnTransparenceCounter;
87
88
            bool                                                mbModulate : 1;
89
            bool                                                mbFilter : 1;
90
            bool                                                mbSimpleTextureActive : 1;
91
92
93
            // rendering support
94
95
            void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence);
96
            void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive);
97
            void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive);
98
            void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate);
99
            void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive) const;
100
            void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive) const;
101
            void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate);
102
103
104
            // rasterconversions for filled and non-filled polygons. These NEED to be
105
            // implemented from derivations
106
107
            virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0;
108
            virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0;
109
110
            // the processing method for a single, known primitive
111
            virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) override;
112
113
        public:
114
            DefaultProcessor3D(
115
                const geometry::ViewInformation3D& rViewInformation,
116
                const attribute::SdrSceneAttribute& rSdrSceneAttribute,
117
                const attribute::SdrLightingAttribute& rSdrLightingAttribute);
118
            virtual ~DefaultProcessor3D() override;
119
120
            /// data read access
121
0
            const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; }
122
0
            const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; }
123
124
            /// data read access renderer stuff
125
0
            const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
126
0
            const std::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; }
127
0
            const std::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; }
128
0
            sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; }
129
0
            bool getModulate() const { return mbModulate; }
130
0
            bool getFilter() const { return mbFilter; }
131
0
            bool getSimpleTextureActive() const { return mbSimpleTextureActive; }
132
        };
133
134
} // end of namespace drawinglayer::processor3d
135
136
137
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */