vcl/source/outdev/bitmap.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit e61590d3445172da25bdec04ce6b7158af565eb6
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Aug 24 00:13:19 2020 +0300
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Aug 24 10:07:08 2020 +0200

    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.kagan...@collabora.com>
    (cherry picked from commit 9ff0cd1f6b2200940ac51e580809e2a17c4b9550)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101158
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 83c1843a5300..dcb9a6b1d8d0 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;
 };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to