summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-06-11 08:38:23 +0000
committerArmin Le Grand <alg@apache.org>2012-06-11 08:38:23 +0000
commit891011181285d7ad54984ffd05ed44d825a70647 (patch)
tree59d8f32aad50d98f691cf4f7904dcb8d81935fbd /vcl
parent689ad6ef945906fef934331834afd1cb715e377b (diff)
#119735# Adapted patch provided by Sven Jacobi (thanks), added some ixes/cleanups to make it work with all kind of graphics (SVG, Bitmap, Metafile)
Notes
Notes: merged as: 4fa8df7320f6bdc8333f5936537d2ed93e8892ce
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/impgraph.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 8caf30ad9ef4..9db1168156ee 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -677,6 +677,40 @@ Animation ImpGraphic::ImplGetAnimation() const
const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
{
+ if(GRAPHIC_BITMAP == meType && !maMetaFile.GetActionCount())
+ {
+ // #119735#
+ // Use the local maMetaFile as container for a metafile-representation
+ // of the bitmap graphic. This will be done only once, thus be buffered.
+ // I checked all usages of maMetaFile, it is only used when type is not
+ // GRAPHIC_BITMAP. In operator= it will get copied, thus buffering will
+ // survive copying (change this if not wanted)
+ ImpGraphic* pThat = const_cast< ImpGraphic* >(this);
+
+ if(maSvgData.get() && !maEx)
+ {
+ // use maEx as local buffer for rendered svg
+ pThat->maEx = maSvgData->getReplacement();
+ }
+
+ VirtualDevice aVirDev;
+ const Size aSizePixel(maEx.GetSizePixel());
+
+ pThat->maMetaFile.Record(&aVirDev);
+
+ if(maEx.IsTransparent())
+ {
+ aVirDev.DrawBitmapEx(Point(), maEx);
+ }
+ else
+ {
+ aVirDev.DrawBitmap(Point(), maEx.GetBitmap());
+ }
+
+ pThat->maMetaFile.Stop();
+ pThat->maMetaFile.SetPrefSize(aSizePixel);
+ }
+
return maMetaFile;
}