Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/source/attribute/materialattribute3d.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/attribute/materialattribute3d.hxx>
21
#include <basegfx/color/bcolor.hxx>
22
23
24
namespace drawinglayer::attribute
25
{
26
        class ImpMaterialAttribute3D
27
        {
28
        public:
29
            // materialAttribute3D definitions
30
            basegfx::BColor                         maColor;                // object color
31
            basegfx::BColor                         maSpecular;             // material specular color
32
            basegfx::BColor                         maEmission;             // material emissive color
33
            sal_uInt16                              mnSpecularIntensity;    // material specular intensity [0..128]
34
35
            ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity)
36
0
            :   maColor(rColor),
37
0
                maSpecular(rSpecular),
38
0
                maEmission(rEmission),
39
0
                mnSpecularIntensity(nSpecularIntensity)
40
0
            {
41
0
            }
42
43
            explicit ImpMaterialAttribute3D(const basegfx::BColor& rColor)
44
0
            :   maColor(rColor),
45
0
                maSpecular(1.0, 1.0, 1.0),
46
0
                mnSpecularIntensity(15)
47
0
            {
48
0
            }
49
50
            ImpMaterialAttribute3D()
51
0
            :   mnSpecularIntensity(0)
52
0
            {
53
0
            }
54
55
            // data read access
56
0
            const basegfx::BColor& getColor() const { return maColor; }
57
0
            const basegfx::BColor& getSpecular() const { return maSpecular; }
58
0
            const basegfx::BColor& getEmission() const { return maEmission; }
59
0
            sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; }
60
61
            bool operator==(const ImpMaterialAttribute3D& rCandidate) const
62
0
            {
63
0
                return (getColor() == rCandidate.getColor()
64
0
                    && getSpecular() == rCandidate.getSpecular()
65
0
                    && getEmission() == rCandidate.getEmission()
66
0
                    && getSpecularIntensity() == rCandidate.getSpecularIntensity());
67
0
            }
68
        };
69
70
        namespace
71
        {
72
            MaterialAttribute3D::ImplType& theGlobalDefault()
73
0
            {
74
0
                static MaterialAttribute3D::ImplType SINGLETON;
75
0
                return SINGLETON;
76
0
            }
77
        }
78
79
        MaterialAttribute3D::MaterialAttribute3D(
80
            const basegfx::BColor& rColor,
81
            const basegfx::BColor& rSpecular,
82
            const basegfx::BColor& rEmission,
83
            sal_uInt16 nSpecularIntensity)
84
0
        :   mpMaterialAttribute3D(ImpMaterialAttribute3D(
85
0
                rColor, rSpecular, rEmission, nSpecularIntensity))
86
0
        {
87
0
        }
88
89
        MaterialAttribute3D::MaterialAttribute3D(
90
            const basegfx::BColor& rColor)
91
0
        :   mpMaterialAttribute3D(ImpMaterialAttribute3D(rColor))
92
0
        {
93
0
        }
94
95
        MaterialAttribute3D::MaterialAttribute3D()
96
0
        :   mpMaterialAttribute3D(theGlobalDefault())
97
0
        {
98
0
        }
99
100
0
        MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D&) = default;
101
102
0
        MaterialAttribute3D::~MaterialAttribute3D() = default;
103
104
0
        MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D&) = default;
105
106
        bool MaterialAttribute3D::operator==(const MaterialAttribute3D& rCandidate) const
107
0
        {
108
0
            return rCandidate.mpMaterialAttribute3D == mpMaterialAttribute3D;
109
0
        }
110
111
        const basegfx::BColor& MaterialAttribute3D::getColor() const
112
0
        {
113
0
            return mpMaterialAttribute3D->getColor();
114
0
        }
115
116
        const basegfx::BColor& MaterialAttribute3D::getSpecular() const
117
0
        {
118
0
            return mpMaterialAttribute3D->getSpecular();
119
0
        }
120
121
        const basegfx::BColor& MaterialAttribute3D::getEmission() const
122
0
        {
123
0
            return mpMaterialAttribute3D->getEmission();
124
0
        }
125
126
        sal_uInt16 MaterialAttribute3D::getSpecularIntensity() const
127
0
        {
128
0
            return mpMaterialAttribute3D->getSpecularIntensity();
129
0
        }
130
131
} // end of namespace
132
133
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */