summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-07-02 16:06:42 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-07-03 12:49:37 +0100
commit82e41a0cd250fa720ba4b545172517ce74dd6814 (patch)
tree65318de601f779ec9bb6b3bb28ffb0bb26077ed1 /svx
parent57bf88d21cacb025e7bea40da78616bb4d165215 (diff)
Resolves: #i125189# corrected used transparency and handling...
to values used in the fallback SvxBrushItem (cherry picked from commit 63f53dbd6cac4fcd7fe568af62f29ae19768085f) Conflicts: sw/source/core/layout/paintfrm.cxx Change-Id: Ifa339c76e8f55a2b4550f1252e6ab3e4dee57080
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/unobrushitemhelper.cxx30
1 files changed, 21 insertions, 9 deletions
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx
index f6fe915e6c85..cad5ee21b20c 100644
--- a/svx/source/unodraw/unobrushitemhelper.cxx
+++ b/svx/source/unodraw/unobrushitemhelper.cxx
@@ -57,8 +57,9 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI
rToSet.Put(XFillStyleItem(XFILL_SOLID));
rToSet.Put(XFillColorItem(OUString(), aColor));
- // nTransparency is in range [0..255], convert to [0..100] which is used in XFillTransparenceItem
- rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 255));
+ // #125189# nTransparency is in range [0..254], convert to [0..100] which is used in
+ // XFillTransparenceItem (caution with the range which is in an *item-specific* range)
+ rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 254));
}
else if(GPOS_NONE != rBrush.GetGraphicPos())
{
@@ -177,8 +178,12 @@ SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchI
if(0 != nFillTransparence)
{
- // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
- aFillColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));
+ // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..254] unsigned
+ // It is necessary to use the maximum of 0xfe for transparence for the SvxBrushItem
+ // since the oxff value is used for special purposes (like no fill and derive from parent)
+ const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100)));
+
+ aFillColor.SetTransparency(aTargetTrans);
}
return SvxBrushItem(aFillColor, nBackgroundID);
@@ -233,8 +238,12 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt
if(0 != nFillTransparence)
{
- // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
- aMixedColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));
+ // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..254] unsigned
+ // It is necessary to use the maximum of 0xfe for transparence for the SvxBrushItem
+ // since the oxff value is used for special purposes (like no fill and derive from parent)
+ const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100)));
+
+ aMixedColor.SetTransparency(aTargetTrans);
}
aRetval = SvxBrushItem(aMixedColor, nBackgroundID);
@@ -263,9 +272,12 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt
// take half orig transparence, add half transparent, clamp result
nFillTransparence = basegfx::clamp((sal_uInt16)((nFillTransparence / 2) + 50), (sal_uInt16)0, (sal_uInt16)255);
- // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
- aHatchColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));
+ // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..254] unsigned
+ // It is necessary to use the maximum of 0xfe for transparence for the SvxBrushItem
+ // since the oxff value is used for special purposes (like no fill and derive from parent)
+ const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100)));
+ aHatchColor.SetTransparency(aTargetTrans);
aRetval = SvxBrushItem(aHatchColor, nBackgroundID);
}
@@ -316,7 +328,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt
if(0 != nFillTransparence)
{
- // nFillTransparence is in range [0..100] and needs to be in [0..100] signed
+ // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..100] signed
aRetval.setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence));
}