summaryrefslogtreecommitdiff
path: root/drawinglayer/source/primitive3d
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/primitive3d')
-rw-r--r--drawinglayer/source/primitive3d/Tools.cxx67
-rw-r--r--drawinglayer/source/primitive3d/baseprimitive3d.cxx30
-rw-r--r--drawinglayer/source/primitive3d/groupprimitive3d.cxx11
-rw-r--r--drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx346
-rw-r--r--drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx3
-rw-r--r--drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx8
-rw-r--r--drawinglayer/source/primitive3d/polygonprimitive3d.cxx15
-rw-r--r--drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx125
-rw-r--r--drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx9
-rw-r--r--drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx19
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx53
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx19
-rw-r--r--drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx19
-rw-r--r--drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx8
-rw-r--r--drawinglayer/source/primitive3d/sdrprimitive3d.cxx13
-rw-r--r--drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx2
-rw-r--r--drawinglayer/source/primitive3d/shadowprimitive3d.cxx8
-rw-r--r--drawinglayer/source/primitive3d/textureprimitive3d.cxx14
-rw-r--r--drawinglayer/source/primitive3d/transformprimitive3d.cxx8
19 files changed, 394 insertions, 383 deletions
diff --git a/drawinglayer/source/primitive3d/Tools.cxx b/drawinglayer/source/primitive3d/Tools.cxx
new file mode 100644
index 000000000000..23ecc0851f40
--- /dev/null
+++ b/drawinglayer/source/primitive3d/Tools.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <drawinglayer/primitive3d/Tools.hxx>
+#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+
+using namespace css;
+
+namespace drawinglayer::primitive3d
+{
+OUString idToString(sal_uInt32 nId)
+{
+ switch (nId)
+ {
+ case PRIMITIVE3D_ID_GROUPPRIMITIVE3D:
+ return u"GROUPPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D:
+ return u"HATCHTEXTUREPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D:
+ return u"MODIFIEDCOLORPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D:
+ return u"POLYGONHAIRLINEPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D:
+ return u"POLYGONSTROKEPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D:
+ return u"POLYGONTUBEPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D:
+ return u"POLYPOLYGONMATERIALPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D:
+ return u"SDRCUBEPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D:
+ return u"SDREXTRUDEPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D:
+ return u"SDRLATHEPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D:
+ return u"SDRPOLYPOLYGONPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D:
+ return u"SDRSPHEREPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_SHADOWPRIMITIVE3D:
+ return u"SHADOWPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D:
+ return u"UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D:
+ return u"GRADIENTTEXTUREPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D:
+ return u"BITMAPTEXTUREPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D:
+ return u"TRANSPARENCETEXTUREPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D:
+ return u"TRANSFORMPRIMITIVE3D"_ustr;
+ case PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D:
+ return u"HIDDENGEOMETRYPRIMITIVE3D"_ustr;
+ default:
+ return OUString::number((nId >> 16) & 0xFF) + "|" + OUString::number(nId & 0xFF);
+ }
+}
+
+} // end of namespace drawinglayer::primitive2d
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/primitive3d/baseprimitive3d.cxx b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
index 4a69c7cc0a73..c2c8cc9f7e0f 100644
--- a/drawinglayer/source/primitive3d/baseprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
@@ -29,7 +29,6 @@ using namespace com::sun::star;
namespace drawinglayer::primitive3d
{
BasePrimitive3D::BasePrimitive3D()
- : BasePrimitive3DImplBase(m_aMutex)
{
}
@@ -71,14 +70,12 @@ namespace drawinglayer::primitive3d
}
BufferedDecompositionPrimitive3D::BufferedDecompositionPrimitive3D()
- : BasePrimitive3D(),
- maBuffered3DDecomposition()
{
}
Primitive3DContainer BufferedDecompositionPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if(getBuffered3DDecomposition().empty())
{
@@ -98,20 +95,8 @@ namespace drawinglayer::primitive3d
if(rCandidate.is())
{
- // try to get C++ implementation base
- const BasePrimitive3D* pCandidate(dynamic_cast< BasePrimitive3D* >(rCandidate.get()));
-
- if(pCandidate)
- {
- // use it if possible
- aRetval.expand(pCandidate->getB3DRange(aViewInformation));
- }
- else
- {
- // use UNO API call instead
- const uno::Sequence< beans::PropertyValue >& rViewParameters(aViewInformation.getViewInformationSequence());
- aRetval.expand(basegfx::unotools::b3DRectangleFromRealRectangle3D(rCandidate->getRange(rViewParameters)));
- }
+ const BasePrimitive3D* pCandidate(static_cast< BasePrimitive3D* >(rCandidate.get()));
+ aRetval.expand(pCandidate->getB3DRange(aViewInformation));
}
return aRetval;
@@ -149,13 +134,8 @@ namespace drawinglayer::primitive3d
return true;
}
- const BasePrimitive3D* pA(dynamic_cast< const BasePrimitive3D* >(rxA.get()));
- const BasePrimitive3D* pB(dynamic_cast< const BasePrimitive3D* >(rxB.get()));
-
- if(!pA || !pB)
- {
- return false;
- }
+ const BasePrimitive3D* pA(static_cast< const BasePrimitive3D* >(rxA.get()));
+ const BasePrimitive3D* pB(static_cast< const BasePrimitive3D* >(rxB.get()));
return pA->operator==(*pB);
}
diff --git a/drawinglayer/source/primitive3d/groupprimitive3d.cxx b/drawinglayer/source/primitive3d/groupprimitive3d.cxx
index 7a6254b00e72..c50e29f04d8c 100644
--- a/drawinglayer/source/primitive3d/groupprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/groupprimitive3d.cxx
@@ -19,20 +19,17 @@
#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-
-
-using namespace com::sun::star;
+#include <utility>
namespace drawinglayer::primitive3d
{
- GroupPrimitive3D::GroupPrimitive3D( const Primitive3DContainer& rChildren )
- : BasePrimitive3D(),
- maChildren(rChildren)
+ GroupPrimitive3D::GroupPrimitive3D( Primitive3DContainer aChildren )
+ : maChildren(std::move(aChildren))
{
}
- /** The compare opertator uses the Sequence::==operator, so only checking if
+ /** The compare operator uses the Sequence::==operator, so only checking if
the references are equal. All non-equal references are interpreted as
non-equal.
*/
diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
index 2ea280b68be1..42e2f9e75b71 100644
--- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
@@ -29,6 +29,7 @@
#include <basegfx/matrix/b3dhommatrix.hxx>
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <utility>
using namespace com::sun::star;
@@ -49,215 +50,206 @@ namespace drawinglayer::primitive3d
for(size_t a(0); a < nSourceCount; a++)
{
// get reference
- const Primitive3DReference xReference(aSource[a]);
+ const Primitive3DReference& xReference(aSource[a]);
if(xReference.is())
{
- // try to cast to BasePrimitive2D implementation
- const BasePrimitive3D* pBasePrimitive = dynamic_cast< const BasePrimitive3D* >(xReference.get());
+ const BasePrimitive3D* pBasePrimitive = static_cast< const BasePrimitive3D* >(xReference.get());
- if(pBasePrimitive)
+ // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch
+ // not all content is needed, remove transparencies and ModifiedColorPrimitives
+ switch(pBasePrimitive->getPrimitive3DID())
{
- // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch
- // not all content is needed, remove transparencies and ModifiedColorPrimitives
- switch(pBasePrimitive->getPrimitive3DID())
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
{
- case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ // polyPolygonMaterialPrimitive3D, check texturing and hatching
+ const PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive);
+ const basegfx::B3DPolyPolygon& aFillPolyPolygon(rPrimitive.getB3DPolyPolygon());
+
+ if(maHatch.isFillBackground())
{
- // polyPolygonMaterialPrimitive3D, check texturing and hatching
- const PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive);
- const basegfx::B3DPolyPolygon& aFillPolyPolygon(rPrimitive.getB3DPolyPolygon());
+ // add original primitive for background
+ aDestination.push_back(xReference);
+ }
- if(maHatch.isFillBackground())
+ if(aFillPolyPolygon.areTextureCoordinatesUsed())
+ {
+ const sal_uInt32 nPolyCount(aFillPolyPolygon.count());
+ basegfx::B2DPolyPolygon aTexPolyPolygon;
+ basegfx::B2DPoint a2N;
+ basegfx::B2DVector a2X, a2Y;
+ basegfx::B3DPoint a3N;
+ basegfx::B3DVector a3X, a3Y;
+ bool b2N(false), b2X(false), b2Y(false);
+
+ for(sal_uInt32 b(0); b < nPolyCount; b++)
{
- // add original primitive for background
- aDestination.push_back(xReference);
- }
+ const basegfx::B3DPolygon& aPartPoly(aFillPolyPolygon.getB3DPolygon(b));
+ const sal_uInt32 nPointCount(aPartPoly.count());
+ basegfx::B2DPolygon aTexPolygon;
- if(aFillPolyPolygon.areTextureCoordinatesUsed())
- {
- const sal_uInt32 nPolyCount(aFillPolyPolygon.count());
- basegfx::B2DPolyPolygon aTexPolyPolygon;
- basegfx::B2DPoint a2N;
- basegfx::B2DVector a2X, a2Y;
- basegfx::B3DPoint a3N;
- basegfx::B3DVector a3X, a3Y;
- bool b2N(false), b2X(false), b2Y(false);
-
- for(sal_uInt32 b(0); b < nPolyCount; b++)
+ for(sal_uInt32 c(0); c < nPointCount; c++)
{
- const basegfx::B3DPolygon& aPartPoly(aFillPolyPolygon.getB3DPolygon(b));
- const sal_uInt32 nPointCount(aPartPoly.count());
- basegfx::B2DPolygon aTexPolygon;
+ const basegfx::B2DPoint a2Candidate(aPartPoly.getTextureCoordinate(c));
- for(sal_uInt32 c(0); c < nPointCount; c++)
+ if(!b2N)
{
- const basegfx::B2DPoint a2Candidate(aPartPoly.getTextureCoordinate(c));
-
- if(!b2N)
- {
- a2N = a2Candidate;
- a3N = aPartPoly.getB3DPoint(c);
- b2N = true;
- }
- else if(!b2X && !a2N.equal(a2Candidate))
- {
- a2X = a2Candidate - a2N;
- a3X = aPartPoly.getB3DPoint(c) - a3N;
- b2X = true;
- }
- else if(!b2Y && !a2N.equal(a2Candidate) && !a2X.equal(a2Candidate))
- {
- a2Y = a2Candidate - a2N;
+ a2N = a2Candidate;
+ a3N = aPartPoly.getB3DPoint(c);
+ b2N = true;
+ }
+ else if(!b2X && !a2N.equal(a2Candidate))
+ {
+ a2X = a2Candidate - a2N;
+ a3X = aPartPoly.getB3DPoint(c) - a3N;
+ b2X = true;
+ }
+ else if(!b2Y && !a2N.equal(a2Candidate) && !a2X.equal(a2Candidate))
+ {
+ a2Y = a2Candidate - a2N;
- const double fCross(a2X.cross(a2Y));
+ const double fCross(a2X.cross(a2Y));
- if(!basegfx::fTools::equalZero(fCross))
- {
- a3Y = aPartPoly.getB3DPoint(c) - a3N;
- b2Y = true;
- }
+ if(!basegfx::fTools::equalZero(fCross))
+ {
+ a3Y = aPartPoly.getB3DPoint(c) - a3N;
+ b2Y = true;
}
-
- aTexPolygon.append(a2Candidate);
}
- aTexPolygon.setClosed(true);
- aTexPolyPolygon.append(aTexPolygon);
+ aTexPolygon.append(a2Candidate);
}
- if(b2N && b2X && b2Y)
+ aTexPolygon.setClosed(true);
+ aTexPolyPolygon.append(aTexPolygon);
+ }
+
+ if(b2N && b2X && b2Y)
+ {
+ // found two linearly independent 2D vectors
+ // get 2d range of texture coordinates
+ const basegfx::B2DRange aOutlineRange(basegfx::utils::getRange(aTexPolyPolygon));
+ const basegfx::BColor aHatchColor(getHatch().getColor());
+ const double fAngle(getHatch().getAngle());
+ std::vector< basegfx::B2DHomMatrix > aMatrices;
+
+ // get hatch transformations
+ switch(getHatch().getStyle())
{
- // found two linearly independent 2D vectors
- // get 2d range of texture coordinates
- const basegfx::B2DRange aOutlineRange(basegfx::utils::getRange(aTexPolyPolygon));
- const basegfx::BColor aHatchColor(getHatch().getColor());
- const double fAngle(getHatch().getAngle());
- std::vector< basegfx::B2DHomMatrix > aMatrices;
-
- // get hatch transformations
- switch(getHatch().getStyle())
+ case attribute::HatchStyle::Triple:
{
- case attribute::HatchStyle::Triple:
- {
- // rotated 45 degrees
- texture::GeoTexSvxHatch aHatch(
- aOutlineRange,
- aOutlineRange,
- getHatch().getDistance(),
- fAngle - F_PI4);
-
- aHatch.appendTransformations(aMatrices);
-
- [[fallthrough]];
- }
- case attribute::HatchStyle::Double:
- {
- // rotated 90 degrees
- texture::GeoTexSvxHatch aHatch(
- aOutlineRange,
- aOutlineRange,
- getHatch().getDistance(),
- fAngle - F_PI2);
+ // rotated 45 degrees
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle - M_PI_4);
- aHatch.appendTransformations(aMatrices);
+ aHatch.appendTransformations(aMatrices);
- [[fallthrough]];
- }
- case attribute::HatchStyle::Single:
- {
- // angle as given
- texture::GeoTexSvxHatch aHatch(
- aOutlineRange,
- aOutlineRange,
- getHatch().getDistance(),
- fAngle);
-
- aHatch.appendTransformations(aMatrices);
- }
+ [[fallthrough]];
}
+ case attribute::HatchStyle::Double:
+ {
+ // rotated 90 degrees
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle - M_PI_2);
- // create geometry from unit line
- basegfx::B2DPolyPolygon a2DHatchLines;
- basegfx::B2DPolygon a2DUnitLine;
- a2DUnitLine.append(basegfx::B2DPoint(0.0, 0.0));
- a2DUnitLine.append(basegfx::B2DPoint(1.0, 0.0));
+ aHatch.appendTransformations(aMatrices);
- for(const basegfx::B2DHomMatrix & rMatrix : aMatrices)
- {
- basegfx::B2DPolygon aNewLine(a2DUnitLine);
- aNewLine.transform(rMatrix);
- a2DHatchLines.append(aNewLine);
+ [[fallthrough]];
}
-
- if(a2DHatchLines.count())
+ case attribute::HatchStyle::Single:
{
- // clip against texture polygon
- a2DHatchLines = basegfx::utils::clipPolyPolygonOnPolyPolygon(a2DHatchLines, aTexPolyPolygon, true, true);
+ // angle as given
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle);
+
+ aHatch.appendTransformations(aMatrices);
}
+ }
+
+ // create geometry from unit line
+ basegfx::B2DPolyPolygon a2DHatchLines;
+ basegfx::B2DPolygon a2DUnitLine;
+ a2DUnitLine.append(basegfx::B2DPoint(0.0, 0.0));
+ a2DUnitLine.append(basegfx::B2DPoint(1.0, 0.0));
+
+ for(const basegfx::B2DHomMatrix & rMatrix : aMatrices)
+ {
+ basegfx::B2DPolygon aNewLine(a2DUnitLine);
+ aNewLine.transform(rMatrix);
+ a2DHatchLines.append(aNewLine);
+ }
+
+ if(a2DHatchLines.count())
+ {
+ // clip against texture polygon
+ a2DHatchLines = basegfx::utils::clipPolyPolygonOnPolyPolygon(a2DHatchLines, aTexPolyPolygon, true, true);
+ }
- if(a2DHatchLines.count())
+ if(a2DHatchLines.count())
+ {
+ // create 2d matrix with 2d vectors as column vectors and 2d point as offset, this represents
+ // a coordinate system transformation from unit coordinates to the new coordinate system
+ basegfx::B2DHomMatrix a2D;
+ a2D.set(0, 0, a2X.getX());
+ a2D.set(1, 0, a2X.getY());
+ a2D.set(0, 1, a2Y.getX());
+ a2D.set(1, 1, a2Y.getY());
+ a2D.set(0, 2, a2N.getX());
+ a2D.set(1, 2, a2N.getY());
+
+ // invert that transformation, so we have a back-transformation from texture coordinates
+ // to unit coordinates
+ a2D.invert();
+ a2DHatchLines.transform(a2D);
+
+ // expand back-transformed geometry to 3D
+ basegfx::B3DPolyPolygon a3DHatchLines(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(a2DHatchLines, 0.0));
+
+ // create 3d matrix with 3d vectors as column vectors (0,0,1 as Z) and 3d point as offset, this represents
+ // a coordinate system transformation from unit coordinates to the object's 3d coordinate system
+ basegfx::B3DHomMatrix a3D;
+ a3D.set(0, 0, a3X.getX());
+ a3D.set(1, 0, a3X.getY());
+ a3D.set(2, 0, a3X.getZ());
+ a3D.set(0, 1, a3Y.getX());
+ a3D.set(1, 1, a3Y.getY());
+ a3D.set(2, 1, a3Y.getZ());
+ a3D.set(0, 3, a3N.getX());
+ a3D.set(1, 3, a3N.getY());
+ a3D.set(2, 3, a3N.getZ());
+
+ // transform hatch lines to 3D object coordinates
+ a3DHatchLines.transform(a3D);
+
+ // build primitives from this geometry
+ const sal_uInt32 nHatchLines(a3DHatchLines.count());
+
+ for(sal_uInt32 d(0); d < nHatchLines; d++)
{
- // create 2d matrix with 2d vectors as column vectors and 2d point as offset, this represents
- // a coordinate system transformation from unit coordinates to the new coordinate system
- basegfx::B2DHomMatrix a2D;
- a2D.set(0, 0, a2X.getX());
- a2D.set(1, 0, a2X.getY());
- a2D.set(0, 1, a2Y.getX());
- a2D.set(1, 1, a2Y.getY());
- a2D.set(0, 2, a2N.getX());
- a2D.set(1, 2, a2N.getY());
-
- // invert that transformation, so we have a back-transformation from texture coordinates
- // to unit coordinates
- a2D.invert();
- a2DHatchLines.transform(a2D);
-
- // expand back-transformed geometry to 3D
- basegfx::B3DPolyPolygon a3DHatchLines(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(a2DHatchLines, 0.0));
-
- // create 3d matrix with 3d vectors as column vectors (0,0,1 as Z) and 3d point as offset, this represents
- // a coordinate system transformation from unit coordinates to the object's 3d coordinate system
- basegfx::B3DHomMatrix a3D;
- a3D.set(0, 0, a3X.getX());
- a3D.set(1, 0, a3X.getY());
- a3D.set(2, 0, a3X.getZ());
- a3D.set(0, 1, a3Y.getX());
- a3D.set(1, 1, a3Y.getY());
- a3D.set(2, 1, a3Y.getZ());
- a3D.set(0, 3, a3N.getX());
- a3D.set(1, 3, a3N.getY());
- a3D.set(2, 3, a3N.getZ());
-
- // transform hatch lines to 3D object coordinates
- a3DHatchLines.transform(a3D);
-
- // build primitives from this geometry
- const sal_uInt32 nHatchLines(a3DHatchLines.count());
-
- for(sal_uInt32 d(0); d < nHatchLines; d++)
- {
- const Primitive3DReference xRef(new PolygonHairlinePrimitive3D(a3DHatchLines.getB3DPolygon(d), aHatchColor));
- aDestination.push_back(xRef);
- }
+ const Primitive3DReference xRef(new PolygonHairlinePrimitive3D(a3DHatchLines.getB3DPolygon(d), aHatchColor));
+ aDestination.push_back(xRef);
}
}
}
-
- break;
- }
- default :
- {
- // add reference to result
- aDestination.push_back(xReference);
- break;
}
+
+ break;
+ }
+ default :
+ {
+ // add reference to result
+ aDestination.push_back(xReference);
+ break;
}
- }
- else
- {
- // unknown implementation, add to result
- aDestination.push_back(xReference);
}
}
}
@@ -276,14 +268,13 @@ namespace drawinglayer::primitive3d
}
HatchTexturePrimitive3D::HatchTexturePrimitive3D(
- const attribute::FillHatchAttribute& rHatch,
+ attribute::FillHatchAttribute aHatch,
const Primitive3DContainer& rChildren,
const basegfx::B2DVector& rTextureSize,
bool bModulate,
bool bFilter)
: TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
- maHatch(rHatch),
- maBuffered3DDecomposition()
+ maHatch(std::move(aHatch))
{
}
@@ -301,12 +292,11 @@ namespace drawinglayer::primitive3d
Primitive3DContainer HatchTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if(getBuffered3DDecomposition().empty())
{
- const Primitive3DContainer aNewSequence(impCreate3DDecomposition());
- const_cast< HatchTexturePrimitive3D* >(this)->maBuffered3DDecomposition = aNewSequence;
+ const_cast<HatchTexturePrimitive3D*>(this)->maBuffered3DDecomposition = impCreate3DDecomposition();
}
return getBuffered3DDecomposition();
diff --git a/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx
index 1a367e501d29..8d69d8741097 100644
--- a/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx
@@ -21,9 +21,6 @@
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-using namespace com::sun::star;
-
-
namespace drawinglayer::primitive3d
{
HiddenGeometryPrimitive3D::HiddenGeometryPrimitive3D(
diff --git a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
index 255f0235c911..64ae9b949ca1 100644
--- a/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx
@@ -19,18 +19,16 @@
#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-
-
-using namespace com::sun::star;
+#include <utility>
namespace drawinglayer::primitive3d
{
ModifiedColorPrimitive3D::ModifiedColorPrimitive3D(
const Primitive3DContainer& rChildren,
- const basegfx::BColorModifierSharedPtr& rColorModifier)
+ basegfx::BColorModifierSharedPtr xColorModifier)
: GroupPrimitive3D(rChildren),
- maColorModifier(rColorModifier)
+ maColorModifier(std::move(xColorModifier))
{
}
diff --git a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
index ac820546b9fa..6127ac77666b 100644
--- a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
@@ -22,6 +22,7 @@
#include <basegfx/polygon/b3dpolypolygon.hxx>
#include <primitive3d/polygontubeprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <utility>
using namespace com::sun::star;
@@ -30,10 +31,9 @@ using namespace com::sun::star;
namespace drawinglayer::primitive3d
{
PolygonHairlinePrimitive3D::PolygonHairlinePrimitive3D(
- const basegfx::B3DPolygon& rPolygon,
+ basegfx::B3DPolygon aPolygon,
const basegfx::BColor& rBColor)
- : BasePrimitive3D(),
- maPolygon(rPolygon),
+ : maPolygon(std::move(aPolygon)),
maBColor(rBColor)
{
}
@@ -118,13 +118,12 @@ namespace drawinglayer::primitive3d
}
PolygonStrokePrimitive3D::PolygonStrokePrimitive3D(
- const basegfx::B3DPolygon& rPolygon,
+ basegfx::B3DPolygon aPolygon,
const attribute::LineAttribute& rLineAttribute,
- const attribute::StrokeAttribute& rStrokeAttribute)
- : BufferedDecompositionPrimitive3D(),
- maPolygon(rPolygon),
+ attribute::StrokeAttribute aStrokeAttribute)
+ : maPolygon(std::move(aPolygon)),
maLineAttribute(rLineAttribute),
- maStrokeAttribute(rStrokeAttribute)
+ maStrokeAttribute(std::move(aStrokeAttribute))
{
}
diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
index 177d829ef4fc..473d836dc462 100644
--- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
@@ -25,8 +25,7 @@
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-#include <rtl/instance.hxx>
-
+#include <mutex>
namespace drawinglayer::primitive3d
{
@@ -39,7 +38,7 @@ namespace drawinglayer::primitive3d
Primitive3DContainer m_aLineTubeList;
sal_uInt32 m_nLineTubeSegments;
attribute::MaterialAttribute3D m_aLineMaterial;
- ::osl::Mutex m_aMutex;
+ std::mutex m_aMutex;
public:
TubeBuffer()
: m_nLineTubeSegments(0)
@@ -54,7 +53,7 @@ namespace drawinglayer::primitive3d
const attribute::MaterialAttribute3D& rMaterial)
{
// may exclusively change cached data, use mutex
- ::osl::MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
if (nSegments != m_nLineTubeSegments || !(rMaterial == m_aLineMaterial))
{
@@ -70,7 +69,7 @@ namespace drawinglayer::primitive3d
basegfx::B3DPoint aLastLeft(0.0, 1.0, 0.0);
basegfx::B3DPoint aLastRight(1.0, 1.0, 0.0);
basegfx::B3DHomMatrix aRot;
- aRot.rotate(F_2PI / static_cast<double>(m_nLineTubeSegments), 0.0, 0.0);
+ aRot.rotate(2 * M_PI / static_cast<double>(m_nLineTubeSegments), 0.0, 0.0);
m_aLineTubeList.resize(m_nLineTubeSegments);
for(sal_uInt32 a = 0; a < m_nLineTubeSegments; ++a)
@@ -93,9 +92,8 @@ namespace drawinglayer::primitive3d
aNewPolygon.setClosed(true);
- const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
- const Primitive3DReference xRef(new PolyPolygonMaterialPrimitive3D(aNewPolyPolygon, m_aLineMaterial, false));
- m_aLineTubeList[a] = xRef;
+ basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
+ m_aLineTubeList[a] = new PolyPolygonMaterialPrimitive3D(std::move(aNewPolyPolygon), m_aLineMaterial, false);
aLastLeft = aNextLeft;
aLastRight = aNextRight;
@@ -105,16 +103,13 @@ namespace drawinglayer::primitive3d
}
};
- struct theTubeBuffer :
- public rtl::Static< TubeBuffer, theTubeBuffer > {};
-
Primitive3DContainer getLineTubeSegments(
sal_uInt32 nSegments,
const attribute::MaterialAttribute3D& rMaterial)
{
// static data for buffered tube primitives
- TubeBuffer &rTheBuffer = theTubeBuffer::get();
- return rTheBuffer.getLineTubeSegments(nSegments, rMaterial);
+ static TubeBuffer theTubeBuffer;
+ return theTubeBuffer.getLineTubeSegments(nSegments, rMaterial);
}
class CapBuffer
@@ -124,7 +119,7 @@ namespace drawinglayer::primitive3d
Primitive3DContainer m_aLineCapList;
sal_uInt32 m_nLineCapSegments;
attribute::MaterialAttribute3D m_aLineMaterial;
- ::osl::Mutex m_aMutex;
+ std::mutex m_aMutex;
public:
CapBuffer()
: m_nLineCapSegments(0)
@@ -138,7 +133,7 @@ namespace drawinglayer::primitive3d
const attribute::MaterialAttribute3D& rMaterial)
{
// may exclusively change cached data, use mutex
- ::osl::MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
if (nSegments != m_nLineCapSegments || !(rMaterial == m_aLineMaterial))
{
@@ -152,7 +147,7 @@ namespace drawinglayer::primitive3d
const basegfx::B3DPoint aNull(0.0, 0.0, 0.0);
basegfx::B3DPoint aLast(0.0, 1.0, 0.0);
basegfx::B3DHomMatrix aRot;
- aRot.rotate(F_2PI / static_cast<double>(m_nLineCapSegments), 0.0, 0.0);
+ aRot.rotate(2 * M_PI / static_cast<double>(m_nLineCapSegments), 0.0, 0.0);
m_aLineCapList.resize(m_nLineCapSegments);
for(sal_uInt32 a = 0; a < m_nLineCapSegments; ++a)
@@ -171,9 +166,8 @@ namespace drawinglayer::primitive3d
aNewPolygon.setClosed(true);
- const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
- const Primitive3DReference xRef(new PolyPolygonMaterialPrimitive3D(aNewPolyPolygon, m_aLineMaterial, false));
- m_aLineCapList[a] = xRef;
+ basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
+ m_aLineCapList[a] = new PolyPolygonMaterialPrimitive3D(std::move(aNewPolyPolygon), m_aLineMaterial, false);
aLast = aNext;
}
@@ -183,16 +177,13 @@ namespace drawinglayer::primitive3d
}
};
- struct theCapBuffer :
- public rtl::Static< CapBuffer, theCapBuffer > {};
-
Primitive3DContainer getLineCapSegments(
sal_uInt32 nSegments,
const attribute::MaterialAttribute3D& rMaterial)
{
// static data for buffered cap primitives
- CapBuffer &rTheBuffer = theCapBuffer::get();
- return rTheBuffer.getLineCapSegments(nSegments, rMaterial);
+ static CapBuffer theCapBuffer;
+ return theCapBuffer.getLineCapSegments(nSegments, rMaterial);
}
class CapRoundBuffer
@@ -202,7 +193,7 @@ namespace drawinglayer::primitive3d
Primitive3DContainer m_aLineCapRoundList;
sal_uInt32 m_nLineCapRoundSegments;
attribute::MaterialAttribute3D m_aLineMaterial;
- ::osl::Mutex m_aMutex;
+ std::mutex m_aMutex;
public:
CapRoundBuffer()
: m_nLineCapRoundSegments(0)
@@ -216,7 +207,7 @@ namespace drawinglayer::primitive3d
const attribute::MaterialAttribute3D& rMaterial)
{
// may exclusively change cached data, use mutex
- ::osl::MutexGuard aGuard(m_aMutex);
+ std::unique_lock aGuard(m_aMutex);
if (nSegments != m_nLineCapRoundSegments || !(rMaterial == m_aLineMaterial))
{
@@ -241,8 +232,8 @@ namespace drawinglayer::primitive3d
nSegments,
nVerSeg,
true,
- F_PI2, 0.0,
- 0.0, F_2PI));
+ M_PI_2, 0.0,
+ 0.0, 2 * M_PI));
const sal_uInt32 nCount(aSphere.count());
if (nCount)
@@ -251,7 +242,7 @@ namespace drawinglayer::primitive3d
// forget to transform normals, too
basegfx::B3DHomMatrix aSphereTrans;
- aSphereTrans.rotate(0.0, 0.0, F_PI2);
+ aSphereTrans.rotate(0.0, 0.0, M_PI_2);
aSphere.transform(aSphereTrans);
aSphere.transformNormals(aSphereTrans);
@@ -261,12 +252,12 @@ namespace drawinglayer::primitive3d
for (sal_uInt32 a = 0; a < nCount; ++a)
{
const basegfx::B3DPolygon& aPartPolygon(aSphere.getB3DPolygon(a));
- const basegfx::B3DPolyPolygon aPartPolyPolygon(aPartPolygon);
+ basegfx::B3DPolyPolygon aPartPolyPolygon(aPartPolygon);
// need to create one primitive per Polygon since the primitive
// is for planar PolyPolygons which is definitely not the case here
m_aLineCapRoundList[a] = new PolyPolygonMaterialPrimitive3D(
- aPartPolyPolygon,
+ std::move(aPartPolyPolygon),
rMaterial,
false);
}
@@ -278,17 +269,13 @@ namespace drawinglayer::primitive3d
};
- struct theCapRoundBuffer :
- public rtl::Static< CapRoundBuffer, theCapRoundBuffer > {};
-
-
Primitive3DContainer getLineCapRoundSegments(
sal_uInt32 nSegments,
const attribute::MaterialAttribute3D& rMaterial)
{
// static data for buffered cap primitives
- CapRoundBuffer &rTheBuffer = theCapRoundBuffer::get();
- return rTheBuffer.getLineCapRoundSegments(nSegments, rMaterial);
+ static CapRoundBuffer theCapRoundBuffer;
+ return theCapRoundBuffer.getLineCapRoundSegments(nSegments, rMaterial);
}
Primitive3DContainer getLineJoinSegments(
@@ -307,19 +294,18 @@ namespace drawinglayer::primitive3d
if(basegfx::B2DLineJoin::Round == aLineJoin)
{
// calculate new horizontal segments
- const sal_uInt32 nHorSeg(basegfx::fround((fAngle / F_2PI) * static_cast<double>(nSegments)));
+ const sal_uInt32 nHorSeg(basegfx::fround((fAngle / (2 * M_PI)) * static_cast<double>(nSegments)));
if(nHorSeg)
{
// create half-sphere
- const basegfx::B3DPolyPolygon aSphere(basegfx::utils::createUnitSphereFillPolyPolygon(nHorSeg, nVerSeg, true, F_PI2, -F_PI2, 0.0, fAngle));
+ const basegfx::B3DPolyPolygon aSphere(basegfx::utils::createUnitSphereFillPolyPolygon(nHorSeg, nVerSeg, true, M_PI_2, -M_PI_2, 0.0, fAngle));
for(sal_uInt32 a(0); a < aSphere.count(); a++)
{
const basegfx::B3DPolygon& aPartPolygon(aSphere.getB3DPolygon(a));
- const basegfx::B3DPolyPolygon aPartPolyPolygon(aPartPolygon);
- BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aPartPolyPolygon, rMaterial, false);
- aResultVector.push_back(pNew);
+ basegfx::B3DPolyPolygon aPartPolyPolygon(aPartPolygon);
+ aResultVector.push_back(new PolyPolygonMaterialPrimitive3D(std::move(aPartPolyPolygon), rMaterial, false));
}
}
else
@@ -343,13 +329,13 @@ namespace drawinglayer::primitive3d
}
}
- const double fInc(F_PI / static_cast<double>(nVerSeg));
+ const double fInc(M_PI / static_cast<double>(nVerSeg));
const double fSin(sin(-fAngle));
const double fCos(cos(-fAngle));
const bool bMiter(basegfx::B2DLineJoin::Miter == aLineJoin);
const double fMiterSin(bMiter ? sin(-(fAngle/2.0)) : 0.0);
const double fMiterCos(bMiter ? cos(-(fAngle/2.0)) : 0.0);
- double fPos(-F_PI2);
+ double fPos(-M_PI_2);
basegfx::B3DPoint aPointOnXY, aPointRotY, aNextPointOnXY, aNextPointRotY;
basegfx::B3DPoint aCurrMiter, aNextMiter;
basegfx::B3DPolygon aNewPolygon, aMiterPolygon;
@@ -465,9 +451,8 @@ namespace drawinglayer::primitive3d
// create primitive
if(aNewPolygon.count())
{
- const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
- BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aNewPolyPolygon, rMaterial, false);
- aResultVector.push_back(pNew);
+ basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon);
+ aResultVector.push_back(new PolyPolygonMaterialPrimitive3D(std::move(aNewPolyPolygon), rMaterial, false));
}
if(bMiter && aMiterPolygon.count())
@@ -479,9 +464,8 @@ namespace drawinglayer::primitive3d
}
// create primitive
- const basegfx::B3DPolyPolygon aMiterPolyPolygon(aMiterPolygon);
- BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aMiterPolyPolygon, rMaterial, false);
- aResultVector.push_back(pNew);
+ basegfx::B3DPolyPolygon aMiterPolyPolygon(aMiterPolygon);
+ aResultVector.push_back(new PolyPolygonMaterialPrimitive3D(std::move(aMiterPolyPolygon), rMaterial, false));
}
// prepare next step
@@ -501,10 +485,7 @@ namespace drawinglayer::primitive3d
Primitive3DContainer aRetval(aResultVector.size());
- for(size_t a(0); a < aResultVector.size(); a++)
- {
- aRetval[a] = Primitive3DReference(aResultVector[a]);
- }
+ std::transform(aResultVector.cbegin(), aResultVector.cend(), aRetval.begin(), [](auto &rResult){return Primitive3DReference(rResult);});
return aRetval;
}
@@ -536,7 +517,7 @@ using namespace com::sun::star;
if(nPointCount)
{
- if(basegfx::fTools::more(getRadius(), 0.0))
+ if(getRadius() > 0.0)
{
const attribute::MaterialAttribute3D aMaterial(getBColor());
static const sal_uInt32 nSegments(8); // default for 3d line segments, for more quality just raise this value (in even steps)
@@ -553,7 +534,7 @@ using namespace com::sun::star;
const basegfx::B3DVector aForw(aNext - aCurr);
const double fForwLen(aForw.getLength());
- if(basegfx::fTools::more(fForwLen, 0.0))
+ if(fForwLen > 0.0)
{
// find out if linecap is active
const bool bFirst(!a);
@@ -615,8 +596,7 @@ using namespace com::sun::star;
aSequence = getLineCapSegments(nSegments, aMaterial);
}
- TransformPrimitive3D* pNewTransformedA = new TransformPrimitive3D(aCapTrans, aSequence);
- aResultVector.push_back(pNewTransformedA);
+ aResultVector.push_back(new TransformPrimitive3D(std::move(aCapTrans), aSequence));
}
else
{
@@ -626,7 +606,7 @@ using namespace com::sun::star;
if(!basegfx::fTools::equalZero(fCross))
{
// line connect non-parallel, aBack, aForw, use getLineJoin()
- const double fAngle(acos(aBack.scalar(aForw) / (fForwLen * aBack.getLength()))); // 0.0 .. F_PI2
+ const double fAngle(acos(aBack.scalar(aForw) / (fForwLen * aBack.getLength()))); // 0.0 .. M_PI_2
Primitive3DContainer aNewList(
getLineJoinSegments(
nSegments,
@@ -644,8 +624,8 @@ using namespace com::sun::star;
// create trans by rotating unit sphere with angle 90 degrees around Y, then 180-fRot in X.
// Also apply usual scaling and translation
basegfx::B3DHomMatrix aSphereTrans;
- aSphereTrans.rotate(0.0, F_PI2, 0.0);
- aSphereTrans.rotate(F_PI - fRotInYZ, 0.0, 0.0);
+ aSphereTrans.rotate(0.0, M_PI_2, 0.0);
+ aSphereTrans.rotate(M_PI - fRotInYZ, 0.0, 0.0);
aSphereTrans *= aRotVector;
aSphereTrans.scale(getRadius(), getRadius(), getRadius());
aSphereTrans.translate(aCurr.getX(), aCurr.getY(), aCurr.getZ());
@@ -653,7 +633,7 @@ using namespace com::sun::star;
// line start edge, build transformed primitiveVector3D
aResultVector.push_back(
new TransformPrimitive3D(
- aSphereTrans,
+ std::move(aSphereTrans),
aNewList));
}
}
@@ -661,7 +641,7 @@ using namespace com::sun::star;
// create line segments, build transformed primitiveVector3D
aResultVector.push_back(
new TransformPrimitive3D(
- aTubeTrans,
+ std::move(aTubeTrans),
getLineTubeSegments(nSegments, aMaterial)));
if(bNoLineJoin || (!bClosed && bLast))
@@ -670,7 +650,7 @@ using namespace com::sun::star;
basegfx::B3DHomMatrix aBackCapTrans;
// Mirror (line end) and radius scale
- aBackCapTrans.rotate(0.0, F_PI, 0.0);
+ aBackCapTrans.rotate(0.0, M_PI, 0.0);
aBackCapTrans.scale(getRadius(), getRadius(), getRadius());
if(bLineCapSquare && bLast)
@@ -704,7 +684,7 @@ using namespace com::sun::star;
aResultVector.push_back(
new TransformPrimitive3D(
- aBackCapTrans,
+ std::move(aBackCapTrans),
aSequence));
}
}
@@ -717,18 +697,14 @@ using namespace com::sun::star;
else
{
// create hairline
- PolygonHairlinePrimitive3D* pNew = new PolygonHairlinePrimitive3D(getB3DPolygon(), getBColor());
- aResultVector.push_back(pNew);
+ aResultVector.push_back(new PolygonHairlinePrimitive3D(getB3DPolygon(), getBColor()));
}
}
// prepare return value
Primitive3DContainer aRetval(aResultVector.size());
- for(size_t a(0); a < aResultVector.size(); a++)
- {
- aRetval[a] = Primitive3DReference(aResultVector[a]);
- }
+ std::transform(aResultVector.cbegin(), aResultVector.cend(), aRetval.begin(), [](auto &rResult){return Primitive3DReference(rResult);});
return aRetval;
}
@@ -741,7 +717,6 @@ using namespace com::sun::star;
double fDegreeStepWidth,
double fMiterMinimumAngle)
: PolygonHairlinePrimitive3D(rPolygon, rBColor),
- maLast3DDecomposition(),
mfRadius(fRadius),
mfDegreeStepWidth(fDegreeStepWidth),
mfMiterMinimumAngle(fMiterMinimumAngle),
@@ -768,12 +743,12 @@ using namespace com::sun::star;
Primitive3DContainer PolygonTubePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if(getLast3DDecomposition().empty())
{
- const Primitive3DContainer aNewSequence(impCreate3DDecomposition(rViewInformation));
- const_cast< PolygonTubePrimitive3D* >(this)->maLast3DDecomposition = aNewSequence;
+ Primitive3DContainer aNewSequence(impCreate3DDecomposition(rViewInformation));
+ const_cast< PolygonTubePrimitive3D* >(this)->maLast3DDecomposition = std::move(aNewSequence);
}
return getLast3DDecomposition();
diff --git a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx
index db137b47eb28..5a03a89841e0 100644
--- a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx
@@ -20,19 +20,16 @@
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-
-
-using namespace com::sun::star;
+#include <utility>
namespace drawinglayer::primitive3d
{
PolyPolygonMaterialPrimitive3D::PolyPolygonMaterialPrimitive3D(
- const basegfx::B3DPolyPolygon& rPolyPolygon,
+ basegfx::B3DPolyPolygon aPolyPolygon,
const attribute::MaterialAttribute3D& rMaterial,
bool bDoubleSided)
- : BasePrimitive3D(),
- maPolyPolygon(rPolyPolygon),
+ : maPolyPolygon(std::move(aPolyPolygon)),
maMaterial(rMaterial),
mbDoubleSided(bDoubleSided)
{
diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
index 826583b1404c..d69bb87b865c 100644
--- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx
@@ -36,6 +36,7 @@
#include <drawinglayer/attribute/sdrfillattribute.hxx>
#include <drawinglayer/attribute/sdrshadowattribute.hxx>
#include <primitive3d/hiddengeometryprimitive3d.hxx>
+#include <rtl/ref.hxx>
namespace drawinglayer::primitive3d
@@ -136,15 +137,14 @@ namespace drawinglayer::primitive3d
// create line and stroke attribute
const attribute::LineAttribute aLineAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin(), rLine.getCap());
- const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen());
+ const attribute::StrokeAttribute aStrokeAttribute(std::vector(rLine.getDotDashArray()), rLine.getFullDotDashLen());
// create primitives
Primitive3DContainer aRetval(aScaledPolyPolygon.count());
for(sal_uInt32 a(0); a < aScaledPolyPolygon.count(); a++)
{
- const Primitive3DReference xRef(new PolygonStrokePrimitive3D(aScaledPolyPolygon.getB3DPolygon(a), aLineAttribute, aStrokeAttribute));
- aRetval[a] = xRef;
+ aRetval[a] = new PolygonStrokePrimitive3D(aScaledPolyPolygon.getB3DPolygon(a), aLineAttribute, aStrokeAttribute);
}
if(0.0 != rLine.getTransparence())
@@ -184,7 +184,7 @@ namespace drawinglayer::primitive3d
}
const Primitive3DReference xRef(new PolyPolygonMaterialPrimitive3D(
- aScaledPolyPolygon,
+ std::move(aScaledPolyPolygon),
aSdr3DObjectAttribute.getMaterial(),
aSdr3DObjectAttribute.getDoubleSided()));
aRetval[a] = xRef;
@@ -197,7 +197,7 @@ namespace drawinglayer::primitive3d
{
bool bModulate(css::drawing::TextureMode_MODULATE == aSdr3DObjectAttribute.getTextureMode());
bool bFilter(aSdr3DObjectAttribute.getTextureFilter());
- BasePrimitive3D* pNewTexturePrimitive3D = nullptr;
+ rtl::Reference<BasePrimitive3D> pNewTexturePrimitive3D;
if(!rFill.getGradient().isDefault())
{
@@ -233,18 +233,17 @@ namespace drawinglayer::primitive3d
}
// exchange aRetval content with texture group
- const Primitive3DReference xRef(pNewTexturePrimitive3D);
- aRetval = { xRef };
+ aRetval = { Primitive3DReference(pNewTexturePrimitive3D) };
if(css::drawing::TextureKind2_LUMINANCE == aSdr3DObjectAttribute.getTextureKind())
{
// use modified color primitive to force textures to gray
- const basegfx::BColorModifierSharedPtr aBColorModifier =
+ basegfx::BColorModifierSharedPtr aBColorModifier =
std::make_shared<basegfx::BColorModifier_gray>();
- const Primitive3DReference xRef2(
+ Primitive3DReference xRef2(
new ModifiedColorPrimitive3D(
aRetval,
- aBColorModifier));
+ std::move(aBColorModifier)));
aRetval = { xRef2 };
}
diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
index afe030ac77b9..2e1071c1f9a6 100644
--- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
@@ -71,7 +71,7 @@ namespace
{
rOuterPolyPolygon = rPolygon;
- if(!basegfx::fTools::more(fOffset, 0.0))
+ if (fOffset <= 0.0 || basegfx::fTools::equalZero(fOffset))
return;
if(bCharacterMode)
@@ -129,10 +129,22 @@ namespace
if(bCreateTextureCoordinates)
{
const double fPolygonLengthA(basegfx::utils::getLength(aSubA));
- fTexHorMultiplicatorA = basegfx::fTools::equalZero(fPolygonLengthA) ? 1.0 : 1.0 / fPolygonLengthA;
+ if (basegfx::fTools::equalZero(fPolygonLengthA))
+ fTexHorMultiplicatorA = 1.0;
+ else
+ {
+ assert(fPolygonLengthA != 0 && "help coverity see it's not zero");
+ fTexHorMultiplicatorA = 1.0 / fPolygonLengthA;
+ }
const double fPolygonLengthB(basegfx::utils::getLength(aSubB));
- fTexHorMultiplicatorB = basegfx::fTools::equalZero(fPolygonLengthB) ? 1.0 : 1.0 / fPolygonLengthB;
+ if (basegfx::fTools::equalZero(fPolygonLengthB))
+ fTexHorMultiplicatorB = 1.0;
+ else
+ {
+ assert(fPolygonLengthB != 0 && "help coverity see it's not zero");
+ fTexHorMultiplicatorB = 1.0 / fPolygonLengthB;
+ }
}
for(sal_uInt32 b(0); b < nEdgeCount; b++)
@@ -312,26 +324,26 @@ namespace
// polygon is closed, one of the points is a member
const sal_uInt32 nPointCount(rPoly.count());
- if(nPointCount)
- {
- basegfx::B2DPoint aCurrent(rPoly.getB2DPoint(0));
- const basegfx::B2DVector aVector(rEnd - rStart);
+ if(!nPointCount)
+ return false;
- for(sal_uInt32 a(0); a < nPointCount; a++)
- {
- const sal_uInt32 nNextIndex((a + 1) % nPointCount);
- const basegfx::B2DPoint aNext(rPoly.getB2DPoint(nNextIndex));
- const basegfx::B2DVector aEdgeVector(aNext - aCurrent);
+ basegfx::B2DPoint aCurrent(rPoly.getB2DPoint(0));
+ const basegfx::B2DVector aVector(rEnd - rStart);
- if(basegfx::utils::findCut(
- rStart, aVector,
- aCurrent, aEdgeVector) != CutFlagValue::NONE)
- {
- return true;
- }
+ for(sal_uInt32 a(0); a < nPointCount; a++)
+ {
+ const sal_uInt32 nNextIndex((a + 1) % nPointCount);
+ const basegfx::B2DPoint aNext(rPoly.getB2DPoint(nNextIndex));
+ const basegfx::B2DVector aEdgeVector(aNext - aCurrent);
- aCurrent = aNext;
+ if(basegfx::utils::findCut(
+ rStart, aVector,
+ aCurrent, aEdgeVector) != CutFlagValue::NONE)
+ {
+ return true;
}
+
+ aCurrent = aNext;
}
return false;
@@ -360,7 +372,7 @@ namespace drawinglayer::primitive3d
else
{
const bool bBackScale(!basegfx::fTools::equal(fBackScale, 1.0));
- const bool bClosedRotation(!bBackScale && basegfx::fTools::equal(fRotation, F_2PI));
+ const bool bClosedRotation(!bBackScale && basegfx::fTools::equal(fRotation, 2 * M_PI));
basegfx::B2DPolyPolygon aFront(rSource);
basegfx::B2DPolyPolygon aBack(rSource);
basegfx::B3DHomMatrix aTransformBack;
@@ -619,6 +631,7 @@ namespace drawinglayer::primitive3d
if(!basegfx::fTools::equalZero(fTexHeight))
{
+ assert(fTexHeight != 0 && "help coverity see it's not zero");
fInvTexHeight = 1.0 / fTexHeight;
}
}
diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
index b7d1c8abdd9b..ed0e8d41c4ab 100644
--- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
@@ -30,6 +30,7 @@
#include <drawinglayer/attribute/sdrfillattribute.hxx>
#include <drawinglayer/attribute/sdrlineattribute.hxx>
#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <utility>
using namespace com::sun::star;
@@ -234,7 +235,7 @@ namespace drawinglayer::primitive3d
// take each angle which deviates more than 10% from going straight as
// special edge. This will detect the two outer edges of pie segments,
// but not always the center one (think about a near 180 degree pie)
- if(F_PI - fabs(fAngle) > F_PI * 0.1)
+ if(M_PI - fabs(fAngle) > M_PI * 0.1)
{
if(nPointCount == nIndexA)
{
@@ -375,7 +376,7 @@ namespace drawinglayer::primitive3d
// again when no longer geometry is needed for non-visible 3D objects as it is now for chart
if(getPolyPolygon().count() && maSlices.empty())
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
const_cast< SdrExtrudePrimitive3D& >(*this).impCreateSlices();
}
@@ -388,7 +389,7 @@ namespace drawinglayer::primitive3d
const basegfx::B2DVector& rTextureSize,
const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
- const basegfx::B2DPolyPolygon& rPolyPolygon,
+ basegfx::B2DPolyPolygon aPolyPolygon,
double fDepth,
double fDiagonal,
double fBackScale,
@@ -398,9 +399,7 @@ namespace drawinglayer::primitive3d
bool bCloseFront,
bool bCloseBack)
: SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
- maCorrectedPolyPolygon(),
- maSlices(),
- maPolyPolygon(rPolyPolygon),
+ maPolyPolygon(std::move(aPolyPolygon)),
mfDepth(fDepth),
mfDiagonal(fDiagonal),
mfBackScale(fBackScale),
@@ -411,13 +410,13 @@ namespace drawinglayer::primitive3d
mbCloseBack(bCloseBack)
{
// make sure depth is positive
- if(basegfx::fTools::lessOrEqual(getDepth(), 0.0))
+ if(getDepth() <= 0.0)
{
mfDepth = 0.0;
}
// make sure the percentage value getDiagonal() is between 0.0 and 1.0
- if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
+ if(getDiagonal() <= 0.0)
{
mfDiagonal = 0.0;
}
@@ -482,13 +481,13 @@ namespace drawinglayer::primitive3d
(!getBuffered3DDecomposition().empty()
&& *mpLastRLGViewInformation != rViewInformation))
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
// conditions of last local decomposition with reduced lines have changed. Remember
// new one and clear current decompositiopn
SdrExtrudePrimitive3D* pThat = const_cast< SdrExtrudePrimitive3D* >(this);
pThat->setBuffered3DDecomposition(Primitive3DContainer());
- pThat->mpLastRLGViewInformation.reset( new geometry::ViewInformation3D(rViewInformation) );
+ pThat->mpLastRLGViewInformation = rViewInformation;
}
}
diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
index 1d5b918a27bf..682ea0c54042 100644
--- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
@@ -26,6 +26,7 @@
#include <drawinglayer/attribute/sdrfillattribute.hxx>
#include <drawinglayer/attribute/sdrlineattribute.hxx>
#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <utility>
using namespace com::sun::star;
@@ -43,7 +44,7 @@ namespace drawinglayer::primitive3d
if(!rSliceVector.empty())
{
const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0));
- const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI));
+ const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), 2 * M_PI));
sal_uInt32 a;
// decide what to create
@@ -227,7 +228,7 @@ namespace drawinglayer::primitive3d
// again when no longer geometry is needed for non-visible 3D objects as it is now for chart
if(getPolyPolygon().count() && maSlices.empty())
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
const_cast< SdrLathePrimitive3D& >(*this).impCreateSlices();
}
@@ -240,7 +241,7 @@ namespace drawinglayer::primitive3d
const basegfx::B2DVector& rTextureSize,
const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
- const basegfx::B2DPolyPolygon& rPolyPolygon,
+ basegfx::B2DPolyPolygon aPolyPolygon,
sal_uInt32 nHorizontalSegments,
sal_uInt32 nVerticalSegments,
double fDiagonal,
@@ -252,9 +253,7 @@ namespace drawinglayer::primitive3d
bool bCloseFront,
bool bCloseBack)
: SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
- maCorrectedPolyPolygon(),
- maSlices(),
- maPolyPolygon(rPolyPolygon),
+ maPolyPolygon(std::move(aPolyPolygon)),
mnHorizontalSegments(nHorizontalSegments),
mnVerticalSegments(nVerticalSegments),
mfDiagonal(fDiagonal),
@@ -267,13 +266,13 @@ namespace drawinglayer::primitive3d
mbCloseBack(bCloseBack)
{
// make sure Rotation is positive
- if(basegfx::fTools::lessOrEqual(getRotation(), 0.0))
+ if(getRotation() <= 0.0)
{
mfRotation = 0.0;
}
// make sure the percentage value getDiagonal() is between 0.0 and 1.0
- if(basegfx::fTools::lessOrEqual(getDiagonal(), 0.0))
+ if(getDiagonal() <= 0.0)
{
mfDiagonal = 0.0;
}
@@ -340,13 +339,13 @@ namespace drawinglayer::primitive3d
(!getBuffered3DDecomposition().empty()
&& *mpLastRLGViewInformation != rViewInformation))
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
// conditions of last local decomposition with reduced lines have changed. Remember
// new one and clear current decompositiopn
SdrLathePrimitive3D* pThat = const_cast< SdrLathePrimitive3D* >(this);
pThat->setBuffered3DDecomposition(Primitive3DContainer());
- pThat->mpLastRLGViewInformation.reset( new geometry::ViewInformation3D(rViewInformation) );
+ pThat->mpLastRLGViewInformation = rViewInformation;
}
}
diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
index 4887802e17a4..9219cc970c86 100644
--- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx
@@ -24,6 +24,7 @@
#include <drawinglayer/attribute/sdrfillattribute.hxx>
#include <drawinglayer/attribute/sdrlineattribute.hxx>
#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <utility>
using namespace com::sun::star;
@@ -37,8 +38,7 @@ namespace drawinglayer::primitive3d
if(getPolyPolygon3D().count())
{
- std::vector< basegfx::B3DPolyPolygon > aFill;
- aFill.push_back(getPolyPolygon3D());
+ std::vector< basegfx::B3DPolyPolygon > aFill { getPolyPolygon3D() };
// get full range
const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill));
@@ -118,13 +118,13 @@ namespace drawinglayer::primitive3d
}
SdrPolyPolygonPrimitive3D::SdrPolyPolygonPrimitive3D(
- const basegfx::B3DPolyPolygon& rPolyPolygon3D,
+ basegfx::B3DPolyPolygon aPolyPolygon3D,
const basegfx::B3DHomMatrix& rTransform,
const basegfx::B2DVector& rTextureSize,
const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
: SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
- maPolyPolygon3D(rPolyPolygon3D)
+ maPolyPolygon3D(std::move(aPolyPolygon3D))
{
}
diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
index ad8b9daca186..7a6feb946ebc 100644
--- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx
@@ -20,9 +20,7 @@
#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#include <drawinglayer/attribute/sdrlineattribute.hxx>
-
-
-using namespace com::sun::star;
+#include <utility>
namespace drawinglayer::primitive3d
@@ -75,14 +73,13 @@ namespace drawinglayer::primitive3d
}
SdrPrimitive3D::SdrPrimitive3D(
- const basegfx::B3DHomMatrix& rTransform,
+ basegfx::B3DHomMatrix aTransform,
const basegfx::B2DVector& rTextureSize,
- const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ attribute::SdrLineFillShadowAttribute3D aSdrLFSAttribute,
const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
- : BufferedDecompositionPrimitive3D(),
- maTransform(rTransform),
+ : maTransform(std::move(aTransform)),
maTextureSize(rTextureSize),
- maSdrLFSAttribute(rSdrLFSAttribute),
+ maSdrLFSAttribute(std::move(aSdrLFSAttribute)),
maSdr3DObjectAttribute(rSdr3DObjectAttribute)
{
}
diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
index 1e0dd7454124..c3127261f502 100644
--- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx
@@ -83,7 +83,7 @@ namespace drawinglayer::primitive3d
// different from forced to sphere texture coordinates,
// create a old version from it by rotating to old state before applying
// the texture coordinates to emulate old behaviour
- fRelativeAngle = F_2PI * (static_cast<double>((getHorizontalSegments() >> 1) - 1) / static_cast<double>(getHorizontalSegments()));
+ fRelativeAngle = 2 * M_PI * (static_cast<double>((getHorizontalSegments() >> 1) - 1) / static_cast<double>(getHorizontalSegments()));
basegfx::B3DHomMatrix aRot;
aRot.rotate(0.0, fRelativeAngle, 0.0);
aFill.transform(aRot);
diff --git a/drawinglayer/source/primitive3d/shadowprimitive3d.cxx b/drawinglayer/source/primitive3d/shadowprimitive3d.cxx
index cca2e3c6f07f..c32d17dbc69e 100644
--- a/drawinglayer/source/primitive3d/shadowprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/shadowprimitive3d.cxx
@@ -19,21 +19,19 @@
#include <primitive3d/shadowprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-
-
-using namespace com::sun::star;
+#include <utility>
namespace drawinglayer::primitive3d
{
ShadowPrimitive3D::ShadowPrimitive3D(
- const basegfx::B2DHomMatrix& rShadowTransform,
+ basegfx::B2DHomMatrix aShadowTransform,
const basegfx::BColor& rShadowColor,
double fShadowTransparence,
bool bShadow3D,
const Primitive3DContainer& rChildren)
: GroupPrimitive3D(rChildren),
- maShadowTransform(rShadowTransform),
+ maShadowTransform(std::move(aShadowTransform)),
maShadowColor(rShadowColor),
mfShadowTransparence(fShadowTransparence),
mbShadow3D(bShadow3D)
diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
index a053a7c214d0..ceeca0489487 100644
--- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
@@ -20,6 +20,8 @@
#include <primitive3d/textureprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <basegfx/color/bcolor.hxx>
+#include <basegfx/utils/gradienttools.hxx>
+#include <utility>
using namespace com::sun::star;
@@ -91,7 +93,13 @@ namespace drawinglayer::primitive3d
{
// create TransparenceTexturePrimitive3D with fixed transparence as replacement
const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence());
- const attribute::FillGradientAttribute aFillGradient(attribute::GradientStyle::Linear, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1);
+
+ // create ColorStops with StartColor == EndColor == aGray
+ const basegfx::BColorStops aColorStops {
+ basegfx::BColorStop(0.0, aGray),
+ basegfx::BColorStop(1.0, aGray) };
+
+ const attribute::FillGradientAttribute aFillGradient(css::awt::GradientStyle_LINEAR, 0.0, 0.0, 0.0, 0.0, aColorStops);
const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize()));
return { xRef };
}
@@ -108,13 +116,13 @@ namespace drawinglayer::primitive3d
GradientTexturePrimitive3D::GradientTexturePrimitive3D(
- const attribute::FillGradientAttribute& rGradient,
+ attribute::FillGradientAttribute aGradient,
const Primitive3DContainer& rChildren,
const basegfx::B2DVector& rTextureSize,
bool bModulate,
bool bFilter)
: TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
- maGradient(rGradient)
+ maGradient(std::move(aGradient))
{
}
diff --git a/drawinglayer/source/primitive3d/transformprimitive3d.cxx b/drawinglayer/source/primitive3d/transformprimitive3d.cxx
index 1ddb919bf2e1..135cba2c55ab 100644
--- a/drawinglayer/source/primitive3d/transformprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/transformprimitive3d.cxx
@@ -19,18 +19,16 @@
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
-
-
-using namespace com::sun::star;
+#include <utility>
namespace drawinglayer::primitive3d
{
TransformPrimitive3D::TransformPrimitive3D(
- const basegfx::B3DHomMatrix& rTransformation,
+ basegfx::B3DHomMatrix aTransformation,
const Primitive3DContainer& rChildren)
: GroupPrimitive3D(rChildren),
- maTransformation(rTransformation)
+ maTransformation(std::move(aTransformation))
{
}