[Libreoffice-commits] core.git: vcl/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 24 02:34:20 UTC 2020


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

New commits:
commit 9ff0cd1f6b2200940ac51e580809e2a17c4b9550
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Aug 24 00:13:19 2020 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Aug 24 04:33:34 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.kaganski at collabora.com>

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;
 };


More information about the Libreoffice-commits mailing list