[Libreoffice-commits] core.git: svx/inc svx/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 22 16:55:21 UTC 2021


 svx/inc/sdr/primitive3d/sdrattributecreator3d.hxx    |   10 +++-------
 svx/source/sdr/contact/viewcontactofe3dcube.cxx      |    4 ++--
 svx/source/sdr/contact/viewcontactofe3dextrude.cxx   |    4 ++--
 svx/source/sdr/contact/viewcontactofe3dlathe.cxx     |    4 ++--
 svx/source/sdr/contact/viewcontactofe3dpolygon.cxx   |    4 ++--
 svx/source/sdr/contact/viewcontactofe3dsphere.cxx    |    4 ++--
 svx/source/sdr/primitive3d/sdrattributecreator3d.cxx |    4 ++--
 7 files changed, 15 insertions(+), 19 deletions(-)

New commits:
commit 054166821842de6f25c3123fcc1976b3c9d1d69b
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Aug 22 16:44:21 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Aug 22 18:54:48 2021 +0200

    no need to use unique_ptr for Sdr3DObjectAttribute
    
    it is already a COW type
    
    Change-Id: Icc4173c5a61f5d819ce908f8a38c3efb29ebb1c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120850
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svx/inc/sdr/primitive3d/sdrattributecreator3d.hxx b/svx/inc/sdr/primitive3d/sdrattributecreator3d.hxx
index 327f7da1cbcb..3f517842741e 100644
--- a/svx/inc/sdr/primitive3d/sdrattributecreator3d.hxx
+++ b/svx/inc/sdr/primitive3d/sdrattributecreator3d.hxx
@@ -20,23 +20,19 @@
 #ifndef INCLUDED_SVX_INC_SDR_PRIMITIVE3D_SDRATTRIBUTECREATOR3D_HXX
 #define INCLUDED_SVX_INC_SDR_PRIMITIVE3D_SDRATTRIBUTECREATOR3D_HXX
 
+#include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
 
 // predefines
 class SfxItemSet;
-
-namespace drawinglayer::attribute {
-    class Sdr3DObjectAttribute;
-}
-
 namespace basegfx {
     class B2DRange;
 }
 
 
 namespace drawinglayer::primitive2d
-    {
+{
         // SdrAttribute creators
-        attribute::Sdr3DObjectAttribute* createNewSdr3DObjectAttribute(const SfxItemSet& rSet);
+        attribute::Sdr3DObjectAttribute createNewSdr3DObjectAttribute(const SfxItemSet& rSet);
 
         // helpers
 
diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
index 00e990f576cf..ee79ef9339ca 100644
--- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
@@ -69,7 +69,7 @@ namespace sdr::contact
             aWorldTransform.translate(aCubeRange.getMinX(), aCubeRange.getMinY(), aCubeRange.getMinZ());
 
             // get 3D Object Attributes
-            std::unique_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
+            drawinglayer::attribute::Sdr3DObjectAttribute aSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // calculate texture size to get a perfect mapping for
             // the front/back sides
@@ -78,7 +78,7 @@ namespace sdr::contact
             // create primitive and add
             const drawinglayer::primitive3d::Primitive3DReference xReference(
                 new drawinglayer::primitive3d::SdrCubePrimitive3D(
-                    aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute));
+                    aWorldTransform, aTextureSize, aAttribute, aSdr3DObjectAttribute));
             xRetval = { xReference };
 
             return xRetval;
diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
index d510f9803d5d..3f1a72ab4388 100644
--- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
@@ -49,7 +49,7 @@ namespace sdr::contact
             const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon());
 
             // get 3D Object Attributes
-            std::unique_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
+            drawinglayer::attribute::Sdr3DObjectAttribute aSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // calculate texture size; use size of top/bottom cap to get a perfect mapping
             // for the caps. The in-between geometry will get a stretched size with a
