diff options
author | Jan Holesovsky <kendy@collabora.com> | 2013-12-13 19:47:26 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2013-12-13 19:47:26 +0100 |
commit | b8bb9f219777d33d14103c5bd67c283bd4dafd51 (patch) | |
tree | d4fd4c15f6458e4f48e7bb1ab40af20ccfe3fa5e /sfx2 | |
parent | b790562925f59b3ae74ac8be69c80d935e7ab2c6 (diff) |
thumbnails: Create nice antialiased thumbnails when saving ODF.
Change-Id: I3dc3289b4ac3423b3a5006dbb7ee895bc25ec50a
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/graphhelp.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 139429776a19..8e3e8a692bb1 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 ); } |