SvxBrushItem::TransparencyToPercent: add this to avoid copypaste
Change-Id: I9b77c0a48b7de39eadae118c24c70ac415898293
This commit is contained in:
@@ -3567,7 +3567,7 @@ static inline sal_Int8 lcl_PercentToTransparency(long nPercent)
|
||||
//0xff must not be returned!
|
||||
return sal_Int8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0);
|
||||
}
|
||||
static inline sal_Int8 lcl_TransparencyToPercent(sal_Int32 nTrans)
|
||||
sal_Int8 SvxBrushItem::TransparencyToPercent(sal_Int32 nTrans)
|
||||
{
|
||||
return (sal_Int8)((nTrans * 100 + 127) / 254);
|
||||
}
|
||||
@@ -3584,7 +3584,7 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
|
||||
rVal <<= (sal_Int32)( aColor.GetRGBColor() );
|
||||
break;
|
||||
case MID_BACK_COLOR_TRANSPARENCY:
|
||||
rVal <<= lcl_TransparencyToPercent(aColor.GetTransparency());
|
||||
rVal <<= SvxBrushItem::TransparencyToPercent(aColor.GetTransparency());
|
||||
break;
|
||||
case MID_GRAPHIC_POSITION:
|
||||
rVal <<= (style::GraphicLocation)(sal_Int16)eGraphicPos;
|
||||
|
@@ -122,6 +122,7 @@ public:
|
||||
|
||||
static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
|
||||
static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
|
||||
static sal_Int8 TransparencyToPercent(sal_Int32 nTrans);
|
||||
};
|
||||
|
||||
#endif // #ifndef _SVX_BRSHITEM_HXX
|
||||
|
@@ -4864,8 +4864,7 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
|
||||
if (nTransparency)
|
||||
{
|
||||
// Convert transparency to percent
|
||||
// Consider editeng/source/items/frmitems.cxx : lcl_TransparencyToPercent() function.
|
||||
sal_Int8 nTransparencyPercent = (sal_Int8)((nTransparency * 100 + 127) / 254);
|
||||
sal_Int8 nTransparencyPercent = SvxBrushItem::TransparencyToPercent(nTransparency);
|
||||
|
||||
// Calculate alpha value
|
||||
// Consider oox/source/drawingml/color.cxx : getTransparency() function.
|
||||
|
Reference in New Issue
Block a user