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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 20 10:44:26 UTC 2021


 include/svx/sdr/contact/viewobjectcontact.hxx                      |    3 
 svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx                |    2 
 svx/inc/sdr/contact/viewobjectcontactofgroup.hxx                   |    2 
 svx/inc/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx    |    2 
 svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx                 |    4 -
 svx/source/sdr/contact/objectcontactofpageview.cxx                 |   39 ++++------
 svx/source/sdr/contact/viewobjectcontact.cxx                       |    4 -
 svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx             |    4 -
 svx/source/sdr/contact/viewobjectcontactofgroup.cxx                |    6 -
 svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx |    4 -
 svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx              |    8 +-
 11 files changed, 37 insertions(+), 41 deletions(-)

New commits:
commit 720e4258ab5f00287098ff945a184bfb43911841
Author:     Noel Grandin <noel at peralex.com>
AuthorDate: Fri Aug 20 11:30:35 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 20 12:43:48 2021 +0200

    use Primitive2DDecompositionVisitor in ViewObjectContact (tdf#105575)
    
    ..to avoid container construction
    
    Change-Id: Iae7a8ea8c31b6c8bcf4d161273be7b32fe41a021
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120779
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/sdr/contact/viewobjectcontact.hxx b/include/svx/sdr/contact/viewobjectcontact.hxx
index 92dcc7458876..dd949cf075c7 100644
--- a/include/svx/sdr/contact/viewobjectcontact.hxx
+++ b/include/svx/sdr/contact/viewobjectcontact.hxx
@@ -29,6 +29,7 @@ namespace vcl { class Region; }
 namespace sdr::animation {
     class PrimitiveAnimation;
 }
+namespace drawinglayer::primitive2d { class Primitive2DDecompositionVisitor; }
 
 namespace sdr::contact {
 
@@ -120,7 +121,7 @@ public:
 
     // process this primitive: Eventually also recursively travel an existing hierarchy,
     // e.g. for group objects, scenes or pages. This method will test geometrical visibility.
-    virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer) const;
+    virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const;
 
     // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy
     drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const;
diff --git a/svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx b/svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx
index ff31409ad9c2..27ddbd21842f 100644
--- a/svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx
+++ b/svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx
@@ -37,7 +37,7 @@ namespace sdr::contact
 
             // process this primitive: Eventually also recursively travel an existing hierarchy,
             // e.g. for group objects, scenes or pages. This method will test geometrical visibility.
-            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer ) const override;
+            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor ) const override;
         };
 } // end of namespace sdr::contact
 
diff --git a/svx/inc/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/sdr/contact/viewobjectcontactofgroup.hxx
index a06eea588545..96697b02025e 100644
--- a/svx/inc/sdr/contact/viewobjectcontactofgroup.hxx
+++ b/svx/inc/sdr/contact/viewobjectcontactofgroup.hxx
@@ -32,7 +32,7 @@ namespace sdr::contact
             virtual ~ViewObjectContactOfGroup() override;
 
             // This method recursively paints the draw hierarchy.
-            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer ) const override;
+            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor ) const override;
 
         private:
             virtual bool isPrimitiveVisibleOnAnyLayer(const SdrLayerIDSet& aLayers) const override;
diff --git a/svx/inc/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx b/svx/inc/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx
index 76f92827ba7b..613e7f8b060e 100644
--- a/svx/inc/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx
+++ b/svx/inc/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx
@@ -35,7 +35,7 @@ namespace sdr::contact
             virtual ~ViewObjectContactOfMasterPageDescriptor() override;
 
             virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const override;
-            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer ) const override;
+            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor ) const override;
         };
 
 } // end of namespace sdr::contact
diff --git a/svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx b/svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx
index 2e0a0de4a280..7e04604f7328 100644
--- a/svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx
+++ b/svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx
@@ -127,7 +127,7 @@ namespace sdr::contact
             ViewObjectContactOfPageHierarchy(ObjectContact& rObjectContact, ViewContact& rViewContact);
             virtual ~ViewObjectContactOfPageHierarchy() override;
 
-            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer ) const override;
+            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor ) const override;
         };
 } // end of namespace sdr::contact
 
@@ -167,7 +167,7 @@ namespace sdr::contact
             ViewObjectContactOfSdrPage(ObjectContact& rObjectContact, ViewContact& rViewContact);
             virtual ~ViewObjectContactOfSdrPage() override;
 
-            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer ) const override;
+            virtual void getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor ) const override;
         };
 } // end of namespace sdr::contact
 
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index 8637f7b2f79d..70f1e010ec3f 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -216,11 +216,25 @@ namespace sdr::contact
                 fCurrentTime);
             updateViewInformation2D(aNewViewInformation2D);
 
-            drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence;
+            // if there is something to show, use a primitive processor to render it. There
+            // is a choice between VCL and Canvas processors currently. The decision is made in
+            // createProcessor2DFromOutputDevice and takes into account things like the
+            // Target is a MetaFile, a VDev or something else. The Canvas renderer is triggered
+            // currently using the shown boolean. Canvas is not yet the default.
+
+            // prepare OutputDevice (historical stuff, maybe soon removed)
+            rDisplayInfo.ClearGhostedDrawMode(); // reset, else the VCL-paint with the processor will not do the right thing
+            pOutDev->SetLayoutMode(ComplexTextLayoutFlags::Default); // reset, default is no BiDi/RTL
+
+            // create renderer
+            std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
+                drawinglayer::processor2d::createProcessor2DFromOutputDevice(
+                    rTargetOutDev, getViewInformation2D()));
+
 #if HAVE_FEATURE_DESKTOP || defined( ANDROID )
             // get whole Primitive2DContainer; this will already make use of updated ViewInformation2D
             // and may use the MapMode from the Target OutDev in the DisplayInfo
