From cfc76db4318cd91ce69350d5214f80b2d6d5b1db Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 28 Jul 2020 12:13:55 +0100 Subject: tdf#135121 don't paint the image over the rect that will contain the color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/+/99589 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- svx/source/tbxctrls/tbxcolorupdate.cxx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index f716a4e1f7c9..7c2b3bd656a7 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(); @@ -195,12 +212,6 @@ namespace svx 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()); -- cgit