summaryrefslogtreecommitdiff
path: root/include/vcl/bmpacc.hxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-30 14:33:03 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-30 16:31:47 +0100
commitd48af86c9b745d750c97ba9b1c59ea936bcab0ae (patch)
tree9972c5ae2f984ba0a7e4ac08af19de7315cad329 /include/vcl/bmpacc.hxx
parentf90eb33a268bdcd1c52aea5670a58267b0907096 (diff)
DBG_ASSERT->assert
Change-Id: I977e65d15970a523a28076949544fd846e68ec0a
Diffstat (limited to 'include/vcl/bmpacc.hxx')
-rw-r--r--include/vcl/bmpacc.hxx124
1 files changed, 26 insertions, 98 deletions
diff --git a/include/vcl/bmpacc.hxx b/include/vcl/bmpacc.hxx
index 153464faabd9..b64b91be9041 100644
--- a/include/vcl/bmpacc.hxx
+++ b/include/vcl/bmpacc.hxx
@@ -27,8 +27,6 @@
// - Access defines -
-
-
#define DECL_FORMAT_GETPIXEL( Format ) \
static BitmapColor GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& rMask );
@@ -59,18 +57,12 @@ case( BMP_FORMAT##Format ): \
} \
break;
-
-
// - Access functions -
-
-
typedef BitmapColor (*FncGetPixel)( ConstScanline pScanline, long nX, const ColorMask& rMask );
typedef void (*FncSetPixel)( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask );
// - BitmapReadAccess -
-
-
class VCL_DLLPUBLIC BitmapReadAccess
{
friend class BitmapWriteAccess;
@@ -167,10 +159,7 @@ public:
BitmapColor GetColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const;
};
-
// - BitmapWriteAccess -
-
-
class VCL_DLLPUBLIC BitmapWriteAccess : public BitmapReadAccess
{
public:
@@ -212,84 +201,61 @@ private:
BitmapWriteAccess& operator=( const BitmapWriteAccess& ) { return *this; }
};
-
// - Inlines -
-
-
inline bool BitmapReadAccess::operator!() const
{
return( mpBuffer == NULL );
}
-
-
inline long BitmapReadAccess::Width() const
{
return( mpBuffer ? mpBuffer->mnWidth : 0L );
}
-
-
inline long BitmapReadAccess::Height() const
{
return( mpBuffer ? mpBuffer->mnHeight : 0L );
}
-
-
inline Point BitmapReadAccess::TopLeft() const
{
return Point();
}
-
-
inline Point BitmapReadAccess::BottomRight() const
{
return Point( Width() - 1L, Height() - 1L );
}
-
-
inline bool BitmapReadAccess::IsTopDown() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
return mpBuffer && ( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN );
}
-
-
inline bool BitmapReadAccess::IsBottomUp() const
{
return !IsTopDown();
}
-
-
inline sal_uLong BitmapReadAccess::GetScanlineFormat() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
return( mpBuffer ? BMP_SCANLINE_FORMAT( mpBuffer->mnFormat ) : 0UL );
}
-
-
inline sal_uLong BitmapReadAccess::GetScanlineSize() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
return( mpBuffer ? mpBuffer->mnScanlineSize : 0UL );
}
-
-
inline sal_uInt16 BitmapReadAccess::GetBitCount() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
return( mpBuffer ? mpBuffer->mnBitCount : 0 );
}
-
-
inline BitmapColor BitmapReadAccess::GetBestMatchingColor( const BitmapColor& rBitmapColor )
{
if( HasPalette() )
@@ -298,68 +264,52 @@ inline BitmapColor BitmapReadAccess::GetBestMatchingColor( const BitmapColor& rB
return rBitmapColor;
}
-
-
inline Scanline BitmapReadAccess::GetBuffer() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
return( mpBuffer ? mpBuffer->mpBits : NULL );
}
-
-
inline Scanline BitmapReadAccess::GetScanline( long nY ) const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
- DBG_ASSERT( nY < mpBuffer->mnHeight, "y-coordinate out of range!" );
+ assert(mpBuffer && "Access is not valid!");
+ assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
return( mpBuffer ? mpScanBuf[ nY ] : NULL );
}
-
-
inline bool BitmapReadAccess::HasPalette() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
return( mpBuffer && !!mpBuffer->maPalette );
}
-
-
inline const BitmapPalette& BitmapReadAccess::GetPalette() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
return mpBuffer->maPalette;
}
-
-
inline sal_uInt16 BitmapReadAccess::GetPaletteEntryCount() const
{
- DBG_ASSERT( HasPalette(), "Bitmap has no palette!" );
+ assert(HasPalette() && "Bitmap has no palette!");
return( HasPalette() ? mpBuffer->maPalette.GetEntryCount() : 0 );
}
-
-
inline const BitmapColor& BitmapReadAccess::GetPaletteColor( sal_uInt16 nColor ) const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
- DBG_ASSERT( HasPalette(), "Bitmap has no palette!" );
+ assert(mpBuffer && "Access is not valid!");
+ assert(HasPalette() && "Bitmap has no palette!");
return mpBuffer->maPalette[ nColor ];
}
-
-
inline const BitmapColor& BitmapReadAccess::GetBestPaletteColor( const BitmapColor& rBitmapColor ) const
{
return GetPaletteColor( GetBestPaletteIndex( rBitmapColor ) );
}
-
-
inline bool BitmapReadAccess::HasColorMask() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
const sal_uLong nFormat = BMP_SCANLINE_FORMAT( mpBuffer->mnFormat );
return( nFormat == BMP_FORMAT_8BIT_TC_MASK ||
@@ -369,21 +319,17 @@ inline bool BitmapReadAccess::HasColorMask() const
nFormat == BMP_FORMAT_32BIT_TC_MASK );
}
-
-
inline ColorMask& BitmapReadAccess::GetColorMask() const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
return mpBuffer->maColorMask;
}
-
-
inline BitmapColor BitmapReadAccess::GetPixel( long nY, long nX ) const
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
- DBG_ASSERT( nX < mpBuffer->mnWidth, "x-coordinate out of range!" );
- DBG_ASSERT( nY < mpBuffer->mnHeight, "y-coordinate out of range!" );
+ assert(mpBuffer && "Access is not valid!");
+ assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!");
+ assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
return mFncGetPixel( mpScanBuf[ nY ], nX, maColorMask );
}
@@ -392,24 +338,18 @@ inline sal_uInt8 BitmapReadAccess::GetPixelIndex( long nY, long nX ) const
return GetPixel( nY, nX ).GetBlueOrIndex();
}
-
-
inline BitmapColor BitmapReadAccess::GetPixelFromData( const sal_uInt8* pData, long nX ) const
{
- DBG_ASSERT( pData, "Access is not valid!" );
+ assert(pData && "Access is not valid!");
return mFncGetPixel( pData, nX, maColorMask );
}
-
-
inline void BitmapReadAccess::SetPixelOnData( sal_uInt8* pData, long nX, const BitmapColor& rBitmapColor )
{
- DBG_ASSERT( pData, "Access is not valid!" );
+ assert(pData && "Access is not valid!");
mFncSetPixel( pData, nX, rBitmapColor, maColorMask );
}
-
-
inline BitmapColor BitmapReadAccess::GetColor( long nY, long nX ) const
{
if( HasPalette() )
@@ -418,45 +358,35 @@ inline BitmapColor BitmapReadAccess::GetColor( long nY, long nX ) const
return GetPixel( nY, nX );
}
-
-
inline sal_uInt8 BitmapReadAccess::GetLuminance( long nY, long nX ) const
{
return GetColor( nY, nX ).GetLuminance();
}
-
-
inline void BitmapWriteAccess::SetPalette( const BitmapPalette& rPalette )
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
mpBuffer->maPalette = rPalette;
}
-
-
inline void BitmapWriteAccess::SetPaletteEntryCount( sal_uInt16 nCount )
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
+ assert(mpBuffer && "Access is not valid!");
mpBuffer->maPalette.SetEntryCount( nCount );
}
-
-
inline void BitmapWriteAccess::SetPaletteColor( sal_uInt16 nColor, const BitmapColor& rBitmapColor )
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
- DBG_ASSERT( HasPalette(), "Bitmap has no palette!" );
+ assert(mpBuffer && "Access is not valid!");
+ assert(HasPalette() && "Bitmap has no palette!");
mpBuffer->maPalette[ nColor ] = rBitmapColor;
}
-
-
inline void BitmapWriteAccess::SetPixel( long nY, long nX, const BitmapColor& rBitmapColor )
{
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
- DBG_ASSERT( nX < mpBuffer->mnWidth, "x-coordinate out of range!" );
- DBG_ASSERT( nY < mpBuffer->mnHeight, "y-coordinate out of range!" );
+ assert(mpBuffer && "Access is not valid!");
+ assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!");
+ assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
mFncSetPixel( mpScanBuf[ nY ], nX, rBitmapColor, maColorMask );
}
@@ -465,8 +395,6 @@ inline void BitmapWriteAccess::SetPixelIndex( long nY, long nX, sal_uInt8 cIndex
SetPixel( nY, nX, BitmapColor( cIndex ));
}
-
-
#endif // INCLUDED_VCL_BMPACC_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */