diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-08 14:48:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-08 18:15:22 +0100 |
commit | 5c9ace48f05269c50d57642256153450335ace5f (patch) | |
tree | 24d1196b93f0043c6eb6259979a34c4254e35a20 | |
parent | 0ea17e24702dabc6287345796417bb08c44244d6 (diff) |
Introduce Color::IsFullyTransparent
Change-Id: I94875b9fb7ee18edf63ed28902da4ae77eb14bb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108973
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | editeng/source/items/frmitems.cxx | 2 | ||||
-rw-r--r-- | include/tools/color.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/output.cxx | 2 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx | 18 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbxcolorupdate.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/print2.cxx | 4 |
7 files changed, 23 insertions, 16 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 6dfacab3ec6f..e3a6f8e5ac0c 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2880,7 +2880,7 @@ bool SvxBrushItem::isUsed() const // graphic used return true; } - else if (0xff != GetColor().GetTransparency()) + else if (!GetColor().IsFullyTransparent()) { // color used return true; diff --git a/include/tools/color.hxx b/include/tools/color.hxx index 27b63b178715..fa062d59eddd 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -149,6 +149,13 @@ public: return GetTransparency() != 0; } + /** Is the color fully transparent i.e. 100% transparency ? + */ + bool IsFullyTransparent() const + { + return A == 255; + } + /** Sets the red value. * @param nRed */ diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 7dc9cd1ded95..3d9ce033ff6a 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -1098,7 +1098,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) pBackground = pProtectedBackground.get(); if ( pInfo->nRotateDir > ScRotateDir::Standard && - pBackground->GetColor().GetTransparency() != 255 && + !pBackground->GetColor().IsFullyTransparent() && !bCellContrast ) { SCROW nY = pRowInfo[nArrY].nRowNo; diff --git a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx index 76af6c23b68e..6e289d4be3f1 100644 --- a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx @@ -126,9 +126,9 @@ namespace if (bSecnUsed) { // both or all three lines used - const bool bPrimTransparent(0xff == rStyle.GetColorPrim().GetTransparency()); - const bool bDistTransparent(!rStyle.UseGapColor() || 0xff == rStyle.GetColorGap().GetTransparency()); - const bool bSecnTransparent(0xff == aSecn.GetTransparency()); + const bool bPrimTransparent(rStyle.GetColorPrim().IsFullyTransparent()); + const bool bDistTransparent(!rStyle.UseGapColor() || rStyle.GetColorGap().IsFullyTransparent()); + const bool bSecnTransparent(aSecn.IsFullyTransparent()); if(!bPrimTransparent || !bDistTransparent || !bSecnTransparent) { @@ -161,7 +161,7 @@ namespace else { // one line used, push two values, from outer to inner - if(0xff != rStyle.GetColorPrim().GetTransparency()) + if(!rStyle.GetColorPrim().IsFullyTransparent()) { maOffsets.push_back( OffsetAndHalfWidthAndColor( @@ -325,7 +325,7 @@ namespace Color aMyColor; double fMyOffset(0.0); double fMyHalfWidth(0.0); rCombination.getColorAndOffsetAndHalfWidth(0, aMyColor, fMyOffset, fMyHalfWidth); - if(0xff != aMyColor.GetTransparency()) + if(!aMyColor.IsFullyTransparent()) { const basegfx::B2DPoint aLeft(rOrigin + (rPerpendX * (fMyOffset - fMyHalfWidth))); const basegfx::B2DPoint aRight(rOrigin + (rPerpendX * (fMyOffset + fMyHalfWidth))); @@ -341,7 +341,7 @@ namespace Color aOtherColor; double fOtherOffset(0.0); double fOtherHalfWidth(0.0); rStyleCandidate.getColorAndOffsetAndHalfWidth(other, aOtherColor, fOtherOffset, fOtherHalfWidth); - if(0xff != aOtherColor.GetTransparency()) + if(!aOtherColor.IsFullyTransparent()) { const basegfx::B2DPoint aOtherLeft(rOrigin + (aOtherPerpend * (fOtherOffset - fOtherHalfWidth))); const basegfx::B2DPoint aOtherRight(rOrigin + (aOtherPerpend * (fOtherOffset + fOtherHalfWidth))); @@ -406,7 +406,7 @@ namespace Color aMyColor; double fMyOffset(0.0); double fMyHalfWidth(0.0); rCombination.getColorAndOffsetAndHalfWidth(my, aMyColor, fMyOffset, fMyHalfWidth); - if(0xff != aMyColor.GetTransparency()) + if(!aMyColor.IsFullyTransparent()) { const basegfx::B2DPoint aLeft(rOrigin + (rPerpendX * (fMyOffset - fMyHalfWidth))); const basegfx::B2DPoint aRight(rOrigin + (rPerpendX * (fMyOffset + fMyHalfWidth))); @@ -421,7 +421,7 @@ namespace Color aOtherColor; double fOtherOffset(0.0); double fOtherHalfWidth(0.0); rStyleCandidate.getColorAndOffsetAndHalfWidth(other, aOtherColor, fOtherOffset, fOtherHalfWidth); - if(0xff != aOtherColor.GetTransparency()) + if(!aOtherColor.IsFullyTransparent()) { const basegfx::B2DPoint aOtherLeft(rOrigin + (aOtherPerpend * (fOtherOffset - fOtherHalfWidth))); const basegfx::B2DPoint aOtherRight(rOrigin + (aOtherPerpend * (fOtherOffset + fOtherHalfWidth))); @@ -578,7 +578,7 @@ namespace const ExtendSet& rExtStart(aExtendSetStart[a]); const ExtendSet& rExtEnd(aExtendSetEnd[a]); - if(0xff == aMyColor.GetTransparency()) + if(aMyColor.IsFullyTransparent()) { aBorderlines.push_back( drawinglayer::primitive2d::BorderLine( diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index cfacba152071..57f0c491aaf3 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -200,10 +200,10 @@ namespace svx // use not only COL_TRANSPARENT for detection of transparence, // but the method/way which is designed to do that - const bool bIsTransparent(0xff == aColor.GetTransparency()); + const bool bIsFullyTransparent(aColor.IsFullyTransparent()); maCurColor = aColor; - if (bIsTransparent) + if (bIsFullyTransparent) { pVirDev->SetFillColor(); } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 061a98923e21..75289e386eb4 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4955,7 +4955,7 @@ Color SwWW8ImplReader::ExtractColour(const sal_uInt8* &rpData, bool bVer67) //background through, it merely acts like white if (nBack == Color(0xFF000000)) nBack = COL_AUTO; - OSL_ENSURE(nBack == COL_AUTO || (nBack.GetTransparency() == 0), + OSL_ENSURE(nBack == COL_AUTO || !nBack.IsTransparent(), "ww8: don't know what to do with such a transparent bg colour, report"); SwWW8Shade aShade(nFore, nBack, nIndex); return aShade.aColor; diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 005d65c49039..36e4f4285e43 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -256,8 +256,8 @@ void ImplConvertTransparentAction( GDIMetaFile& o_rMtf, // Returns true, if given action creates visible (i.e. non-transparent) output bool ImplIsNotTransparent( const MetaAction& rAct, const OutputDevice& rOut ) { - const bool bLineTransparency( !rOut.IsLineColor() || rOut.GetLineColor().GetTransparency() == 255 ); - const bool bFillTransparency( !rOut.IsFillColor() || rOut.GetFillColor().GetTransparency() == 255 ); + const bool bLineTransparency( !rOut.IsLineColor() || rOut.GetLineColor().IsFullyTransparent() ); + const bool bFillTransparency( !rOut.IsFillColor() || rOut.GetFillColor().IsFullyTransparent() ); bool bRet( false ); switch( rAct.GetType() ) |