summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-12-09 17:32:06 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-09 17:32:14 +0100
commit6ca971ca3a4b767fdc75cd2dde022a878dd583a1 (patch)
tree6288776113f902ae5c4acc1b53fb3296531ebb49
parentemfio: allow disabling EMF+ via a bootstrap variable (diff)
downloadcore-distro/vector/vector-5.4.tar.gz
core-distro/vector/vector-5.4.zip
vcl: fix logic size of metafile from Graphic distro/vector/vector-5.4
vector-7.0 has bitmap import filters which set both the preferred size and the preferred pixel size on a BitmapEx. This means that when ImpGraphic::ImplGetGDIMetaFile() gets the bitmap size, it can use maEx.GetPrefSize() directly. Interestingly, the "fall back to pixel size from logic size" logic is still there at other places, e.g. at ImpGraphic::ImplGetPrefSize(). However, on this branch, the bitmap import filters (e.g. PNG import) only sets the preferred pixel size and set the map mode to pixel. This means that directly getting the preferred size results in a zero size, so exporting such a bitmap to WMF/EMF will result in a white rectangle. Fix the problem by using ImplGetPrefSize() (which has the fallback logic) instead of maEx.GetPrefSize() directly -- both for the metafile action and for the preferred size of the metafile. Change-Id: I94090b2e125c0262d4d6d408c8e4d894a0de8872
-rw-r--r--vcl/source/gdi/impgraph.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index b31dbf4828ba..aa7b52cf4c57 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -607,20 +607,23 @@ const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
pThat->maEx = maSvgData->getReplacement();
}
+ // Using maEx.GetPrefSize() directly would not fall back from logic size to pixel size.
+ Size aPrefSize = ImplGetPrefSize();
+
// #123983# directly create a metafile with the same PrefSize and PrefMapMode
// the bitmap has, this will be an always correct metafile
if(maEx.IsTransparent())
{
- pThat->maMetaFile.AddAction(new MetaBmpExScaleAction(Point(), maEx.GetPrefSize(), maEx));
+ pThat->maMetaFile.AddAction(new MetaBmpExScaleAction(Point(), aPrefSize, maEx));
}
else
{
- pThat->maMetaFile.AddAction(new MetaBmpScaleAction(Point(), maEx.GetPrefSize(), maEx.GetBitmap()));
+ pThat->maMetaFile.AddAction(new MetaBmpScaleAction(Point(), aPrefSize, maEx.GetBitmap()));
}
pThat->maMetaFile.Stop();
pThat->maMetaFile.WindStart();
- pThat->maMetaFile.SetPrefSize(maEx.GetPrefSize());
+ pThat->maMetaFile.SetPrefSize(aPrefSize);
pThat->maMetaFile.SetPrefMapMode(maEx.GetPrefMapMode());
}