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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sun Dec 27 15:27:30 UTC 2020


 vcl/inc/impgraph.hxx        |    5 +++++
 vcl/source/gdi/impgraph.cxx |   42 ++++++++++++++++--------------------------
 2 files changed, 21 insertions(+), 26 deletions(-)

New commits:
commit 85a61dadd49284ae3255f93e25376d35dab962b4
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Dec 21 13:04:18 2020 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun Dec 27 16:26:48 2020 +0100

    ImplGraphic: set PrefSize, PrefMapMode without forcing a swap-in
    
    This adds methods to set the PrefSize, PrefMapMode directly with
    no forced swap-in. Use this setters during a swap-in as it is now
    safe to do so, otherwise it would cause an endless-loop.
    
    Change-Id: I52b424ffc920c5a760891672c1ef961c1b1c1b64
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108253
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 6a312a76d58e..86fa80606b8f 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -213,6 +213,11 @@ private:
 
     sal_Int32 getPageNumber() const;
 
+    // Set the pref size, but don't force swap-in
+    void setValuesForPrefSize(const Size& rPrefSize);
+    // Set the pref map mode, but don't force swap-in
+    void setValuesForPrefMapMod(const MapMode& rPrefMapMode);
+
 public:
     void resetChecksum() { mnChecksum = 0; }
     bool swapIn();
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 70e4fafd09f0..e55c148a5df0 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -801,10 +801,8 @@ Size ImpGraphic::ImplGetPrefSize() const
     return aSize;
 }
 
-void ImpGraphic::ImplSetPrefSize(const Size& rPrefSize)
+void ImpGraphic::setValuesForPrefSize(const Size& rPrefSize)
 {
-    ensureAvailable();
-
     switch (meType)
     {
         case GraphicType::Bitmap:
@@ -843,6 +841,12 @@ void ImpGraphic::ImplSetPrefSize(const Size& rPrefSize)
     }
 }
 
+void ImpGraphic::ImplSetPrefSize(const Size& rPrefSize)
+{
+    ensureAvailable();
+    setValuesForPrefSize(rPrefSize);
+}
+
 MapMode ImpGraphic::ImplGetPrefMapMode() const
 {
     MapMode aMapMode;
@@ -887,10 +891,8 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
     return aMapMode;
 }
 
-void ImpGraphic::ImplSetPrefMapMode(const MapMode& rPrefMapMode)
+void ImpGraphic::setValuesForPrefMapMod(const MapMode& rPrefMapMode)
 {
-    ensureAvailable();
-
     switch (meType)
     {
         case GraphicType::Bitmap:
@@ -926,6 +928,12 @@ void ImpGraphic::ImplSetPrefMapMode(const MapMode& rPrefMapMode)
     }
 }
 
+void ImpGraphic::ImplSetPrefMapMode(const MapMode& rPrefMapMode)
+{
+    ensureAvailable();
+    setValuesForPrefMapMod(rPrefMapMode);
+}
+
 sal_uLong ImpGraphic::ImplGetSizeBytes() const
 {
     if (mnSizeBytes > 0)
@@ -1368,29 +1376,11 @@ void ImpGraphic::updateFromLoadedGraphic(ImpGraphic* graphic)
 
 void ImpGraphic::restoreFromSwapInfo()
 {
-    // Reset the parameters
-    if (!maBitmapEx.IsEmpty())
-    {
-        maBitmapEx.SetPrefMapMode(maSwapInfo.maPrefMapMode);
-        maBitmapEx.SetPrefSize(maSwapInfo.maPrefSize);
-    }
-
-    if (meType == GraphicType::GdiMetafile)
-    {
-         maMetaFile.SetPrefMapMode(maSwapInfo.maPrefMapMode);
-         maMetaFile.SetPrefSize(maSwapInfo.maPrefSize);
-    }
-
-    if (ImplIsAnimated())
-    {
-        auto & rAnimationBitmap = const_cast<BitmapEx&>(mpAnimation->GetBitmapEx());
-        rAnimationBitmap.SetPrefMapMode(maSwapInfo.maPrefMapMode);
-        rAnimationBitmap.SetPrefSize(maSwapInfo.maPrefSize);
-    }
+    setValuesForPrefMapMod(maSwapInfo.maPrefMapMode);
+    setValuesForPrefSize(maSwapInfo.maPrefSize);
 
     if (maVectorGraphicData)
     {
-        maExPrefSize = maSwapInfo.maPrefSize;
         maVectorGraphicData->setPageIndex(maSwapInfo.mnPageIndex);
     }
 }


More information about the Libreoffice-commits mailing list