summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-01-05 16:43:04 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-01-07 16:28:30 +0100
commit4d682d5b9343c5d18ee6fc52e20a57644c050603 (patch)
tree22eb3850c8b99d7a07849dd479d29d49faa3e185
parent85d072442f7445d13dfbbacd7985f6e1df38f57e (diff)
handle also !mbPrepared Graphic correctly when parallel loading
GraphicFilter::MakeGraphicsAvailableThreaded() can cause loading of swapped out Graphic objects too (since def31e135e5e2c0adb1502?). So make sure those are processed the same way as they would be when swapped in. Change-Id: Ibc8eb34b2167e2e21ea2c0c5ce9da14b75f3b6f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108814 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--vcl/source/gdi/impgraph.cxx72
1 files changed, 40 insertions, 32 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 02709008d31f..6a76e2f9f81f 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1350,17 +1350,45 @@ bool ImpGraphic::ensureAvailable() const
void ImpGraphic::updateFromLoadedGraphic(ImpGraphic* graphic)
{
- GraphicExternalLink aLink = maGraphicExternalLink;
- Size aPrefSize = maSwapInfo.maPrefSize;
- MapMode aPrefMapMode = maSwapInfo.maPrefMapMode;
- *this = *graphic;
- if (aPrefSize.getWidth() && aPrefSize.getHeight() && aPrefMapMode == ImplGetPrefMapMode())
+ if( mbPrepared )
{
- // Use custom preferred size if it was set when the graphic was still unloaded.
- // Only set the size in case the unloaded and loaded unit matches.
- ImplSetPrefSize(aPrefSize);
+ GraphicExternalLink aLink = maGraphicExternalLink;
+ Size aPrefSize = maSwapInfo.maPrefSize;
+ MapMode aPrefMapMode = maSwapInfo.maPrefMapMode;
+ *this = *graphic;
+ if (aPrefSize.getWidth() && aPrefSize.getHeight() && aPrefMapMode == ImplGetPrefMapMode())
+ {
+ // Use custom preferred size if it was set when the graphic was still unloaded.
+ // Only set the size in case the unloaded and loaded unit matches.
+ ImplSetPrefSize(aPrefSize);
+ }
+ maGraphicExternalLink = aLink;
+ }
+ else
+ {
+ // Move over only graphic content
+ mpAnimation.reset();
+ if (graphic->mpAnimation)
+ {
+ mpAnimation = std::make_unique<Animation>(*graphic->mpAnimation);
+ maBitmapEx = mpAnimation->GetBitmapEx();
+ }
+ else
+ {
+ maBitmapEx = graphic->maBitmapEx;
+ }
+
+ maMetaFile = graphic->maMetaFile;
+ maVectorGraphicData = graphic->maVectorGraphicData;
+
+ // Set to 0, to force recalculation
+ mnSizeBytes = 0;
+ mnChecksum = 0;
+
+ restoreFromSwapInfo();
+
+ mbSwapOut = false;
}
- maGraphicExternalLink = aLink;
}
void ImpGraphic::restoreFromSwapInfo()
@@ -1398,34 +1426,14 @@ bool ImpGraphic::swapIn()
if (!mpGfxLink->LoadNative(aGraphic))
return false;
- auto & rImpGraphic = *aGraphic.ImplGetImpGraphic();
+ ImpGraphic* pImpGraphic = aGraphic.ImplGetImpGraphic();
- if (meType != rImpGraphic.meType)
+ if (meType != pImpGraphic->meType)
return false;
- // Move over only graphic content
- mpAnimation.reset();
- if (rImpGraphic.mpAnimation)
- {
- mpAnimation = std::make_unique<Animation>(*rImpGraphic.mpAnimation);
- maBitmapEx = mpAnimation->GetBitmapEx();
- }
- else
- {
- maBitmapEx = rImpGraphic.maBitmapEx;
- }
-
- maMetaFile = rImpGraphic.maMetaFile;
- maVectorGraphicData = rImpGraphic.maVectorGraphicData;
-
- // Set to 0, to force recalculation
- mnSizeBytes = 0;
- mnChecksum = 0;
-
- restoreFromSwapInfo();
+ updateFromLoadedGraphic(pImpGraphic);
maLastUsed = std::chrono::high_resolution_clock::now();
- mbSwapOut = false;
bReturn = true;
}
else