[Libreoffice-commits] core.git: sfx2/source
Jan Holesovsky
kendy at collabora.com
Fri Dec 13 10:49:25 PST 2013
sfx2/source/doc/graphhelp.cxx | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
New commits:
commit b8bb9f219777d33d14103c5bd67c283bd4dafd51
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Dec 13 19:47:26 2013 +0100
thumbnails: Create nice antialiased thumbnails when saving ODF.
Change-Id: I3dc3289b4ac3423b3a5006dbb7ee895bc25ec50a
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 1394297..8e3e8a6 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -314,7 +314,7 @@ sal_Bool GraphicHelper::createThumb_Impl( const GDIMetaFile& rMtf,
Point aBackPosPix;
Rectangle aOverlayRect;
- // calculate addigtional positions and sizes if an overlay image is used
+ // calculate additional positions and sizes if an overlay image is used
if ( pOverlay )
{
aFullSize = Size( nMaximumExtent, nMaximumExtent );
@@ -334,11 +334,16 @@ sal_Bool GraphicHelper::createThumb_Impl( const GDIMetaFile& rMtf,
}
// draw image(s) into VDev and get resulting image
- if ( aVDev.SetOutputSizePixel( aFullSize ) )
+ // do it 4x larger to be able to scale it down & get beautiful antialias
+ Size aAntialiasSize(aFullSize.Width() * 4, aFullSize.Height() * 4);
+ if (aVDev.SetOutputSizePixel(aAntialiasSize))
{
+ // antialias: provide 4x larger size, and then scale down the result
+ Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4);
+
// draw metafile into VDev
const_cast< GDIMetaFile& >( rMtf ).WindStart();
- const_cast< GDIMetaFile& >( rMtf ).Play( &aVDev, aBackPosPix, aDrawSize );
+ const_cast< GDIMetaFile& >( rMtf ).Play( &aVDev, aBackPosPix, aAntialias );
// draw overlay if necessary
if ( pOverlay )
@@ -351,6 +356,9 @@ sal_Bool GraphicHelper::createThumb_Impl( const GDIMetaFile& rMtf,
if ( aBmp.GetBitCount() != 24 )
aBmp.Convert( BMP_CONVERSION_24BIT );
+ // downsize, to get the antialiased picture
+ aBmp.Scale(aDrawSize, BMP_SCALE_BESTQUALITY);
+
rBmpEx = BitmapEx( aBmp );
}
More information about the Libreoffice-commits
mailing list