svx/source/tbxctrls/tbxcolorupdate.cxx |   25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

New commits:
commit e8d5b291f6c334c01bdd40301118f86b04708512
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Jul 28 12:13:55 2020 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Mon Aug 3 06:37:02 2020 +0200

    tdf#135121 don't paint the image over the rect that will contain the color
    
    so that for the transparent color case we remain showing the original
    background and not that part of the icon
    
    Change-Id: I20452c7eccf141fdbede9ed2476270315963022e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99549
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx 
b/svx/source/tbxctrls/tbxcolorupdate.cxx
index f84cda150837..e1920affc11e 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -171,8 +171,25 @@ namespace svx
         pVirDev->SetOutputSizePixel(aItemSize);
         maBmpSize = aItemSize;
 
+        if (maBmpSize.Width() == maBmpSize.Height())
+            // tdf#84985 align color bar with icon bottom edge; integer 
arithmetic e.g. 26 - 26/4 <> 26 * 3/4
+            maUpdRect = tools::Rectangle(Point( 0, maBmpSize.Height() - 
maBmpSize.Height() / 4), Size(maBmpSize.Width(), maBmpSize.Height() / 4));
+        else
+            maUpdRect = tools::Rectangle(Point( maBmpSize.Height() + 2, 2), 
Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3));
+
+        pVirDev->Push(PushFlags::CLIPREGION);
+
+        // tdf#135121 don't include the part of the image which we will
+        // overwrite with the target color so that for the transparent color
+        // case the original background of the device is shown
+        vcl::Region aRegion(tools::Rectangle(Point(0, 0), maBmpSize));
+        aRegion.Exclude(maUpdRect);
+        pVirDev->SetClipRegion(aRegion);
+
         pVirDev->DrawImage(Point(0, 0), aImage);
 
+        pVirDev->Pop();
+
         const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
         mbWasHiContrastMode = rStyleSettings.GetHighContrastMode();
 
@@ -188,19 +205,13 @@ namespace svx
 
         if (bIsTransparent)
         {
-            pVirDev->SetFillColor(Color(255, 0, 0, 0));
+            pVirDev->SetFillColor();
         }
         else
         {
             pVirDev->SetFillColor(maCurColor);
         }
 
-        if (maBmpSize.Width() == maBmpSize.Height())
-            // tdf#84985 align color bar with icon bottom edge; integer 
arithmetic e.g. 26 - 26/4 <> 26 * 3/4
-            maUpdRect = tools::Rectangle(Point( 0, maBmpSize.Height() - 
maBmpSize.Height() / 4), Size(maBmpSize.Width(), maBmpSize.Height() / 4));
-        else
-            maUpdRect = tools::Rectangle(Point( maBmpSize.Height() + 2, 2), 
Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3));
-
         pVirDev->DrawRect(maUpdRect);
 
         SetImage(pVirDev.get());
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to