summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-03-25 12:06:21 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-03-27 10:45:15 +0900
commit132ad4f1416126a74f8b48f65da786a4e0ec8c1b (patch)
treec264d7115cd2d385b00994ae0c72db683b9fd756 /include
parent44c6c4da9545d69ad02f5e8ea1314388e1eacec7 (diff)
vcl: get rid of macros for lazy people in bmpacc
Change-Id: I4b64a70e185f061c7d7e1e895d85ffb47ee60101
Diffstat (limited to 'include')
-rw-r--r--include/vcl/bmpacc.hxx381
1 files changed, 204 insertions, 177 deletions
diff --git a/include/vcl/bmpacc.hxx b/include/vcl/bmpacc.hxx
index f2f139921b58..f0ab33b989f2 100644
--- a/include/vcl/bmpacc.hxx
+++ b/include/vcl/bmpacc.hxx
@@ -25,42 +25,9 @@
#include <vcl/salbtype.hxx>
#include <vcl/bitmap.hxx>
-
-// - Access defines -
-#define DECL_FORMAT_GETPIXEL( Format ) \
-static BitmapColor GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& rMask );
-
-#define DECL_FORMAT_SETPIXEL( Format ) \
-static void SetPixelFor##Format( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask );
-
-#define DECL_FORMAT( Format ) \
-DECL_FORMAT_GETPIXEL( Format ) \
-DECL_FORMAT_SETPIXEL( Format )
-
-#define IMPL_FORMAT_GETPIXEL( Format ) \
-BitmapColor BitmapReadAccess::GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& rMask )
-
-#define IMPL_FORMAT_GETPIXEL_NOMASK( Format ) \
-BitmapColor BitmapReadAccess::GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& )
-
-#define IMPL_FORMAT_SETPIXEL( Format ) \
-void BitmapReadAccess::SetPixelFor##Format( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask )
-
-#define IMPL_FORMAT_SETPIXEL_NOMASK( Format ) \
-void BitmapReadAccess::SetPixelFor##Format( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& )
-
-#define CASE_FORMAT( Format ) \
-case( BMP_FORMAT##Format ): \
-{ \
- mFncGetPixel = GetPixelFor##Format;\
- mFncSetPixel = SetPixelFor##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 );
-
+typedef BitmapColor (*FncGetPixel)(ConstScanline pScanline, long nX, const ColorMask& rMask);
+typedef void (*FncSetPixel)(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
// - BitmapInfoAccess -
class VCL_DLLPUBLIC BitmapInfoAccess
@@ -68,53 +35,58 @@ class VCL_DLLPUBLIC BitmapInfoAccess
friend class BitmapReadAccess;
public:
- BitmapInfoAccess( Bitmap& rBitmap );
- virtual ~BitmapInfoAccess();
+ BitmapInfoAccess(Bitmap& rBitmap);
+ virtual ~BitmapInfoAccess();
- inline bool operator!() const;
+ inline bool operator!() const;
- inline long Width() const;
- inline long Height() const;
- inline Point TopLeft() const;
- inline Point BottomRight() const;
+ inline long Width() const;
+ inline long Height() const;
+ inline Point TopLeft() const;
+ inline Point BottomRight() const;
- inline bool IsTopDown() const;
- inline bool IsBottomUp() const;
+ inline bool IsTopDown() const;
+ inline bool IsBottomUp() const;
- inline sal_uLong GetScanlineFormat() const;
- inline sal_uLong GetScanlineSize() const;
+ inline sal_uLong GetScanlineFormat() const;
+ inline sal_uLong GetScanlineSize() const;
- inline sal_uInt16 GetBitCount() const;
- inline BitmapColor GetBestMatchingColor( const BitmapColor& rBitmapColor );
+ inline sal_uInt16 GetBitCount() const;
+ inline BitmapColor GetBestMatchingColor(const BitmapColor& rBitmapColor);
- inline bool HasPalette() const;
+ inline bool HasPalette() const;
inline const BitmapPalette& GetPalette() const;
- inline sal_uInt16 GetPaletteEntryCount() const;
- inline const BitmapColor& GetPaletteColor( sal_uInt16 nColor ) const;
- inline const BitmapColor& GetBestPaletteColor( const BitmapColor& rBitmapColor ) const;
- sal_uInt16 GetBestPaletteIndex( const BitmapColor& rBitmapColor ) const;
+ inline sal_uInt16 GetPaletteEntryCount() const;
+ inline const BitmapColor& GetPaletteColor(sal_uInt16 nColor) const;
+ inline const BitmapColor& GetBestPaletteColor(const BitmapColor& rBitmapColor) const;
+ sal_uInt16 GetBestPaletteIndex(const BitmapColor& rBitmapColor) const;
inline bool HasColorMask() const;
inline ColorMask& GetColorMask() const;
private:
+ BitmapInfoAccess()
+ {}
- BitmapInfoAccess() {}
- BitmapInfoAccess( const BitmapInfoAccess& ) {}
- BitmapInfoAccess& operator=( const BitmapInfoAccess& ) { return *this; }
+ BitmapInfoAccess(const BitmapInfoAccess&)
+ {}
+
+ BitmapInfoAccess& operator=(const BitmapInfoAccess&)
+ {
+ return *this;
+ }
protected:
- Bitmap maBitmap;
- BitmapBuffer* mpBuffer;
- ColorMask maColorMask;
- BitmapAccessMode mnAccessMode;
+ Bitmap maBitmap;
+ BitmapBuffer* mpBuffer;
+ ColorMask maColorMask;
+ BitmapAccessMode mnAccessMode;
- SAL_DLLPRIVATE void ImplCreate( Bitmap& rBitmap );
- SAL_DLLPRIVATE void ImplDestroy();
+ SAL_DLLPRIVATE void ImplCreate(Bitmap& rBitmap);
+ SAL_DLLPRIVATE void ImplDestroy();
protected:
- BitmapInfoAccess( Bitmap& rBitmap, BitmapAccessMode nMode );
-
+ BitmapInfoAccess(Bitmap& rBitmap, BitmapAccessMode nMode);
};
// - BitmapReadAccess -
@@ -123,126 +95,162 @@ class VCL_DLLPUBLIC BitmapReadAccess : public BitmapInfoAccess
friend class BitmapWriteAccess;
public:
- BitmapReadAccess( Bitmap& rBitmap );
- virtual ~BitmapReadAccess();
+ BitmapReadAccess(Bitmap& rBitmap);
+ virtual ~BitmapReadAccess();
+
+ inline Scanline GetBuffer() const;
+ inline Scanline GetScanline( long nY ) const;
- inline Scanline GetBuffer() const;
- inline Scanline GetScanline( long nY ) const;
+ inline BitmapColor GetPixelFromData( const sal_uInt8* pData, long nX ) const;
+ inline void SetPixelOnData( sal_uInt8* pData, long nX, const BitmapColor& rBitmapColor );
- inline BitmapColor GetPixelFromData( const sal_uInt8* pData, long nX ) const;
- inline void SetPixelOnData( sal_uInt8* pData, long nX, const BitmapColor& rBitmapColor );
- inline BitmapColor GetPixel( long nY, long nX ) const;
- inline BitmapColor GetColor( long nY, long nX ) const;
- inline sal_uInt8 GetPixelIndex( long nY, long nX ) const;
- inline sal_uInt8 GetLuminance( long nY, long nX ) const;
+ inline BitmapColor GetPixel( long nY, long nX ) const;
+ inline BitmapColor GetColor( long nY, long nX ) const;
+ inline sal_uInt8 GetPixelIndex( long nY, long nX ) const;
+ inline sal_uInt8 GetLuminance( long nY, long nX ) const;
/** Get the interpolated color at coordinates fY, fX; if outside, return rFallback */
- BitmapColor GetInterpolatedColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const;
+ BitmapColor GetInterpolatedColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const;
/** Get the color at coordinates fY, fX; if outside, return rFallback. Automatically does the correct
inside/outside checks, e.g. static_cast< sal_uInt32 >(-0.25) *is* 0, not -1 and has to be outside */
- BitmapColor GetColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const;
+ BitmapColor GetColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const;
private:
- BitmapReadAccess() {}
- BitmapReadAccess( const BitmapReadAccess& ) : BitmapInfoAccess() {}
- BitmapReadAccess& operator=( const BitmapReadAccess& ) { return *this; }
+ BitmapReadAccess()
+ {}
+
+ BitmapReadAccess(const BitmapReadAccess&)
+ : BitmapInfoAccess()
+ {}
+
+ BitmapReadAccess& operator=(const BitmapReadAccess&)
+ {
+ return *this;
+ }
protected:
- Scanline* mpScanBuf;
- FncGetPixel mFncGetPixel;
- FncSetPixel mFncSetPixel;
+ Scanline* mpScanBuf;
+ FncGetPixel mFncGetPixel;
+ FncSetPixel mFncSetPixel;
- SAL_DLLPRIVATE void ImplInitScanBuffer( Bitmap& rBitmap );
- SAL_DLLPRIVATE void ImplClearScanBuffer();
- SAL_DLLPRIVATE bool ImplSetAccessPointers( sal_uLong nFormat );
+ SAL_DLLPRIVATE void ImplInitScanBuffer( Bitmap& rBitmap );
+ SAL_DLLPRIVATE void ImplClearScanBuffer();
+ SAL_DLLPRIVATE bool ImplSetAccessPointers( sal_uLong nFormat );
public:
- SAL_DLLPRIVATE void ImplZeroInitUnusedBits();
- SAL_DLLPRIVATE BitmapBuffer*
- ImplGetBitmapBuffer() const { return mpBuffer; }
-
- DECL_FORMAT( _1BIT_MSB_PAL )
- DECL_FORMAT( _1BIT_LSB_PAL )
- DECL_FORMAT( _4BIT_MSN_PAL )
- DECL_FORMAT( _4BIT_LSN_PAL )
- DECL_FORMAT( _8BIT_PAL )
- DECL_FORMAT( _8BIT_TC_MASK )
- DECL_FORMAT( _16BIT_TC_MSB_MASK )
- DECL_FORMAT( _16BIT_TC_LSB_MASK )
- DECL_FORMAT( _24BIT_TC_BGR )
- DECL_FORMAT( _24BIT_TC_RGB )
- DECL_FORMAT( _24BIT_TC_MASK )
- DECL_FORMAT( _32BIT_TC_ABGR )
- DECL_FORMAT( _32BIT_TC_ARGB )
- DECL_FORMAT( _32BIT_TC_BGRA )
- DECL_FORMAT( _32BIT_TC_RGBA )
- DECL_FORMAT( _32BIT_TC_MASK )
+ SAL_DLLPRIVATE void ImplZeroInitUnusedBits();
+ SAL_DLLPRIVATE BitmapBuffer* ImplGetBitmapBuffer() const
+ {
+ return mpBuffer;
+ }
+
+ static BitmapColor GetPixelFor_1BIT_MSB_PAL(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_1BIT_LSB_PAL(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_4BIT_MSN_PAL(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_4BIT_LSN_PAL(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_8BIT_PAL(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_8BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_16BIT_TC_MSB_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_16BIT_TC_LSB_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_24BIT_TC_BGR(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_24BIT_TC_RGB(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_24BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_32BIT_TC_ABGR(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_32BIT_TC_ARGB(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_32BIT_TC_BGRA(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_32BIT_TC_RGBA(ConstScanline pScanline, long nX, const ColorMask& rMask);
+ static BitmapColor GetPixelFor_32BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask);
+
+ static void SetPixelFor_1BIT_MSB_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_1BIT_LSB_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_4BIT_MSN_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_4BIT_LSN_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_8BIT_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_8BIT_TC_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_16BIT_TC_MSB_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_16BIT_TC_LSB_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_24BIT_TC_BGR(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_24BIT_TC_RGB(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_24BIT_TC_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_32BIT_TC_ABGR(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_32BIT_TC_ARGB(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_32BIT_TC_BGRA(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_32BIT_TC_RGBA(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
+ static void SetPixelFor_32BIT_TC_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask);
protected:
- BitmapReadAccess( Bitmap& rBitmap, BitmapAccessMode nMode );
-
+ BitmapReadAccess(Bitmap& rBitmap, BitmapAccessMode nMode);
};
// - BitmapWriteAccess -
class VCL_DLLPUBLIC BitmapWriteAccess : public BitmapReadAccess
{
public:
+ BitmapWriteAccess(Bitmap& rBitmap);
+ virtual ~BitmapWriteAccess();
- BitmapWriteAccess( Bitmap& rBitmap );
- virtual ~BitmapWriteAccess();
-
- void CopyScanline( long nY, const BitmapReadAccess& rReadAcc );
- void CopyScanline( long nY, ConstScanline aSrcScanline,
- sal_uLong nSrcScanlineFormat, sal_uLong nSrcScanlineSize );
+ void CopyScanline(long nY, const BitmapReadAccess& rReadAcc);
+ void CopyScanline(long nY,
+ ConstScanline aSrcScanline,
+ sal_uLong nSrcScanlineFormat,
+ sal_uLong nSrcScanlineSize);
- void CopyBuffer( const BitmapReadAccess& rReadAcc );
+ void CopyBuffer( const BitmapReadAccess& rReadAcc );
- inline void SetPalette( const BitmapPalette& rPalette );
- inline void SetPaletteEntryCount( sal_uInt16 nCount );
- inline void SetPaletteColor( sal_uInt16 nColor, const BitmapColor& rBitmapColor );
+ inline void SetPalette(const BitmapPalette& rPalette);
+ inline void SetPaletteEntryCount(sal_uInt16 nCount);
+ inline void SetPaletteColor(sal_uInt16 nColor, const BitmapColor& rBitmapColor);
- inline void SetPixel( long nY, long nX, const BitmapColor& rBitmapColor );
- inline void SetPixelIndex( long nY, long nX, sal_uInt8 cIndex );
+ inline void SetPixel(long nY, long nX, const BitmapColor& rBitmapColor);
+ inline void SetPixelIndex(long nY, long nX, sal_uInt8 cIndex);
- void SetLineColor( const Color& rColor );
+ void SetLineColor(const Color& rColor);
- void SetFillColor();
- void SetFillColor( const Color& rColor );
+ void SetFillColor();
+ void SetFillColor(const Color& rColor);
- void Erase( const Color& rColor );
+ void Erase(const Color& rColor);
- void DrawLine( const Point& rStart, const Point& rEnd );
+ void DrawLine(const Point& rStart, const Point& rEnd);
- void FillRect( const Rectangle& rRect );
- void DrawRect( const Rectangle& rRect );
+ void FillRect(const Rectangle& rRect);
+ void DrawRect(const Rectangle& rRect);
private:
- BitmapColor* mpLineColor;
- BitmapColor* mpFillColor;
+ BitmapColor* mpLineColor;
+ BitmapColor* mpFillColor;
+
+ BitmapWriteAccess()
+ {}
+
+ BitmapWriteAccess(const BitmapWriteAccess&)
+ : BitmapReadAccess()
+ {}
- BitmapWriteAccess() {}
- BitmapWriteAccess( const BitmapWriteAccess& ) : BitmapReadAccess() {}
- BitmapWriteAccess& operator=( const BitmapWriteAccess& ) { return *this; }
+ BitmapWriteAccess& operator=(const BitmapWriteAccess&)
+ {
+ return *this;
+ }
};
// - Inlines -
inline bool BitmapInfoAccess::operator!() const
{
- return( mpBuffer == NULL );
+ return mpBuffer == NULL;
}
inline long BitmapInfoAccess::Width() const
{
- return( mpBuffer ? mpBuffer->mnWidth : 0L );
+ return mpBuffer ? mpBuffer->mnWidth : 0L;
}
inline long BitmapInfoAccess::Height() const
{
- return( mpBuffer ? mpBuffer->mnHeight : 0L );
+ return mpBuffer ? mpBuffer->mnHeight : 0L;
}
inline Point BitmapInfoAccess::TopLeft() const
@@ -252,13 +260,14 @@ inline Point BitmapInfoAccess::TopLeft() const
inline Point BitmapInfoAccess::BottomRight() const
{
- return Point( Width() - 1L, Height() - 1L );
+ return Point(Width() - 1L, Height() - 1L);
}
inline bool BitmapInfoAccess::IsTopDown() const
{
assert(mpBuffer && "Access is not valid!");
- return mpBuffer && ( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN );
+
+ return mpBuffer && (BMP_SCANLINE_ADJUSTMENT(mpBuffer->mnFormat) == BMP_FORMAT_TOP_DOWN);
}
inline bool BitmapInfoAccess::IsBottomUp() const
@@ -269,25 +278,28 @@ inline bool BitmapInfoAccess::IsBottomUp() const
inline sal_uLong BitmapInfoAccess::GetScanlineFormat() const
{
assert(mpBuffer && "Access is not valid!");
- return( mpBuffer ? BMP_SCANLINE_FORMAT( mpBuffer->mnFormat ) : 0UL );
+
+ return mpBuffer ? BMP_SCANLINE_FORMAT(mpBuffer->mnFormat) : 0UL;
}
inline sal_uLong BitmapInfoAccess::GetScanlineSize() const
{
assert(mpBuffer && "Access is not valid!");
- return( mpBuffer ? mpBuffer->mnScanlineSize : 0UL );
+
+ return mpBuffer ? mpBuffer->mnScanlineSize : 0UL;
}
inline sal_uInt16 BitmapInfoAccess::GetBitCount() const
{
assert(mpBuffer && "Access is not valid!");
- return( mpBuffer ? mpBuffer->mnBitCount : 0 );
+
+ return mpBuffer ? mpBuffer->mnBitCount : 0;
}
-inline BitmapColor BitmapInfoAccess::GetBestMatchingColor( const BitmapColor& rBitmapColor )
+inline BitmapColor BitmapInfoAccess::GetBestMatchingColor(const BitmapColor& rBitmapColor)
{
- if( HasPalette() )
- return BitmapColor( (sal_uInt8) GetBestPaletteIndex( rBitmapColor ) );
+ if (HasPalette())
+ return BitmapColor((sal_uInt8) GetBestPaletteIndex(rBitmapColor));
else
return rBitmapColor;
}
@@ -295,132 +307,147 @@ inline BitmapColor BitmapInfoAccess::GetBestMatchingColor( const BitmapColor& rB
inline bool BitmapInfoAccess::HasPalette() const
{
assert(mpBuffer && "Access is not valid!");
- return( mpBuffer && !!mpBuffer->maPalette );
+
+ return mpBuffer && !!mpBuffer->maPalette;
}
inline const BitmapPalette& BitmapInfoAccess::GetPalette() const
{
assert(mpBuffer && "Access is not valid!");
+
return mpBuffer->maPalette;
}
inline sal_uInt16 BitmapInfoAccess::GetPaletteEntryCount() const
{
assert(HasPalette() && "Bitmap has no palette!");
- return( HasPalette() ? mpBuffer->maPalette.GetEntryCount() : 0 );
+
+ return HasPalette() ? mpBuffer->maPalette.GetEntryCount() : 0;
}
inline const BitmapColor& BitmapInfoAccess::GetPaletteColor( sal_uInt16 nColor ) const
{
assert(mpBuffer && "Access is not valid!");
assert(HasPalette() && "Bitmap has no palette!");
- return mpBuffer->maPalette[ nColor ];
+
+ return mpBuffer->maPalette[nColor];
}
-inline const BitmapColor& BitmapInfoAccess::GetBestPaletteColor( const BitmapColor& rBitmapColor ) const
+inline const BitmapColor& BitmapInfoAccess::GetBestPaletteColor(const BitmapColor& rBitmapColor) const
{
- return GetPaletteColor( GetBestPaletteIndex( rBitmapColor ) );
+ return GetPaletteColor(GetBestPaletteIndex(rBitmapColor));
}
inline bool BitmapInfoAccess::HasColorMask() const
{
assert(mpBuffer && "Access is not valid!");
- const sal_uLong nFormat = BMP_SCANLINE_FORMAT( mpBuffer->mnFormat );
- return( nFormat == BMP_FORMAT_8BIT_TC_MASK ||
- nFormat == BMP_FORMAT_16BIT_TC_MSB_MASK ||
- nFormat == BMP_FORMAT_16BIT_TC_LSB_MASK ||
- nFormat == BMP_FORMAT_24BIT_TC_MASK ||
- nFormat == BMP_FORMAT_32BIT_TC_MASK );
+ const sal_uLong nFormat = BMP_SCANLINE_FORMAT(mpBuffer->mnFormat);
+
+ return nFormat == BMP_FORMAT_8BIT_TC_MASK ||
+ nFormat == BMP_FORMAT_16BIT_TC_MSB_MASK ||
+ nFormat == BMP_FORMAT_16BIT_TC_LSB_MASK ||
+ nFormat == BMP_FORMAT_24BIT_TC_MASK ||
+ nFormat == BMP_FORMAT_32BIT_TC_MASK;
}
inline ColorMask& BitmapInfoAccess::GetColorMask() const
{
assert(mpBuffer && "Access is not valid!");
+
return mpBuffer->maColorMask;
}
inline Scanline BitmapReadAccess::GetBuffer() const
{
assert(mpBuffer && "Access is not valid!");
- return( mpBuffer ? mpBuffer->mpBits : NULL );
+
+ return mpBuffer ? mpBuffer->mpBits : NULL;
}
-inline Scanline BitmapReadAccess::GetScanline( long nY ) const
+inline Scanline BitmapReadAccess::GetScanline(long nY) const
{
assert(mpBuffer && mpScanBuf && "Access is not valid!");
assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
+
return mpScanBuf[nY];
}
-inline BitmapColor BitmapReadAccess::GetPixel( long nY, long nX ) const
+inline BitmapColor BitmapReadAccess::GetPixel(long nY, long nX) const
{
assert(mpBuffer && mpScanBuf && "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 );
+
+ return mFncGetPixel(mpScanBuf[nY], nX, maColorMask );
}
-inline sal_uInt8 BitmapReadAccess::GetPixelIndex( long nY, long nX ) const
+inline sal_uInt8 BitmapReadAccess::GetPixelIndex(long nY, long nX) const
{
- return GetPixel( nY, nX ).GetBlueOrIndex();
+ return GetPixel(nY, nX).GetBlueOrIndex();
}
-inline BitmapColor BitmapReadAccess::GetPixelFromData( const sal_uInt8* pData, long nX ) const
+inline BitmapColor BitmapReadAccess::GetPixelFromData(const sal_uInt8* pData, long nX) const
{
assert(pData && "Access is not valid!");
+
return mFncGetPixel( pData, nX, maColorMask );
}
-inline void BitmapReadAccess::SetPixelOnData( sal_uInt8* pData, long nX, const BitmapColor& rBitmapColor )
+inline void BitmapReadAccess::SetPixelOnData(sal_uInt8* pData, long nX, const BitmapColor& rBitmapColor)
{
assert(pData && "Access is not valid!");
- mFncSetPixel( pData, nX, rBitmapColor, maColorMask );
+
+ mFncSetPixel(pData, nX, rBitmapColor, maColorMask);
}
-inline BitmapColor BitmapReadAccess::GetColor( long nY, long nX ) const
+inline BitmapColor BitmapReadAccess::GetColor(long nY, long nX) const
{
- if( HasPalette() )
- return mpBuffer->maPalette[ GetPixelIndex( nY, nX ) ];
+ if (HasPalette())
+ return mpBuffer->maPalette[GetPixelIndex(nY, nX)];
else
- return GetPixel( nY, nX );
+ return GetPixel(nY, nX);
}
-inline sal_uInt8 BitmapReadAccess::GetLuminance( long nY, long nX ) const
+inline sal_uInt8 BitmapReadAccess::GetLuminance(long nY, long nX) const
{
- return GetColor( nY, nX ).GetLuminance();
+ return GetColor(nY, nX).GetLuminance();
}
-inline void BitmapWriteAccess::SetPalette( const BitmapPalette& rPalette )
+inline void BitmapWriteAccess::SetPalette(const BitmapPalette& rPalette)
{
assert(mpBuffer && "Access is not valid!");
+
mpBuffer->maPalette = rPalette;
}
-inline void BitmapWriteAccess::SetPaletteEntryCount( sal_uInt16 nCount )
+inline void BitmapWriteAccess::SetPaletteEntryCount(sal_uInt16 nCount)
{
assert(mpBuffer && "Access is not valid!");
- mpBuffer->maPalette.SetEntryCount( nCount );
+
+ mpBuffer->maPalette.SetEntryCount(nCount);
}
-inline void BitmapWriteAccess::SetPaletteColor( sal_uInt16 nColor, const BitmapColor& rBitmapColor )
+inline void BitmapWriteAccess::SetPaletteColor(sal_uInt16 nColor, const BitmapColor& rBitmapColor)
{
assert(mpBuffer && "Access is not valid!");
assert(HasPalette() && "Bitmap has no palette!");
- mpBuffer->maPalette[ nColor ] = rBitmapColor;
+
+ mpBuffer->maPalette[nColor] = rBitmapColor;
}
-inline void BitmapWriteAccess::SetPixel( long nY, long nX, const BitmapColor& rBitmapColor )
+inline void BitmapWriteAccess::SetPixel(long nY, long nX, const BitmapColor& rBitmapColor)
{
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 );
+
+ mFncSetPixel(mpScanBuf[nY], nX, rBitmapColor, maColorMask);
}
-inline void BitmapWriteAccess::SetPixelIndex( long nY, long nX, sal_uInt8 cIndex )
+inline void BitmapWriteAccess::SetPixelIndex(long nY, long nX, sal_uInt8 cIndex)
{
- SetPixel( nY, nX, BitmapColor( cIndex ));
+ SetPixel(nY, nX, BitmapColor(cIndex));
}
#endif // INCLUDED_VCL_BMPACC_HXX