diff options
author | Patrick Luby <guibmacdev@gmail.com> | 2024-04-28 14:35:42 -0400 |
---|---|---|
committer | Patrick Luby <guibomacdev@gmail.com> | 2024-04-29 14:13:13 +0200 |
commit | 24bf5dd70e721fd68df0e2bd06adb85ebaf4ea24 (patch) | |
tree | 875d449d5fac7f0eb4a27828932fa727d0132077 | |
parent | f7579474089bfc67f7d83680d562efa17783e4b4 (diff) |
tdf#160831 only set outside color to black for alpha masks
The outside color still needs to be white for the content
so only apply the fix for tdf#157795 to the alpha mask.
Change-Id: I7486b2c9062ca96bf127f2bce6b1bd5e65d00ff6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166806
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
Tested-by: Jenkins
(cherry picked from commit 5425103fb5a09c7e5e56d077260523438c593e21)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166728
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Patrick Luby <guibomacdev@gmail.com>
-rw-r--r-- | vcl/source/bitmap/BitmapEx.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index 40feacbf66dd..07e25f177180 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -657,7 +657,7 @@ namespace const Bitmap& rSource, const Size& rDestinationSize, const basegfx::B2DHomMatrix& rTransform, - bool bSmooth) + bool bSmooth, bool bAlphaMask) { Bitmap aDestination(rDestinationSize, vcl::PixelFormat::N24_BPP); BitmapScopedWriteAccess xWrite(aDestination); @@ -673,7 +673,10 @@ namespace // tdf#157795 set color to black outside of bitmap bounds // Due to commit 81994cb2b8b32453a92bcb011830fcb884f22ff3, // transparent areas are now black instead of white. - const BitmapColor aOutside(0x0, 0x0, 0x0); + // tdf#160831 only set outside color to black for alpha masks + // The outside color still needs to be white for the content + // so only apply the fix for tdf#157795 to the alpha mask. + const BitmapColor aOutside = bAlphaMask ? BitmapColor(0x0, 0x0, 0x0) : BitmapColor(0xff, 0xff, 0xff); for(tools::Long y(0); y < aDestinationSizePixel.getHeight(); y++) { @@ -759,12 +762,12 @@ BitmapEx BitmapEx::TransformBitmapEx( // force destination to 24 bit, we want to smooth output const Size aDestinationSize(basegfx::fround(fWidth), basegfx::fround(fHeight)); bool bSmooth = implTransformNeedsSmooth(rTransformation); - const Bitmap aDestination(impTransformBitmap(GetBitmap(), aDestinationSize, rTransformation, bSmooth)); + const Bitmap aDestination(impTransformBitmap(GetBitmap(), aDestinationSize, rTransformation, bSmooth, false)); // create mask if(IsAlpha()) { - const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), aDestinationSize, rTransformation, bSmooth)); + const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), aDestinationSize, rTransformation, bSmooth, true)); return BitmapEx(aDestination, AlphaMask(aAlpha)); } |