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@collabora.com>
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index de4ebc3..cb98d67 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 089712a..142b40a 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 499585c..1650ffa 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>
@@ -861,6 +862,17 @@ void SdrTextObj::impDecomposeAutoFitTextPrimitive(
// 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();
if (drawing::FillStyle_NONE == pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue())
@@ -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(