sfx2/source/doc/graphhelp.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
New commits: commit 4583a3e9b0392f91516603ac8a09f52494e1004f Author: Jan Holesovsky <ke...@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 7598e4f..22ac9ae 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 ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits