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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 16 08:12:19 UTC 2020


 include/svx/svdobj.hxx                      |    5 +++++
 sd/source/core/sdpage2.cxx                  |    6 +++++-
 svx/source/svdraw/svdotextdecomposition.cxx |   28 ++++++++++++++++++++++------
 3 files changed, 32 insertions(+), 7 deletions(-)

New commits:
commit b12b1663d135f94eb56f3c1f852ef008e87c4e5f
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Oct 9 18:10:50 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Oct 16 10:11:38 2020 +0200

    try to prefetch also graphics for background fill bitmap
    
    Change-Id: Ib6be487500e45ab984b7ca63d85352696d9d4051
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104132
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index de4ebc3f9b4f..cb98d67a2891 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -74,6 +74,7 @@ class SdrGluePointList;
 class SdrLayerIDSet;
 class Fraction;
 enum class PointerStyle;
+class Graphic;
 
 namespace basegfx
 {
@@ -917,6 +918,8 @@ public:
     const css::uno::WeakReference< css::uno::XInterface >& getWeakUnoShape() const { return maWeakUnoShape; }
 
     void setSuitableOutlinerBg(Outliner& rOutliner) const;
+    // If fillstyle is drawing::FillStyle_BITMAP, returns the graphic.
+    const Graphic* getFillGraphic() const;
 
 protected:
     tools::Rectangle            aOutRect;     // surrounding rectangle for Paint (incl. LineWidth, ...)
@@ -995,6 +998,8 @@ protected:
     // helper function for reimplementing Clone().
     template< typename T > T* CloneHelper(SdrModel& rTargetModel) const;
 
+    const SfxItemSet* getBackgroundFillSet() const;
+
 private:
     struct Impl;
     std::unique_ptr<Impl>             mpImpl;
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 089712ab2693..142b40a6bb25 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -614,9 +614,13 @@ void SdPage::getGraphicsForPrefetch(std::vector<Graphic*>& graphics) const
 {
     for( size_t i = 0; i < GetObjCount(); ++i)
     {
-        if( SdrGrafObj* grafObj = dynamic_cast<SdrGrafObj*>(GetObj(i)))
+        SdrObject* obj = GetObj(i);
+        if( SdrGrafObj* grafObj = dynamic_cast<SdrGrafObj*>(obj))
             if(!grafObj->GetGraphic().isAvailable())
                 graphics.push_back( const_cast<Graphic*>(&grafObj->GetGraphic()));
+        if( const Graphic* fillGraphic = obj->getFillGraphic())
+            if(!fillGraphic->isAvailable())
+                graphics.push_back( const_cast<Graphic*>(fillGraphic));
     }
 }
 
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 499585c7f5f5..1650ffa71fab 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -30,6 +30,7 @@
 #include <svx/sdtaiitm.hxx>
 #include <svx/sdtaaitm.hxx>
 #include <svx/xfillit0.hxx>
+#include <svx/xbtmpit.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <sdr/primitive2d/sdrtextprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
@@ -860,6 +861,17 @@ void SdrTextObj::impDecomposeAutoFitTextPrimitive(
 // Resolves: fdo#35779 set background color of this shape as the editeng background if there
 // is one. Check the shape itself, then the host page, then that page's master page.
 void SdrObject::setSuitableOutlinerBg(::Outliner& rOutliner) const
+{
+    const SfxItemSet* pBackgroundFillSet = getBackgroundFillSet();
+    if (drawing::FillStyle_NONE != pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue())
+    {
+        Color aColor(rOutliner.GetBackgroundColor());
+        GetDraftFillColor(*pBackgroundFillSet, aColor);
+        rOutliner.SetBackgroundColor(aColor);
+    }
+}
+
+const SfxItemSet* SdrObject::getBackgroundFillSet() const
 {
     const SfxItemSet* pBackgroundFillSet = &GetObjectItemSet();
 
@@ -879,13 +891,17 @@ void SdrObject::setSuitableOutlinerBg(::Outliner& rOutliner) const
             }
         }
     }
+    return pBackgroundFillSet;
+}
 
-    if (drawing::FillStyle_NONE != pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue())
-    {
-        Color aColor(rOutliner.GetBackgroundColor());
-        GetDraftFillColor(*pBackgroundFillSet, aColor);
-        rOutliner.SetBackgroundColor(aColor);
-    }
+const Graphic* SdrObject::getFillGraphic() const
+{
+    if(IsGroupObject()) // Doesn't make sense, and GetObjectItemSet() asserts.
+        return nullptr;
+    const SfxItemSet* pBackgroundFillSet = getBackgroundFillSet();
+    if (drawing::FillStyle_BITMAP != pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue())
+        return nullptr;
+    return &pBackgroundFillSet->Get(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic();
 }
 
 void SdrTextObj::impDecomposeBlockTextPrimitive(


More information about the Libreoffice-commits mailing list