@@ -71,7 +71,7 @@ namespace sdr::contact
             const basegfx::B3DHomMatrix aWorldTransform;
             const drawinglayer::primitive3d::Primitive3DReference xReference(
                 new drawinglayer::primitive3d::SdrExtrudePrimitive3D(
-                    aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+                    aWorldTransform, aTextureSize, aAttribute, aSdr3DObjectAttribute,
                     aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, bSmoothLids,
                     bCharacterMode, bCloseFront, bCloseBack));
             xRetval = { xReference };
diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
index c76cae4df81c..4cf299259c4f 100644
--- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
@@ -49,7 +49,7 @@ namespace sdr::contact
             const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D());
 
             // get 3D Object Attributes
-            std::unique_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
+            drawinglayer::attribute::Sdr3DObjectAttribute aSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // calculate texture size. Use the polygon length of the longest polygon for
             // height and the rotated radius for width (using polygon center) to get a good
@@ -83,7 +83,7 @@ namespace sdr::contact
             const basegfx::B3DHomMatrix aWorldTransform;
             const drawinglayer::primitive3d::Primitive3DReference xReference(
                 new drawinglayer::primitive3d::SdrLathePrimitive3D(
-                    aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+                    aWorldTransform, aTextureSize, aAttribute, aSdr3DObjectAttribute,
                     aPolyPolygon, nHorizontalSegments, nVerticalSegments,
                     fDiagonal, fBackScale, fRotation,
                     bSmoothNormals, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack));
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index ec8a4be00acf..995bb70cdc58 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -97,7 +97,7 @@ namespace sdr::contact
             }
 
             // get 3D Object Attributes
-            std::unique_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
+            drawinglayer::attribute::Sdr3DObjectAttribute aSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // calculate texture size
             basegfx::B2DVector aTextureSize(1.0, 1.0);
@@ -159,7 +159,7 @@ namespace sdr::contact
             const basegfx::B3DHomMatrix aWorldTransform;
             const drawinglayer::primitive3d::Primitive3DReference xReference(
                 new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D(
-                    aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute));
+                    aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, aSdr3DObjectAttribute));
             xRetval = { xReference };
 
             return xRetval;
diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
index c34e098564fc..671a5b670297 100644
--- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
@@ -54,7 +54,7 @@ namespace sdr::contact
             aWorldTransform.translate(aSpherePosition.getX(), aSpherePosition.getY(), aSpherePosition.getZ());
 
             // get 3D Object Attributes
-            std::unique_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
+            drawinglayer::attribute::Sdr3DObjectAttribute aSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // get segment count
             const sal_uInt32 nHorizontalSegments(GetE3dSphereObj().GetHorizontalSegments());
@@ -69,7 +69,7 @@ namespace sdr::contact
             // create primitive and add
             const drawinglayer::primitive3d::Primitive3DReference xReference(
                 new drawinglayer::primitive3d::SdrSpherePrimitive3D(
-                    aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+                    aWorldTransform, aTextureSize, aAttribute, aSdr3DObjectAttribute,
                     nHorizontalSegments, nVerticalSegments));
             xRetval = { xReference };
 
diff --git a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx
index c6721a152617..6bf8f8c6e2e0 100644
--- a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx
+++ b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx
@@ -31,7 +31,7 @@
 
 namespace drawinglayer::primitive2d
 {
-        attribute::Sdr3DObjectAttribute* createNewSdr3DObjectAttribute(const SfxItemSet& rSet)
+        attribute::Sdr3DObjectAttribute createNewSdr3DObjectAttribute(const SfxItemSet& rSet)
         {
             // get NormalsKind
             css::drawing::NormalsKind aNormalsKind(css::drawing::NormalsKind_SPECIFIC);
@@ -135,7 +135,7 @@ namespace drawinglayer::primitive2d
             // prepare material
             attribute::MaterialAttribute3D aMaterial(aObjectColor, aSpecular, aEmission, nSpecularIntensity);
 
-            return new attribute::Sdr3DObjectAttribute(
+            return attribute::Sdr3DObjectAttribute(
                 aNormalsKind, aTextureProjectionX, aTextureProjectionY,
                 aTextureKind, aTextureMode, aMaterial,
                 bInvertNormals, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry);


More information about the Libreoffice-commits mailing list