summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-01-02 00:03:33 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-01-22 07:48:53 +0100
commit4cde10d255ce9741ca8ea115078b104dc4d67057 (patch)
tree6d31bc31df50a431a89477d4fda626ebdcc4a6cd /vcl/source/gdi
parent9ae99dd8bcb682ca86e51ea89744f3a1c1de1d03 (diff)
vcl: optimize copying size in px to ImpSwapInfo when swapping out
Calling getSizePixel can force to create a bitmap for vector graphic, only for the purpuse to get the size of the graphic in pixels. We use this when swapping out, which is not ideal as we would force create a replacement bitmap just before we would get rid of it. This optimization will just copy the size in pixels to the ImpSwapInfo structure if a bitmap exists and otherwise leave it empty. Change-Id: I9ccb1af4ddc63e77e2a6ca536cb4f762d0b5f182 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109599 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/impgraph.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 6fe065896d3f..5e53a900a60f 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -334,7 +334,11 @@ void ImpGraphic::createSwapInfo()
if (isSwappedOut())
return;
- maSwapInfo.maSizePixel = getSizePixel();
+ if (!maBitmapEx.IsEmpty())
+ maSwapInfo.maSizePixel = maBitmapEx.GetSizePixel();
+ else
+ maSwapInfo.maSizePixel = Size();
+
maSwapInfo.maPrefMapMode = getPrefMapMode();
maSwapInfo.maPrefSize = getPrefSize();
maSwapInfo.mbIsAnimated = isAnimated();