[Libreoffice-commits] core.git: Branch 'distro/vector/vector-5.4' - vcl/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 9 16:39:41 UTC 2020
vcl/source/gdi/impgraph.cxx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
New commits:
commit 6ca971ca3a4b767fdc75cd2dde022a878dd583a1
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Dec 9 17:32:06 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Dec 9 17:32:14 2020 +0100
vcl: fix logic size of metafile from Graphic
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
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());
}
More information about the Libreoffice-commits
mailing list