[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - vcl/inc vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 21 05:14:12 UTC 2020
Rebased ref, commits from common ancestor:
commit f0b37eb1c35571ad27135a74696f51c124035bad
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Dec 21 13:04:18 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Dec 21 14:12:02 2020 +0900
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
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 fec7c9654f4c..237ffa07ecfb 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