[Libreoffice-commits] core.git: include/vcl
Tor Lillqvist
tml at collabora.com
Tue Jun 21 08:21:37 UTC 2016
include/vcl/salbtype.hxx | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
New commits:
commit 81e3ca4f60e6ac0823c1233841c22a759cfe937f
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Jun 21 10:34:21 2016 +0300
Use real assert() instead of DBG_ASSERT()
These assertions guard important invariants. We use real assert() also
in the neighbouring bitmapaccess.hxx, for instance.
Drop annoying exclamation marks.
Change-Id: I9d08cb80b18e8f3a922357ec33c1418f8f1b33e6
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 7238e02..b713770 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -332,55 +332,55 @@ inline bool BitmapColor::IsIndex() const
inline sal_uInt8 BitmapColor::GetRed() const
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
return mcRed;
}
inline void BitmapColor::SetRed( sal_uInt8 cRed )
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
mcRed = cRed;
}
inline sal_uInt8 BitmapColor::GetGreen() const
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
return mcGreen;
}
inline void BitmapColor::SetGreen( sal_uInt8 cGreen )
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
mcGreen = cGreen;
}
inline sal_uInt8 BitmapColor::GetBlue() const
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
return mcBlueOrIndex;
}
inline void BitmapColor::SetBlue( sal_uInt8 cBlue )
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
mcBlueOrIndex = cBlue;
}
inline sal_uInt8 BitmapColor::GetIndex() const
{
- DBG_ASSERT( mbIndex, "Pixel represents color values!" );
+ assert( mbIndex && "Pixel represents color values" );
return mcBlueOrIndex;
}
inline void BitmapColor::SetIndex( sal_uInt8 cIndex )
{
- DBG_ASSERT( mbIndex, "Pixel represents color values!" );
+ assert( mbIndex && "Pixel represents color values" );
mcBlueOrIndex = cIndex;
}
inline BitmapColor::operator Color() const
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
return Color( mcRed, mcGreen, mcBlueOrIndex );
}
@@ -392,7 +392,7 @@ inline sal_uInt8 BitmapColor::GetBlueOrIndex() const
inline BitmapColor& BitmapColor::Invert()
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
mcBlueOrIndex = ~mcBlueOrIndex;
mcGreen = ~mcGreen;
mcRed = ~mcRed;
@@ -402,15 +402,15 @@ inline BitmapColor& BitmapColor::Invert()
inline sal_uInt8 BitmapColor::GetLuminance() const
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
return (static_cast<unsigned long>(mcBlueOrIndex) * 28UL + static_cast<unsigned long>(mcGreen) * 151UL + static_cast<unsigned long>(mcRed) * 77UL) >> 8;
}
inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uInt8 cTransparency )
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
- DBG_ASSERT( !rBitmapColor.mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
+ assert( !rBitmapColor.mbIndex && "Pixel represents index into colortable" );
mcBlueOrIndex = COLOR_CHANNEL_MERGE( mcBlueOrIndex, rBitmapColor.mcBlueOrIndex, cTransparency );
mcGreen = COLOR_CHANNEL_MERGE( mcGreen, rBitmapColor.mcGreen, cTransparency );
mcRed = COLOR_CHANNEL_MERGE( mcRed, rBitmapColor.mcRed, cTransparency );
@@ -421,8 +421,8 @@ inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uIn
inline sal_uInt16 BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const
{
- DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
- DBG_ASSERT( !rBitmapColor.mbIndex, "Pixel represents index into colortable!" );
+ assert( !mbIndex && "Pixel represents index into colortable" );
+ assert( !rBitmapColor.mbIndex && "Pixel represents index into colortable" );
return static_cast<sal_uInt16>(
abs( static_cast<int>(mcBlueOrIndex) - static_cast<int>(rBitmapColor.mcBlueOrIndex) ) +
abs( static_cast<int>(mcGreen) - static_cast<int>(rBitmapColor.mcGreen) ) +
@@ -544,19 +544,19 @@ inline void BitmapPalette::SetEntryCount( sal_uInt16 nCount )
inline const BitmapColor& BitmapPalette::operator[]( sal_uInt16 nIndex ) const
{
- DBG_ASSERT( nIndex < mnCount, "Palette index is out of range!" );
+ assert( nIndex < mnCount && "Palette index is out of range" );
return mpBitmapColor[ nIndex ];
}
inline BitmapColor& BitmapPalette::operator[]( sal_uInt16 nIndex )
{
- DBG_ASSERT( nIndex < mnCount, "Palette index is out of range!" );
+ assert( nIndex < mnCount && "Palette index is out of range" );
return mpBitmapColor[ nIndex ];
}
inline BitmapColor* BitmapPalette::ImplGetColorBuffer() const
{
- DBG_ASSERT( mpBitmapColor, "No color buffer available!" );
+ assert( mpBitmapColor && "No color buffer available" );
return mpBitmapColor;
}
More information about the Libreoffice-commits
mailing list