vcl/skia/salbmp.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 9b5a00d2281bebaac5fccfde17de6ca5134fc229
Author:     Noel Grandin <noelgran...@collabora.co.uk>
AuthorDate: Fri Oct 27 10:29:20 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Oct 27 21:16:30 2023 +0200

    fix erase logic in SkiaSalBmp::BlendWith
    
    regression from
        commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
        Author: Noel Grandin <noelgran...@gmail.com>
        Date:   Fri Apr 16 20:33:10 2021 +0200
        Convert internal vcl bitmap formats transparency->alpha (II)
    
    Change-Id: I5cefa51c96d412f43f73277b590fd861397eb1a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158526
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 0876efed92ed..44997798db8b 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -628,7 +628,11 @@ bool SkiaSalBitmap::AlphaBlendWith(const SalBitmap& 
rSalBmp)
     {
         const sal_uInt16 nGrey1 = mEraseColor.GetRed();
         const sal_uInt16 nGrey2 = otherBitmap->mEraseColor.GetRed();
-        const sal_uInt8 nGrey = static_cast<sal_uInt8>(nGrey1 + nGrey2 - 
nGrey1 * nGrey2 / 255);
+        // Awkward calculation because the original used transparency, and to 
replicate
+        // the logic we need to translate into transparency, perform the 
original logic,
+        // then translate back to alpha.
+        const sal_uInt8 nGrey = static_cast<sal_uInt8>(
+            255 - ((255 - nGrey1) + (255 - nGrey2) - (255 - nGrey1) * (255 - 
nGrey2) / 255));
         mEraseColor = Color(nGrey, nGrey, nGrey);
         DataChanged();
         SAL_INFO("vcl.skia.trace",

Reply via email to