summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2013-12-13 19:47:26 +0100
committerJan Holesovsky <kendy@collabora.com>2013-12-13 19:49:21 +0100
commit4583a3e9b0392f91516603ac8a09f52494e1004f (patch)
tree47302ae2ad01c0e08476cc679d783e535694c1b8 /sfx2
parentece20685104a3c0900677c1baa4ec975af7e4bf7 (diff)
thumbnails: Create nice antialiased thumbnails when saving ODF.
Change-Id: I3dc3289b4ac3423b3a5006dbb7ee895bc25ec50a
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/graphhelp.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 7598e4f2dade..22ac9ae2c232 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 );
}