vcl/source/outdev/transparent.cxx | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-)
New commits: commit 4b1e208f3d94e4e1cf7c7eb951ceb4d023d5b7ce Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Aug 17 00:48:18 2020 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Aug 17 07:57:24 2020 +0200 Use transparent buffer to correctly process transparency in metafiles Otherwise the transparency gets converted into b&w mask here before applying the gradient. Required for tdf#134052. Change-Id: Ife00f75024f7d776fdb11e16fcafbd237f07eb04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100830 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index 717e9584162a..f9da8c9975da 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -750,7 +750,8 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, if( !aDstRect.IsEmpty() ) { - ScopedVclPtrInstance< VirtualDevice > xVDev; + // Create transparent buffer + ScopedVclPtrInstance<VirtualDevice> xVDev(DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); xVDev->mnDPIX = mnDPIX; xVDev->mnDPIY = mnDPIY; @@ -813,8 +814,6 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, } else { - Bitmap aPaint, aMask; - AlphaMask aAlpha; MapMode aMap( GetMapMode() ); Point aOutPos( PixelToLogic( aDstRect.TopLeft() ) ); const bool bOldMap = mbMap; @@ -828,20 +827,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const_cast<GDIMetaFile&>(rMtf).Play( xVDev.get(), rPos, rSize ); const_cast<GDIMetaFile&>(rMtf).WindStart(); xVDev->EnableMapMode( false ); - aPaint = xVDev->GetBitmap( Point(), xVDev->GetOutputSizePixel() ); - xVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( sal_True ) here! - - // create mask bitmap - xVDev->SetLineColor( COL_BLACK ); - xVDev->SetFillColor( COL_BLACK ); - xVDev->DrawRect( tools::Rectangle( xVDev->PixelToLogic( Point() ), xVDev->GetOutputSize() ) ); - xVDev->SetDrawMode( DrawModeFlags::WhiteLine | DrawModeFlags::WhiteFill | DrawModeFlags::WhiteText | - DrawModeFlags::WhiteBitmap | DrawModeFlags::WhiteGradient ); - const_cast<GDIMetaFile&>(rMtf).WindStart(); - const_cast<GDIMetaFile&>(rMtf).Play( xVDev.get(), rPos, rSize ); - const_cast<GDIMetaFile&>(rMtf).WindStart(); - xVDev->EnableMapMode( false ); - aMask = xVDev->GetBitmap( Point(), xVDev->GetOutputSizePixel() ); + BitmapEx aPaint = xVDev->GetBitmapEx(Point(), xVDev->GetOutputSizePixel()); xVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( sal_True ) here! // create alpha mask from gradient @@ -849,14 +835,14 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, xVDev->DrawGradient( tools::Rectangle( rPos, rSize ), rTransparenceGradient ); xVDev->SetDrawMode( DrawModeFlags::Default ); xVDev->EnableMapMode( false ); - xVDev->DrawMask( Point(), xVDev->GetOutputSizePixel(), aMask, COL_WHITE ); - aAlpha = xVDev->GetBitmap( Point(), xVDev->GetOutputSizePixel() ); + AlphaMask aAlpha(xVDev->GetBitmap(Point(), xVDev->GetOutputSizePixel())); + aAlpha.BlendWith(aPaint.GetAlpha()); xVDev.disposeAndClear(); EnableMapMode( false ); - DrawBitmapEx( aDstRect.TopLeft(), BitmapEx( aPaint, aAlpha ) ); + DrawBitmapEx(aDstRect.TopLeft(), BitmapEx(aPaint.GetBitmap(), aAlpha)); EnableMapMode( bOldMap ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits