diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-28 12:13:55 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-28 20:29:09 +0200 |
commit | cfc76db4318cd91ce69350d5214f80b2d6d5b1db (patch) | |
tree | 29620b07c5d7020cce5679a900253b7d31acdc71 /svx/source/tbxctrls | |
parent | 04e5cc16c48b5eaf69cd275825b957a504904187 (diff) |
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/+/99589
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r-- | svx/source/tbxctrls/tbxcolorupdate.cxx | 23 |
1 files changed, 17 insertions, 6 deletions
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()); |