Kaydet (Commit) 4ce1300f authored tarafından Jan Holesovsky's avatar Jan Holesovsky

thumbnails: Nobody uses the overlay functionality now, kill it.

Change-Id: I74c463b67dd950a3e4de838ed0dc55ec366ab8a7
üst cd5bc497
...@@ -213,8 +213,8 @@ public: ...@@ -213,8 +213,8 @@ public:
friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ); friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile );
friend VCL_DLLPUBLIC SvStream& WriteGDIMetaFile( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile ); friend VCL_DLLPUBLIC SvStream& WriteGDIMetaFile( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile );
/// Creates an antialiased thumbnail, with maximum height or width of nMaximumExtent. /// Creates an antialiased thumbnail, with maximum width or height of nMaximumExtent.
sal_Bool CreateThumbnail( BitmapEx& rBmpEx, sal_uInt32 nMaximumSize = 256, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const; sal_Bool CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumSize = 256) const;
void UseCanvas( sal_Bool _bUseCanvas ); void UseCanvas( sal_Bool _bUseCanvas );
sal_Bool GetUseCanvas() const { return bUseCanvas; } sal_Bool GetUseCanvas() const { return bUseCanvas; }
......
...@@ -2869,8 +2869,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm ) ...@@ -2869,8 +2869,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm )
return rOStm; return rOStm;
} }
sal_Bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent, sal_Bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent) const
const BitmapEx* pOverlay, const Rectangle* pOverlayRect) const
{ {
// initialization seems to be complicated but is used to avoid rounding errors // initialization seems to be complicated but is used to avoid rounding errors
VirtualDevice aVDev; VirtualDevice aVDev;
...@@ -2909,45 +2908,19 @@ sal_Bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExten ...@@ -2909,45 +2908,19 @@ sal_Bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExten
aDrawSize.Height() = FRound( ( static_cast< double >( aDrawSize.Height() ) * aSizePix.Height() ) / aOldSizePix.Height() ); aDrawSize.Height() = FRound( ( static_cast< double >( aDrawSize.Height() ) * aSizePix.Height() ) / aOldSizePix.Height() );
} }
Size aFullSize;
Point aBackPosPix;
Rectangle aOverlayRect;
// calculate additional positions and sizes if an overlay image is used
if (pOverlay)
{
aFullSize = Size( nMaximumExtent, nMaximumExtent );
aOverlayRect = Rectangle( aNullPt, aFullSize );
aOverlayRect.Intersection( pOverlayRect ? *pOverlayRect : Rectangle( aNullPt, pOverlay->GetSizePixel() ) );
if ( !aOverlayRect.IsEmpty() )
aBackPosPix = Point( ( nMaximumExtent - aSizePix.Width() ) >> 1, ( nMaximumExtent - aSizePix.Height() ) >> 1 );
else
pOverlay = NULL;
}
else
{
aFullSize = aSizePix;
pOverlay = NULL;
}
// draw image(s) into VDev and get resulting image // draw image(s) into VDev and get resulting image
// do it 4x larger to be able to scale it down & get beautiful antialias // do it 4x larger to be able to scale it down & get beautiful antialias
Size aAntialiasSize(aFullSize.Width() * 4, aFullSize.Height() * 4); Size aAntialiasSize(aSizePix.Width() * 4, aSizePix.Height() * 4);
if (aVDev.SetOutputSizePixel(aAntialiasSize)) if (aVDev.SetOutputSizePixel(aAntialiasSize))
{ {
// antialias: provide 4x larger size, and then scale down the result // antialias: provide 4x larger size, and then scale down the result
Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4); Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4);
// draw metafile into VDev // draw metafile into VDev
Point aBackPosPix;
const_cast<GDIMetaFile *>(this)->WindStart(); const_cast<GDIMetaFile *>(this)->WindStart();
const_cast<GDIMetaFile *>(this)->Play(&aVDev, aBackPosPix, aAntialias); const_cast<GDIMetaFile *>(this)->Play(&aVDev, aBackPosPix, aAntialias);
// draw overlay if necessary
if ( pOverlay )
aVDev.DrawBitmapEx( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), *pOverlay );
// get paint bitmap // get paint bitmap
Bitmap aBmp( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) ); Bitmap aBmp( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment