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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun May 30 18:19:28 UTC 2021


 drawinglayer/inc/processor3d/zbufferprocessor3d.hxx    |    2 -
 drawinglayer/source/processor3d/zbufferprocessor3d.cxx |   26 +++++------------
 2 files changed, 9 insertions(+), 19 deletions(-)

New commits:
commit 039c7999d4b92122cb4a356a1e65f62026c04173
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun May 30 10:17:12 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun May 30 20:18:52 2021 +0200

    no need to allocate this separately
    
    Change-Id: I78260d3e6ad8ce96db4353fede18d5e3a6808402
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116400
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/drawinglayer/inc/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/processor3d/zbufferprocessor3d.hxx
index 642781e58177..4207a6fcd474 100644
--- a/drawinglayer/inc/processor3d/zbufferprocessor3d.hxx
+++ b/drawinglayer/inc/processor3d/zbufferprocessor3d.hxx
@@ -61,7 +61,7 @@ namespace drawinglayer::processor3d
             /*  remembered RasterPrimitive3D's which need to be painted back to front
                 for transparent 3D parts
              */
-            std::unique_ptr<std::vector< RasterPrimitive3D >> mpRasterPrimitive3Ds;
+            mutable std::vector< RasterPrimitive3D > maRasterPrimitive3Ds;
 
             sal_uInt32 mnStartLine;
             sal_uInt32 mnStopLine;
diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
index 73587089b192..56cfc3c45c18 100644
--- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
@@ -422,12 +422,8 @@ namespace drawinglayer::processor3d
             {
                 // transparent output; record for later sorting and painting from
                 // back to front
-                if(!mpRasterPrimitive3Ds)
-                {
-                    const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds.reset( new std::vector< RasterPrimitive3D > );
-                }
 
-                mpRasterPrimitive3Ds->push_back(RasterPrimitive3D(
+                maRasterPrimitive3Ds.push_back(RasterPrimitive3D(
                     getGeoTexSvx(),
                     getTransparenceGeoTexSvx(),
                     rMaterial,
@@ -486,12 +482,7 @@ namespace drawinglayer::processor3d
             {
                 // transparent output; record for later sorting and painting from
                 // back to front
-                if(!mpRasterPrimitive3Ds)
-                {
-                    const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds.reset( new std::vector< RasterPrimitive3D > );
-                }
-
-                mpRasterPrimitive3Ds->push_back(RasterPrimitive3D(
+                maRasterPrimitive3Ds.push_back(RasterPrimitive3D(
                     getGeoTexSvx(),
                     getTransparenceGeoTexSvx(),
                     rMaterial,
@@ -596,32 +587,31 @@ namespace drawinglayer::processor3d
         {
             mpZBufferRasterConverter3D.reset();
 
-            if(mpRasterPrimitive3Ds)
+            if(!maRasterPrimitive3Ds.empty())
             {
                 OSL_FAIL("ZBufferProcessor3D: destructed, but there are unrendered transparent geometries. Use ZBufferProcessor3D::finish() to render these (!)");
             }
-            mpRasterPrimitive3Ds.reset();
         }
 
         void ZBufferProcessor3D::finish()
         {
-            if(!mpRasterPrimitive3Ds)
+            if(maRasterPrimitive3Ds.empty())
                 return;
 
             // there are transparent rasterprimitives
-            const sal_uInt32 nSize(mpRasterPrimitive3Ds->size());
+            const sal_uInt32 nSize(maRasterPrimitive3Ds.size());
 
             if(nSize > 1)
             {
                 // sort them from back to front
-                std::sort(mpRasterPrimitive3Ds->begin(), mpRasterPrimitive3Ds->end());
+                std::sort(maRasterPrimitive3Ds.begin(), maRasterPrimitive3Ds.end());
             }
 
             for(sal_uInt32 a(0); a < nSize; a++)
             {
                 // paint each one by setting the remembered data and calling
                 // the render method
-                const RasterPrimitive3D& rCandidate = (*mpRasterPrimitive3Ds)[a];
+                const RasterPrimitive3D& rCandidate = maRasterPrimitive3Ds[a];
 
                 mpGeoTexSvx = rCandidate.getGeoTexSvx();
                 mpTransparenceGeoTexSvx = rCandidate.getTransparenceGeoTexSvx();
@@ -645,7 +635,7 @@ namespace drawinglayer::processor3d
 
             // delete them to signal the destructor that all is done and
             // to allow asserting there
-            mpRasterPrimitive3Ds.reset();
+            maRasterPrimitive3Ds.clear();
         }
 
 } // end of namespace


More information about the Libreoffice-commits mailing list