diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-28 12:13:55 +0100 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2020-08-03 06:37:02 +0200 |
commit | e8d5b291f6c334c01bdd40301118f86b04708512 (patch) | |
tree | 5077daca31169872620b2597f710bf9cb07d3137 /svx | |
parent | c9221f29f323d0de74f492895b00b4cb86476d6d (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/+/99549
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbxcolorupdate.cxx | 25 |
1 files changed, 18 insertions, 7 deletions
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()); |