-            rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo, xPrimitiveSequence);
+            rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo, *pProcessor2D);
 #else
             // Hmm, !HAVE_FEATURE_DESKTOP && !ANDROID means iOS,
             // right? But does it makes sense to use a different code
@@ -256,28 +270,9 @@ namespace sdr::contact
             if (bGetHierarchy)
                 // get whole Primitive2DContainer; this will already make use of updated ViewInformation2D
                 // and may use the MapMode from the Target OutDev in the DisplayInfo
-                rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo, xPrimitiveSequence);
+                rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo, *pProcessor2D);
 #endif
 
-            // if there is something to show, use a primitive processor to render it. There
-            // is a choice between VCL and Canvas processors currently. The decision is made in
-            // createProcessor2DFromOutputDevice and takes into account things like the
-            // Target is a MetaFile, a VDev or something else. The Canvas renderer is triggered
-            // currently using the shown boolean. Canvas is not yet the default.
-            if(!xPrimitiveSequence.empty())
-            {
-                // prepare OutputDevice (historical stuff, maybe soon removed)
-                rDisplayInfo.ClearGhostedDrawMode(); // reset, else the VCL-paint with the processor will not do the right thing
-                pOutDev->SetLayoutMode(ComplexTextLayoutFlags::Default); // reset, default is no BiDi/RTL
-
-                // create renderer
-                std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
-                    drawinglayer::processor2d::createProcessor2DFromOutputDevice(
-                        rTargetOutDev, getViewInformation2D()));
-
-                pProcessor2D->process(xPrimitiveSequence);
-            }
-
             // #114359# restore old ClipReghion
             if(bClipRegionPushed)
             {
diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx
index b9ed56ed7227..8059e55bcf18 100644
--- a/svx/source/sdr/contact/viewobjectcontact.cxx
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -404,7 +404,7 @@ bool ViewObjectContact::isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) cons
     return (GetObjectContact().DoVisualizeEnteredGroup() && !GetObjectContact().isOutputToPrinter() && rDisplayInfo.IsGhostedDrawModeActive());
 }
 
-void ViewObjectContact::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer) const
+void ViewObjectContact::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
 {
     // check model-view visibility
     if(!isPrimitiveVisible(rDisplayInfo))
@@ -424,7 +424,7 @@ void ViewObjectContact::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInf
     if(!bVisible)
         return;
 
-    rContainer.append(xRetval);
+    rVisitor.append(xRetval);
 }
 
 drawinglayer::primitive2d::Primitive2DContainer ViewObjectContact::getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const
diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
index 63cbf3bf7853..37070281b5cf 100644
--- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
@@ -121,7 +121,7 @@ namespace sdr::contact
             return xRetval;
         }
 
-        void ViewObjectContactOfE3dScene::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer) const
+        void ViewObjectContactOfE3dScene::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
         {
             // To get the VOCs for the contained 3D objects created to get the correct
             // Draw hierarchy and ActionChanged() working properly, travel the DrawHierarchy
@@ -129,7 +129,7 @@ namespace sdr::contact
             impInternalSubHierarchyTraveller(*this);
 
             // call parent
-            ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo, rContainer);
+            ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo, rVisitor);
         }
 
 } // end of namespace
diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
index b13e2cbe223f..a8465df9d587 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
@@ -39,7 +39,7 @@ namespace sdr::contact
         {
         }
 
-        void ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer) const
+        void ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
         {
             drawinglayer::primitive2d::Primitive2DContainer xRetval;
 
@@ -83,13 +83,13 @@ namespace sdr::contact
                     rDisplayInfo.SetGhostedDrawMode();
                 }
 
-                rContainer.append(xRetval);
+                rVisitor.append(xRetval);
             }
             else
             {
                 // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence
                 // which creates the replacement primitives for an empty group
-                ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo, rContainer);
+                ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo, rVisitor);
             }
         }
 
diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
index 4fdb0745683b..b938322cbff9 100644
--- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
@@ -54,7 +54,7 @@ namespace sdr::contact
             return true;
         }
 
-        void ViewObjectContactOfMasterPageDescriptor::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer) const
+        void ViewObjectContactOfMasterPageDescriptor::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
         {
             drawinglayer::primitive2d::Primitive2DContainer xRetval;
             drawinglayer::primitive2d::Primitive2DContainer xMasterPageSequence;
@@ -129,7 +129,7 @@ namespace sdr::contact
             }
 
             // return grouped primitive
-            rContainer.append(xRetval);
+            rVisitor.append(xRetval);
         }
 } // end of namespace
 
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
index fefff614ef9d..eca656254aa2 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
@@ -368,7 +368,7 @@ ViewObjectContactOfPageHierarchy::~ViewObjectContactOfPageHierarchy()
 {
 }
 
-void ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer) const
+void ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
 {
     // process local sub-hierarchy
     const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
@@ -391,7 +391,7 @@ void ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy(DisplayIn
         // not visible, release
         return;
 
-    rContainer.append(xRetval);
+    rVisitor.append(xRetval);
 }
 
 ViewObjectContactOfPageGrid::ViewObjectContactOfPageGrid(ObjectContact& rObjectContact, ViewContact& rViewContact)
@@ -578,7 +578,7 @@ ViewObjectContactOfSdrPage::~ViewObjectContactOfSdrPage()
 {
 }
 
-void ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rContainer) const
+void ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
 {
     // process local sub-hierarchy
     const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
@@ -619,7 +619,7 @@ void ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy(DisplayInfo& rD
         rDisplayInfo.SetGhostedDrawMode();
     }
 
-    rContainer.append(xRetval);
+    rVisitor.append(xRetval);
 }
 
 }


More information about the Libreoffice-commits mailing list