diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-08-24 00:13:19 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-08-24 04:33:34 +0200 |
commit | 9ff0cd1f6b2200940ac51e580809e2a17c4b9550 (patch) | |
tree | 10d11a54af77cac201579d5847fd8f785a1dbb69 /vcl/source | |
parent | a06a83b29a9da770787bffe416b138102aa12531 (diff) |
tdf#136047: fix OutputDevice::DrawTransformBitmapExDirect for ...
transparent bitmap case
This has been broken in commit 9c621ee8ea41a1c53bfeca49827290826785973e,
where transparent bitmap started to override any transparency of vdev
with transparency of its pixels, and not use alpha when drawing RGB when
mpAlphaVDev was present.
Instead, this restores using alpha in RGB output, and blends alpha to
what is already in mpAlphaVDev.
Change-Id: Id82717def4535336450a7118f8bd29a1660c9520
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101254
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/outdev/bitmap.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 58a096a79045..88898d93179d 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -1050,7 +1050,6 @@ bool OutputDevice::DrawTransformBitmapExDirect( const basegfx::B2DPoint aTopX(aFullTransform * basegfx::B2DPoint(1.0, 0.0)); const basegfx::B2DPoint aTopY(aFullTransform * basegfx::B2DPoint(0.0, 1.0)); SalBitmap* pSalSrcBmp = rBitmapEx.GetBitmap().ImplGetSalBitmap().get(); - SalBitmap* pSalAlphaBmp = nullptr; Bitmap aAlphaBitmap; if(rBitmapEx.IsTransparent()) @@ -1063,8 +1062,6 @@ bool OutputDevice::DrawTransformBitmapExDirect( { aAlphaBitmap = rBitmapEx.GetMask(); } - if (!mpAlphaVDev) - pSalAlphaBmp = aAlphaBitmap.ImplGetSalBitmap().get(); } else if (mpAlphaVDev) { @@ -1072,6 +1069,8 @@ bool OutputDevice::DrawTransformBitmapExDirect( aAlphaBitmap.Erase(COL_BLACK); } + SalBitmap* pSalAlphaBmp = aAlphaBitmap.ImplGetSalBitmap().get(); + bDone = mpGraphics->DrawTransformedBitmap( aNull, aTopX, @@ -1081,7 +1080,12 @@ bool OutputDevice::DrawTransformBitmapExDirect( this); if (mpAlphaVDev) - mpAlphaVDev->DrawTransformBitmapExDirect(aFullTransform, BitmapEx(aAlphaBitmap)); + { + // Merge bitmap alpha to alpha device + Bitmap aBlack(rBitmapEx.GetSizePixel(), 1); + aBlack.Erase(COL_BLACK); + mpAlphaVDev->DrawTransformBitmapExDirect(aFullTransform, BitmapEx(aBlack, aAlphaBitmap)); + } return bDone; }; |