summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/gdimtf.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-09-21 21:34:01 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-09-22 00:31:49 +0200
commit2113c50b455ae67874eb61ff0dcd75c766b17002 (patch)
tree74d304ba65cc346422d182c5ebce66b2dec9b7c7 /vcl/source/gdi/gdimtf.cxx
parent3a7e54f5d2020ea1f6f2b27a51f5ca065844837f (diff)
fdo#62104 Optimize thumbnail size by using PNG8 and other tricks
Change-Id: I54ece4a1977fe93c0e7bbb11774bd8657912c6bb
Diffstat (limited to 'vcl/source/gdi/gdimtf.cxx')
-rw-r--r--vcl/source/gdi/gdimtf.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 3bd6eb2ccb36..3b0d9d007fcb 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2879,7 +2879,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm )
return rOStm;
}
-bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent) const
+bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, sal_uInt32 nMaximumExtent, BmpConversion eColorConversion, long nScaleFlag) const
{
// initialization seems to be complicated but is used to avoid rounding errors
VirtualDevice aVDev;
@@ -2889,8 +2889,8 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent) c
Size aDrawSize( aVDev.LogicToPixel( GetPrefSize(), GetPrefMapMode() ) );
Size aSizePix( labs( aBRPix.X() - aTLPix.X() ) + 1, labs( aBRPix.Y() - aTLPix.Y() ) + 1 );
- if ( !rBmpEx.IsEmpty() )
- rBmpEx.SetEmpty();
+ if (!rBitmapEx.IsEmpty())
+ rBitmapEx.SetEmpty();
// determine size that has the same aspect ratio as image size and
// fits into the rectangle determined by nMaximumExtent
@@ -2932,19 +2932,18 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent) c
const_cast<GDIMetaFile *>(this)->Play(&aVDev, aBackPosPix, aAntialias);
// get paint bitmap
- Bitmap aBmp( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
+ Bitmap aBitmap( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
- // assure that we have a true color image
- if ( aBmp.GetBitCount() != 24 )
- aBmp.Convert( BMP_CONVERSION_24BIT );
+ // scale down the image to the desired size - use the input scaler for the scaling operation
+ aBitmap.Scale(aDrawSize, nScaleFlag);
- // downsize, to get the antialiased picture
- aBmp.Scale(aDrawSize, BMP_SCALE_BESTQUALITY);
+ // convert to desired bitmap color format
+ aBitmap.Convert(eColorConversion);
- rBmpEx = BitmapEx(aBmp);
+ rBitmapEx = BitmapEx(aBitmap);
}
- return !rBmpEx.IsEmpty();
+ return !rBitmapEx.IsEmpty();
}
void GDIMetaFile::UseCanvas( bool _bUseCanvas )