canvas/source/cairo/cairo_canvashelper.cxx | 18 - canvas/source/directx/dx_vcltools.cxx | 98 +++---- canvas/source/vcl/canvasbitmaphelper.cxx | 16 - canvas/source/vcl/canvashelper.cxx | 6 filter/source/graphicfilter/egif/egif.cxx | 3 include/vcl/bitmapaccess.hxx | 78 +++--- include/vcl/salbtype.hxx | 52 ++-- svtools/source/graphic/grfmgr2.cxx | 6 vcl/headless/svpbmp.cxx | 12 vcl/inc/headless/svpgdi.hxx | 4 vcl/opengl/salbmp.cxx | 18 - vcl/quartz/salbmp.cxx | 17 - vcl/source/bitmap/BitmapProcessor.cxx | 2 vcl/source/bitmap/bitmapscalesuper.cxx | 6 vcl/source/filter/jpeg/JpegReader.cxx | 10 vcl/source/filter/jpeg/JpegWriter.cxx | 2 vcl/source/gdi/alpha.cxx | 2 vcl/source/gdi/bitmap.cxx | 28 +- vcl/source/gdi/bitmap3.cxx | 12 vcl/source/gdi/bitmapex.cxx | 4 vcl/source/gdi/bmpacc.cxx | 150 +++++------ vcl/source/gdi/bmpacc2.cxx | 64 ++-- vcl/source/gdi/bmpfast.cxx | 376 ++++++++++++++--------------- vcl/source/gdi/dibtools.cxx | 22 - vcl/source/gdi/pdfwriter_impl.cxx | 2 vcl/source/gdi/pngread.cxx | 18 - vcl/source/gdi/salmisc.cxx | 110 ++++---- vcl/source/helper/canvasbitmap.cxx | 34 +- vcl/source/outdev/bitmap.cxx | 20 - vcl/source/outdev/transparent.cxx | 8 vcl/unx/generic/gdi/gdiimpl.cxx | 6 vcl/unx/generic/gdi/salbmp.cxx | 72 ++--- vcl/unx/generic/print/genpspgraphics.cxx | 68 ++--- vcl/win/gdi/salbmp.cxx | 43 +-- 34 files changed, 697 insertions(+), 690 deletions(-)
New commits: commit d9ac7def8ba320853e8865535a7a14f9af77521e Author: Noel Grandin <n...@peralex.com> Date: Fri May 20 09:40:34 2016 +0200 Convert BMP_FORMAT to scoped enum Change-Id: I751ab762b6e6f961e9e73a8a2ca92a3f5a5eb1c8 Reviewed-on: https://gerrit.libreoffice.org/25189 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 6ab701b..9518f0f 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -355,7 +355,7 @@ namespace cairocanvas switch( pAlphaReadAcc->GetScanlineFormat() ) { - case BMP_FORMAT_8BIT_TC_MASK: + case ScanlineFormat::N8BitTcMask: pReadScan = pAlphaReadAcc->GetScanline( nY ); for( nX = 0; nX < nWidth; nX++ ) { @@ -365,7 +365,7 @@ namespace cairocanvas nOff += 4; } break; - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: pReadScan = pAlphaReadAcc->GetScanline( nY ); for( nX = 0; nX < nWidth; nX++ ) { @@ -379,7 +379,7 @@ namespace cairocanvas } break; default: - SAL_INFO( "canvas.cairo", "fallback to GetColor for alpha - slow, format: " << pAlphaReadAcc->GetScanlineFormat() ); + SAL_INFO( "canvas.cairo", "fallback to GetColor for alpha - slow, format: " << (int)pAlphaReadAcc->GetScanlineFormat() ); for( nX = 0; nX < nWidth; nX++ ) { nAlpha = data[ nOff ] = 255 - pAlphaReadAcc->GetColor( nY, nX ).GetIndex(); @@ -451,7 +451,7 @@ namespace cairocanvas switch( pBitmapReadAcc->GetScanlineFormat() ) { - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: pReadScan = pBitmapReadAcc->GetScanline( nY ); if( pAlphaReadAcc ) if( readAlpha( pAlphaReadAcc, nY, nWidth, data, nOff ) ) @@ -484,7 +484,7 @@ namespace cairocanvas #endif } break; - case BMP_FORMAT_24BIT_TC_BGR: + case ScanlineFormat::N24BitTcBgr: pReadScan = pBitmapReadAcc->GetScanline( nY ); if( pAlphaReadAcc ) if( readAlpha( pAlphaReadAcc, nY, nWidth, data, nOff ) ) @@ -513,7 +513,7 @@ namespace cairocanvas #endif } break; - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcRgb: pReadScan = pBitmapReadAcc->GetScanline( nY ); if( pAlphaReadAcc ) if( readAlpha( pAlphaReadAcc, nY, nWidth, data, nOff ) ) @@ -542,7 +542,7 @@ namespace cairocanvas #endif } break; - case BMP_FORMAT_32BIT_TC_BGRA: + case ScanlineFormat::N32BitTcBgra: pReadScan = pBitmapReadAcc->GetScanline( nY ); if( pAlphaReadAcc ) if( readAlpha( pAlphaReadAcc, nY, nWidth, data, nOff ) ) @@ -572,7 +572,7 @@ namespace cairocanvas #endif } break; - case BMP_FORMAT_32BIT_TC_RGBA: + case ScanlineFormat::N32BitTcRgba: pReadScan = pBitmapReadAcc->GetScanline( nY ); if( pAlphaReadAcc ) if( readAlpha( pAlphaReadAcc, nY, nWidth, data, nOff ) ) @@ -603,7 +603,7 @@ namespace cairocanvas } break; default: - SAL_INFO( "canvas.cairo", "fallback to GetColor - slow, format: " << pBitmapReadAcc->GetScanlineFormat() ); + SAL_INFO( "canvas.cairo", "fallback to GetColor - slow, format: " << (int)pBitmapReadAcc->GetScanlineFormat() ); if( pAlphaReadAcc ) if( readAlpha( pAlphaReadAcc, nY, nWidth, data, nOff ) ) diff --git a/canvas/source/directx/dx_vcltools.cxx b/canvas/source/directx/dx_vcltools.cxx index fb11fcf..41d03f6 100644 --- a/canvas/source/directx/dx_vcltools.cxx +++ b/canvas/source/directx/dx_vcltools.cxx @@ -178,14 +178,14 @@ namespace dxcanvas // By convention, the access buffer always has // one of the following formats: - // BMP_FORMAT_1BIT_MSB_PAL - // BMP_FORMAT_4BIT_MSN_PAL - // BMP_FORMAT_8BIT_PAL - // BMP_FORMAT_16BIT_TC_LSB_MASK - // BMP_FORMAT_24BIT_TC_BGR - // BMP_FORMAT_32BIT_TC_MASK + // ScanlineFormat::N1BitMsbPal + // ScanlineFormat::N4BitMsnPal + // ScanlineFormat::N8BitPal + // ScanlineFormat::N16BitTcLsbMask + // ScanlineFormat::N24BitTcBgr + // ScanlineFormat::N32BitTcMask - // and is always BMP_FORMAT_BOTTOM_UP + // and is always ScanlineFormat::BottomUp // This is the way // WinSalBitmap::AcquireBuffer() sets up the @@ -195,8 +195,8 @@ namespace dxcanvas "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unable to acquire read access to alpha" ); - ENSURE_OR_THROW( pAlphaReadAccess->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL || - pAlphaReadAccess->GetScanlineFormat() == BMP_FORMAT_8BIT_TC_MASK, + ENSURE_OR_THROW( pAlphaReadAccess->GetScanlineFormat() == ScanlineFormat::N8BitPal || + pAlphaReadAccess->GetScanlineFormat() == ScanlineFormat::N8BitTcMask, "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unsupported alpha scanline format" ); @@ -208,7 +208,7 @@ namespace dxcanvas { switch( pReadAccess->GetScanlineFormat() ) { - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: { Scanline pScan = pReadAccess->GetScanline( y ); Scanline pAScan = pAlphaReadAccess->GetScanline( y ); @@ -229,7 +229,7 @@ namespace dxcanvas } break; - case BMP_FORMAT_24BIT_TC_BGR: + case ScanlineFormat::N24BitTcBgr: { Scanline pScan = pReadAccess->GetScanline( y ); Scanline pAScan = pAlphaReadAccess->GetScanline( y ); @@ -252,13 +252,13 @@ namespace dxcanvas // TODO(P2): Might be advantageous // to hand-formulate the following // formats, too. - case BMP_FORMAT_1BIT_MSB_PAL: + case ScanlineFormat::N1BitMsbPal: // FALLTHROUGH intended - case BMP_FORMAT_4BIT_MSN_PAL: + case ScanlineFormat::N4BitMsnPal: // FALLTHROUGH intended - case BMP_FORMAT_16BIT_TC_LSB_MASK: + case ScanlineFormat::N16BitTcLsbMask: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_MASK: + case ScanlineFormat::N32BitTcMask: { Scanline pAScan = pAlphaReadAccess->GetScanline( y ); @@ -281,25 +281,25 @@ namespace dxcanvas } break; - case BMP_FORMAT_1BIT_LSB_PAL: + case ScanlineFormat::N1BitLsbPal: // FALLTHROUGH intended - case BMP_FORMAT_4BIT_LSN_PAL: + case ScanlineFormat::N4BitLsnPal: // FALLTHROUGH intended - case BMP_FORMAT_8BIT_TC_MASK: + case ScanlineFormat::N8BitTcMask: // FALLTHROUGH intended - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcRgb: // FALLTHROUGH intended - case BMP_FORMAT_24BIT_TC_MASK: + case ScanlineFormat::N24BitTcMask: // FALLTHROUGH intended - case BMP_FORMAT_16BIT_TC_MSB_MASK: + case ScanlineFormat::N16BitTcMsbMask: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_ABGR: + case ScanlineFormat::N32BitTcAbgr: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_ARGB: + case ScanlineFormat::N32BitTcArgb: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_BGRA: + case ScanlineFormat::N32BitTcBgra: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_RGBA: + case ScanlineFormat::N32BitTcRgba: // FALLTHROUGH intended default: ENSURE_OR_THROW( false, @@ -318,14 +318,14 @@ namespace dxcanvas // By convention, the access buffer always has // one of the following formats: - // BMP_FORMAT_1BIT_MSB_PAL - // BMP_FORMAT_4BIT_MSN_PAL - // BMP_FORMAT_8BIT_PAL - // BMP_FORMAT_16BIT_TC_LSB_MASK - // BMP_FORMAT_24BIT_TC_BGR - // BMP_FORMAT_32BIT_TC_MASK + // ScanlineFormat::N1BitMsbPal + // ScanlineFormat::N4BitMsnPal + // ScanlineFormat::N8BitPal + // ScanlineFormat::N16BitTcLsbMask + // ScanlineFormat::N24BitTcBgr + // ScanlineFormat::N32BitTcMask - // and is always BMP_FORMAT_BOTTOM_UP + // and is always ScanlineFormat::BottomUp // This is the way // WinSalBitmap::AcquireBuffer() sets up the @@ -335,7 +335,7 @@ namespace dxcanvas "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unable to acquire read access to mask" ); - ENSURE_OR_THROW( pMaskReadAccess->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL, + ENSURE_OR_THROW( pMaskReadAccess->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal, "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unsupported mask scanline format" ); @@ -365,7 +365,7 @@ namespace dxcanvas { switch( pReadAccess->GetScanlineFormat() ) { - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: { Scanline pScan = pReadAccess->GetScanline( y ); Scanline pMScan = pMaskReadAccess->GetScanline( y ); @@ -384,7 +384,7 @@ namespace dxcanvas } break; - case BMP_FORMAT_24BIT_TC_BGR: + case ScanlineFormat::N24BitTcBgr: { Scanline pScan = pReadAccess->GetScanline( y ); Scanline pMScan = pMaskReadAccess->GetScanline( y ); @@ -405,13 +405,13 @@ namespace dxcanvas // TODO(P2): Might be advantageous // to hand-formulate the following // formats, too. - case BMP_FORMAT_1BIT_MSB_PAL: + case ScanlineFormat::N1BitMsbPal: // FALLTHROUGH intended - case BMP_FORMAT_4BIT_MSN_PAL: + case ScanlineFormat::N4BitMsnPal: // FALLTHROUGH intended - case BMP_FORMAT_16BIT_TC_LSB_MASK: + case ScanlineFormat::N16BitTcLsbMask: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_MASK: + case ScanlineFormat::N32BitTcMask: { Scanline pMScan = pMaskReadAccess->GetScanline( y ); @@ -433,25 +433,25 @@ namespace dxcanvas } break; - case BMP_FORMAT_1BIT_LSB_PAL: + case ScanlineFormat::N1BitLsbPal: // FALLTHROUGH intended - case BMP_FORMAT_4BIT_LSN_PAL: + case ScanlineFormat::N4BitLsnPal: // FALLTHROUGH intended - case BMP_FORMAT_8BIT_TC_MASK: + case ScanlineFormat::N8BitTcMask: // FALLTHROUGH intended - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcRgb: // FALLTHROUGH intended - case BMP_FORMAT_24BIT_TC_MASK: + case ScanlineFormat::N24BitTcMask: // FALLTHROUGH intended - case BMP_FORMAT_16BIT_TC_MSB_MASK: + case ScanlineFormat::N16BitTcMsbMask: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_ABGR: + case ScanlineFormat::N32BitTcAbgr: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_ARGB: + case ScanlineFormat::N32BitTcArgb: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_BGRA: + case ScanlineFormat::N32BitTcBgra: // FALLTHROUGH intended - case BMP_FORMAT_32BIT_TC_RGBA: + case ScanlineFormat::N32BitTcRgba: // FALLTHROUGH intended default: ENSURE_OR_THROW( false, diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx index 3f388e1..e9754dc 100644 --- a/canvas/source/vcl/canvasbitmaphelper.cxx +++ b/canvas/source/vcl/canvasbitmaphelper.cxx @@ -218,8 +218,8 @@ namespace vclcanvas if( pAlphaWriteAccess.get() ) { - DBG_ASSERT( pAlphaWriteAccess->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL || - pAlphaWriteAccess->GetScanlineFormat() == BMP_FORMAT_8BIT_TC_MASK, + DBG_ASSERT( pAlphaWriteAccess->GetScanlineFormat() == ScanlineFormat::N8BitPal || + pAlphaWriteAccess->GetScanlineFormat() == ScanlineFormat::N8BitTcMask, "non-8bit alpha not supported!" ); } @@ -239,7 +239,7 @@ namespace vclcanvas { switch( pWriteAccess->GetScanlineFormat() ) { - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: { Scanline pScan = pWriteAccess->GetScanline( y ); Scanline pAScan = pAlphaWriteAccess->GetScanline( y ); @@ -262,7 +262,7 @@ namespace vclcanvas } break; - case BMP_FORMAT_24BIT_TC_BGR: + case ScanlineFormat::N24BitTcBgr: { Scanline pScan = pWriteAccess->GetScanline( y ); Scanline pAScan = pAlphaWriteAccess->GetScanline( y ); @@ -284,7 +284,7 @@ namespace vclcanvas } break; - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcRgb: { Scanline pScan = pWriteAccess->GetScanline( y ); Scanline pAScan = pAlphaWriteAccess->GetScanline( y ); @@ -333,7 +333,7 @@ namespace vclcanvas // canvashelper.cxx, unify! switch( pWriteAccess->GetScanlineFormat() ) { - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: { Scanline pScan = pWriteAccess->GetScanline( y ); @@ -351,7 +351,7 @@ namespace vclcanvas } break; - case BMP_FORMAT_24BIT_TC_BGR: + case ScanlineFormat::N24BitTcBgr: { Scanline pScan = pWriteAccess->GetScanline( y ); @@ -368,7 +368,7 @@ namespace vclcanvas } break; - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcRgb: { Scanline pScan = pWriteAccess->GetScanline( y ); diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 9596172f..0dc9360 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -1049,7 +1049,7 @@ namespace vclcanvas { switch( pWriteAccess->GetScanlineFormat() ) { - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: { Scanline pScan = pWriteAccess->GetScanline( y ); @@ -1065,7 +1065,7 @@ namespace vclcanvas } break; - case BMP_FORMAT_24BIT_TC_BGR: + case ScanlineFormat::N24BitTcBgr: { Scanline pScan = pWriteAccess->GetScanline( y ); @@ -1080,7 +1080,7 @@ namespace vclcanvas } break; - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcRgb: { Scanline pScan = pWriteAccess->GetScanline( y ); diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx index 9c90c0f..8e26156 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -467,8 +467,7 @@ void GIFWriter::WriteAccess() const long nWidth = m_pAcc->Width(); const long nHeight = m_pAcc->Height(); std::unique_ptr<sal_uInt8[]> pBuffer; - const sal_uLong nFormat = m_pAcc->GetScanlineFormat(); - bool bNative = ( BMP_FORMAT_8BIT_PAL == nFormat ); + bool bNative = m_pAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal; if( !bNative ) pBuffer.reset(new sal_uInt8[ nWidth ]); diff --git a/include/vcl/bitmapaccess.hxx b/include/vcl/bitmapaccess.hxx index 82fe209..de2c9a7 100644 --- a/include/vcl/bitmapaccess.hxx +++ b/include/vcl/bitmapaccess.hxx @@ -45,7 +45,7 @@ public: inline bool IsTopDown() const; inline bool IsBottomUp() const; - inline sal_uLong GetScanlineFormat() const; + inline ScanlineFormat GetScanlineFormat() const; inline sal_uLong GetScanlineSize() const; inline sal_uInt16 GetBitCount() const; @@ -133,7 +133,7 @@ protected: SAL_DLLPRIVATE void ImplInitScanBuffer( Bitmap& rBitmap ); SAL_DLLPRIVATE void ImplClearScanBuffer(); - SAL_DLLPRIVATE bool ImplSetAccessPointers( sal_uLong nFormat ); + SAL_DLLPRIVATE bool ImplSetAccessPointers( ScanlineFormat nFormat ); public: @@ -142,39 +142,39 @@ public: 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); + static BitmapColor GetPixelForN1BitMsbPal(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN1BitLsbPal(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN4BitMsnPal(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN4BitLsnPal(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN8BitPal(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN8BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN16BitTcMsbMask(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN16BitTcLsbMask(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN24BitTcBgr(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN24BitTcRgb(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN24BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN32BitTcAbgr(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN32BitTcArgb(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN32BitTcBgra(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN32BitTcRgba(ConstScanline pScanline, long nX, const ColorMask& rMask); + static BitmapColor GetPixelForN32BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask); + + static void SetPixelForN1BitMsbPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN1BitLsbPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN4BitMsnPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN4BitLsnPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN8BitPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN8BitTcMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN16BitTcMsbMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN16BitTcLsbMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN24BitTcBgr(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN24BitTcRgb(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN24BitTcMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN32BitTcAbgr(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN32BitTcArgb(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN32BitTcBgra(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN32BitTcRgba(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); + static void SetPixelForN32BitTcMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask); protected: BitmapReadAccess(Bitmap& rBitmap, BitmapAccessMode nMode); @@ -190,7 +190,7 @@ public: void CopyScanline(long nY, const BitmapReadAccess& rReadAcc); void CopyScanline(long nY, ConstScanline aSrcScanline, - sal_uLong nSrcScanlineFormat, + ScanlineFormat nSrcScanlineFormat, sal_uLong nSrcScanlineSize); void CopyBuffer( const BitmapReadAccess& rReadAcc ); @@ -247,7 +247,7 @@ inline bool BitmapInfoAccess::IsTopDown() const { assert(mpBuffer && "Access is not valid!"); - return mpBuffer && (BMP_SCANLINE_ADJUSTMENT(mpBuffer->mnFormat) == BMP_FORMAT_TOP_DOWN); + return mpBuffer && (mpBuffer->mnFormat & ScanlineFormat::TopDown); } @@ -257,11 +257,11 @@ inline bool BitmapInfoAccess::IsBottomUp() const } -inline sal_uLong BitmapInfoAccess::GetScanlineFormat() const +inline ScanlineFormat BitmapInfoAccess::GetScanlineFormat() const { assert(mpBuffer && "Access is not valid!"); - return mpBuffer ? BMP_SCANLINE_FORMAT(mpBuffer->mnFormat) : 0UL; + return mpBuffer ? RemoveScanline(mpBuffer->mnFormat) : ScanlineFormat::NONE; } diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx index 769549d..7238e02 100644 --- a/include/vcl/salbtype.hxx +++ b/include/vcl/salbtype.hxx @@ -19,6 +19,7 @@ #ifndef INCLUDED_VCL_SALBTYPE_HXX #define INCLUDED_VCL_SALBTYPE_HXX + #include <string.h> #include <stdlib.h> #include <tools/debug.hxx> @@ -27,39 +28,42 @@ #include <tools/helpers.hxx> #include <tools/solar.h> #include <vcl/dllapi.h> - +#include <o3tl/typed_flags_set.hxx> typedef sal_uInt8* Scanline; typedef const sal_uInt8* ConstScanline; +enum class ScanlineFormat { + NONE = 0x00000000, -#define BMP_FORMAT_BOTTOM_UP 0x00000000UL -#define BMP_FORMAT_TOP_DOWN 0x80000000UL - -#define BMP_FORMAT_1BIT_MSB_PAL 0x00000001UL -#define BMP_FORMAT_1BIT_LSB_PAL 0x00000002UL + N1BitMsbPal = 0x00000001, + N1BitLsbPal = 0x00000002, -#define BMP_FORMAT_4BIT_MSN_PAL 0x00000004UL -#define BMP_FORMAT_4BIT_LSN_PAL 0x00000008UL + N4BitMsnPal = 0x00000004, + N4BitLsnPal = 0x00000008, -#define BMP_FORMAT_8BIT_PAL 0x00000010UL -#define BMP_FORMAT_8BIT_TC_MASK 0x00000020UL + N8BitPal = 0x00000010, + N8BitTcMask = 0x00000020, -#define BMP_FORMAT_24BIT_TC_BGR 0x00000080UL -#define BMP_FORMAT_24BIT_TC_RGB 0x00000100UL -#define BMP_FORMAT_24BIT_TC_MASK 0x00000200UL + N16BitTcMsbMask = 0x00000040, + N16BitTcLsbMask = 0x00000080, -#define BMP_FORMAT_32BIT_TC_ABGR 0x00000400UL -#define BMP_FORMAT_32BIT_TC_ARGB 0x00000800UL -#define BMP_FORMAT_32BIT_TC_BGRA 0x00001000UL -#define BMP_FORMAT_32BIT_TC_RGBA 0x00002000UL -#define BMP_FORMAT_32BIT_TC_MASK 0x00004000UL + N24BitTcBgr = 0x00000100, + N24BitTcRgb = 0x00000200, + N24BitTcMask = 0x00000400, -#define BMP_FORMAT_16BIT_TC_MSB_MASK 0x00008000UL -#define BMP_FORMAT_16BIT_TC_LSB_MASK 0x00010000UL + N32BitTcAbgr = 0x00000800, + N32BitTcArgb = 0x00001000, + N32BitTcBgra = 0x00002000, + N32BitTcRgba = 0x00004000, + N32BitTcMask = 0x00008000, -#define BMP_SCANLINE_ADJUSTMENT( Mac_nBmpFormat ) ( (Mac_nBmpFormat) & 0x80000000UL ) -#define BMP_SCANLINE_FORMAT( Mac_nBmpFormat ) ( (Mac_nBmpFormat) & 0x7FFFFFFFUL ) + TopDown = 0x00010000 // scanline adjustment +}; +namespace o3tl { + template<> struct typed_flags<ScanlineFormat> : is_typed_flags<ScanlineFormat, 0x0001ffff> {}; +} +inline ScanlineFormat RemoveScanline(ScanlineFormat nFormat) { return nFormat & ~ScanlineFormat::TopDown; } #define MASK_TO_COLOR( d_nVal, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_Col ) \ @@ -256,7 +260,7 @@ public: struct VCL_DLLPUBLIC BitmapBuffer { - sal_uLong mnFormat; + ScanlineFormat mnFormat; long mnWidth; long mnHeight; long mnScanlineSize; @@ -275,7 +279,7 @@ enum class BitmapAccessMode VCL_DLLPUBLIC BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect, - sal_uLong nDstBitmapFormat, const BitmapPalette* pDstPal = nullptr, const ColorMask* pDstMask = nullptr ); + ScanlineFormat nDstBitmapFormat, const BitmapPalette* pDstPal = nullptr, const ColorMask* pDstMask = nullptr ); inline BitmapColor::BitmapColor() : mcBlueOrIndex ( 0 ), diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 079dc93..70291eb 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -638,8 +638,8 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib if( pWriteAccess ) { - if( pReadAccess->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL && - pWriteAccess->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + if( pReadAccess->GetScanlineFormat() == ScanlineFormat::N8BitPal && + pWriteAccess->GetScanlineFormat() == ScanlineFormat::N8BitPal ) { if ( !scaleByAveraging ) { @@ -1468,7 +1468,7 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, Gra sal_uLong nTrans = cTrans, nNewTrans; const long nWidth = pA->Width(), nHeight = pA->Height(); - if( pA->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + if( pA->GetScanlineFormat() == ScanlineFormat::N8BitPal ) { for( long nY = 0; nY < nHeight; nY++ ) { diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx index 180ad2c..756caee 100644 --- a/vcl/headless/svpbmp.cxx +++ b/vcl/headless/svpbmp.cxx @@ -75,20 +75,20 @@ BitmapBuffer* ImplCreateDIB( switch (nBitCount) { case 1: - pDIB->mnFormat = BMP_FORMAT_1BIT_MSB_PAL; + pDIB->mnFormat = ScanlineFormat::N1BitMsbPal; break; case 4: - pDIB->mnFormat = BMP_FORMAT_4BIT_MSN_PAL; + pDIB->mnFormat = ScanlineFormat::N4BitMsnPal; break; case 8: - pDIB->mnFormat = BMP_FORMAT_8BIT_PAL; + pDIB->mnFormat = ScanlineFormat::N8BitPal; break; case 16: { #ifdef OSL_BIGENDIAN - pDIB->mnFormat= BMP_FORMAT_16BIT_TC_MSB_MASK; + pDIB->mnFormat= ScanlineFormat::N16BitTcMsbMask; #else - pDIB->mnFormat= BMP_FORMAT_16BIT_TC_LSB_MASK; + pDIB->mnFormat= ScanlineFormat::N16BitTcLsbMask; #endif ColorMaskElement aRedMask(0xf800); aRedMask.CalcMaskShift(); @@ -109,7 +109,7 @@ BitmapBuffer* ImplCreateDIB( } } - pDIB->mnFormat |= BMP_FORMAT_TOP_DOWN; + pDIB->mnFormat |= ScanlineFormat::TopDown; pDIB->mnWidth = rSize.Width(); pDIB->mnHeight = rSize.Height(); pDIB->mnScanlineSize = AlignedWidth4Bytes( pDIB->mnWidth * nBitCount ); diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 7403143..dc88a60 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -38,9 +38,9 @@ //cairo then matches the OpenGL GL_RGBA format so we can use it there //where we don't have GL_BGRA support. #ifdef ANDROID -# define SVP_CAIRO_FORMAT (BMP_FORMAT_32BIT_TC_RGBA | BMP_FORMAT_TOP_DOWN) +# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba | ScanlineFormat::TopDown) #else -# define SVP_CAIRO_FORMAT (BMP_FORMAT_32BIT_TC_BGRA | BMP_FORMAT_TOP_DOWN) +# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcBgra | ScanlineFormat::TopDown) #endif struct BitmapBuffer; diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index 0ba5b43..fbfcf6f 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -766,18 +766,18 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode ) switch (mnBits) { case 1: - pBuffer->mnFormat = BMP_FORMAT_1BIT_MSB_PAL; + pBuffer->mnFormat = ScanlineFormat::N1BitMsbPal; break; case 4: - pBuffer->mnFormat = BMP_FORMAT_4BIT_MSN_PAL; + pBuffer->mnFormat = ScanlineFormat::N4BitMsnPal; break; case 8: - pBuffer->mnFormat = BMP_FORMAT_8BIT_PAL; + pBuffer->mnFormat = ScanlineFormat::N8BitPal; break; case 16: { #ifdef _WIN32 - pBuffer->mnFormat = BMP_FORMAT_16BIT_TC_LSB_MASK; + pBuffer->mnFormat = ScanlineFormat::N16BitTcLsbMask; ColorMaskElement aRedMask(0x00007c00); aRedMask.CalcMaskShift(); ColorMaskElement aGreenMask(0x000003e0); @@ -786,7 +786,7 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode ) aBlueMask.CalcMaskShift(); pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask); #else - pBuffer->mnFormat = BMP_FORMAT_16BIT_TC_MSB_MASK; + pBuffer->mnFormat = ScanlineFormat::N16BitTcMsbMask; ColorMaskElement aRedMask(0x0000f800); aRedMask.CalcMaskShift(); ColorMaskElement aGreenMask(0x000007e0); @@ -800,16 +800,16 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode ) case 24: { #ifdef _WIN32 - pBuffer->mnFormat = BMP_FORMAT_24BIT_TC_BGR; + pBuffer->mnFormat = ScanlineFormat::N24BitTcBgr; #else - pBuffer->mnFormat = BMP_FORMAT_24BIT_TC_RGB; + pBuffer->mnFormat = ScanlineFormat::N24BitTcRgb; #endif break; } case 32: { #ifdef _WIN32 - pBuffer->mnFormat = BMP_FORMAT_32BIT_TC_BGRA; + pBuffer->mnFormat = ScanlineFormat::N32BitTcBgra; ColorMaskElement aRedMask(0x00ff0000); aRedMask.CalcMaskShift(); ColorMaskElement aGreenMask(0x0000ff00); @@ -818,7 +818,7 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode ) aBlueMask.CalcMaskShift(); pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask); #else - pBuffer->mnFormat = BMP_FORMAT_32BIT_TC_RGBA; + pBuffer->mnFormat = ScanlineFormat::N32BitTcRgba; ColorMaskElement aRedMask(0xff000000); aRedMask.CalcMaskShift(); ColorMaskElement aGreenMask(0x00ff0000); diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index 3817c94..3464307 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -604,12 +604,12 @@ void QuartzSalBitmap::ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight, { // TODO: extend bmpfast.cxx with a method that can be directly used here BitmapBuffer aSrcBuf; - aSrcBuf.mnFormat = BMP_FORMAT_24BIT_TC_BGR; + aSrcBuf.mnFormat = ScanlineFormat::N24BitTcBgr; aSrcBuf.mpBits = pSrcData; aSrcBuf.mnBitCount = nSrcBits; aSrcBuf.mnScanlineSize = nSrcBytesPerRow; BitmapBuffer aDstBuf; - aDstBuf.mnFormat = BMP_FORMAT_32BIT_TC_ARGB; + aDstBuf.mnFormat = ScanlineFormat::N32BitTcArgb; aDstBuf.mpBits = pDestData; aDstBuf.mnBitCount = nDestBits; aDstBuf.mnScanlineSize = nDestBytesPerRow; @@ -768,17 +768,17 @@ BitmapBuffer* QuartzSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ ) switch( mnBits ) { case 1: - pBuffer->mnFormat = BMP_FORMAT_1BIT_MSB_PAL; + pBuffer->mnFormat = ScanlineFormat::N1BitMsbPal; break; case 4: - pBuffer->mnFormat = BMP_FORMAT_4BIT_MSN_PAL; + pBuffer->mnFormat = ScanlineFormat::N4BitMsnPal; break; case 8: - pBuffer->mnFormat = BMP_FORMAT_8BIT_PAL; + pBuffer->mnFormat = ScanlineFormat::N8BitPal; break; case 16: { - pBuffer->mnFormat = BMP_FORMAT_16BIT_TC_MSB_MASK; + pBuffer->mnFormat = ScanlineFormat::N16BitTcMsbMask; ColorMaskElement aRedMask(k16BitRedColorMask); aRedMask.CalcMaskShift(); ColorMaskElement aGreenMask(k16BitGreenColorMask); @@ -789,11 +789,11 @@ BitmapBuffer* QuartzSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ ) break; } case 24: - pBuffer->mnFormat = BMP_FORMAT_24BIT_TC_BGR; + pBuffer->mnFormat = ScanlineFormat::N24BitTcBgr; break; case 32: { - pBuffer->mnFormat = BMP_FORMAT_32BIT_TC_ARGB; + pBuffer->mnFormat = ScanlineFormat::N32BitTcArgb; ColorMaskElement aRedMask(k32BitRedColorMask); aRedMask.CalcMaskShift(); ColorMaskElement aGreenMask(k32BitGreenColorMask); @@ -804,7 +804,6 @@ BitmapBuffer* QuartzSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ ) break; } } - pBuffer->mnFormat |= BMP_FORMAT_BOTTOM_UP; // some BitmapBuffer users depend on a complete palette if( (mnBits <= 8) && !maPalette ) diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx index a80e366..acbac9a 100644 --- a/vcl/source/bitmap/BitmapProcessor.cxx +++ b/vcl/source/bitmap/BitmapProcessor.cxx @@ -165,7 +165,7 @@ void BitmapProcessor::colorizeImage(BitmapEx& rBitmapEx, Color aColor) pWriteAccess->SetPaletteColor(i, aBitmapColor); } } - else if (pWriteAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR) + else if (pWriteAccess->GetScanlineFormat() == ScanlineFormat::N24BitTcBgr) { for (nY = 0; nY < nH; ++nY) { diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx index 33645f6..9fb1f44 100644 --- a/vcl/source/bitmap/bitmapscalesuper.cxx +++ b/vcl/source/bitmap/bitmapscalesuper.cxx @@ -958,7 +958,7 @@ bool BitmapScaleSuper::filter(Bitmap& rBitmap) { switch( pReadAccess->GetScanlineFormat() ) { - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: pScaleRangeFn = bScaleUp ? scalePallete8bit : scalePallete8bit2; break; default: @@ -971,10 +971,10 @@ bool BitmapScaleSuper::filter(Bitmap& rBitmap) { switch( pReadAccess->GetScanlineFormat() ) { - case BMP_FORMAT_24BIT_TC_BGR: + case ScanlineFormat::N24BitTcBgr: pScaleRangeFn = bScaleUp ? scale24bitBGR : scale24bitBGR2; break; - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcRgb: pScaleRangeFn = bScaleUp ? scale24bitRGB : scale24bitRGB2; break; default: diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index eb01912..3f348763 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -271,11 +271,11 @@ unsigned char * JPEGReader::CreateBitmap(JPEGCreateBitmapParam& rParam) if( mpAcc ) { - const sal_uLong nFormat = mpAcc->GetScanlineFormat(); + const ScanlineFormat nFormat = mpAcc->GetScanlineFormat(); if( - ( bGray && ( BMP_FORMAT_8BIT_PAL == nFormat ) ) || - ( !bGray && ( BMP_FORMAT_24BIT_TC_RGB == nFormat ) ) + ( bGray && ( ScanlineFormat::N8BitPal == nFormat ) ) || + ( !bGray && ( ScanlineFormat::N24BitTcRgb == nFormat ) ) ) { pBmpBuf = mpAcc->GetBuffer(); @@ -347,7 +347,7 @@ void JPEGReader::FillBitmap() // #i122985# Trying to copy the RGB data from jpeg import to make things faster. Unfortunately // it has no GBR format, so RGB three-byte groups need to be 'flipped' to GBR first, // then CopyScanline can use a memcpy to do the data transport. CopyScanline can also - // do the needed conversion from BMP_FORMAT_24BIT_TC_RGB (and it works well), but this + // do the needed conversion from ScanlineFormat::N24BitTcRgb (and it works well), but this // is not faster that the old loop below using SetPixel. sal_uInt8* aSource(mpBuffer + nY * nAlignedWidth); sal_uInt8* aEnd(aSource + (nWidth * 3)); @@ -357,7 +357,7 @@ void JPEGReader::FillBitmap() ::std::swap(*aTmp, *(aTmp + 2)); } - mpAcc->CopyScanline(nY, aSource, BMP_FORMAT_24BIT_TC_BGR, nWidth * 3); + mpAcc->CopyScanline(nY, aSource, ScanlineFormat::N24BitTcBgr, nWidth * 3); } else { diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx index 35c0479..27fd6f2 100644 --- a/vcl/source/filter/jpeg/JpegWriter.cxx +++ b/vcl/source/filter/jpeg/JpegWriter.cxx @@ -222,7 +222,7 @@ bool JPEGWriter::Write( const Graphic& rGraphic ) if( mpExpWasGrey ) *mpExpWasGrey = mbGreys; - mbNative = ( mpReadAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ); + mbNative = ( mpReadAccess->GetScanlineFormat() == ScanlineFormat::N24BitTcRgb ); if( !mbNative ) mpBuffer = new sal_uInt8[ AlignedWidth4Bytes( mbGreys ? mpReadAccess->Width() * 8L : mpReadAccess->Width() * 24L ) ]; diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx index 614eb40..01a57f6 100644 --- a/vcl/source/gdi/alpha.cxx +++ b/vcl/source/gdi/alpha.cxx @@ -115,7 +115,7 @@ bool AlphaMask::Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransp { const long nWidth = pAcc->Width(), nHeight = pAcc->Height(); - if( pAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + if( pAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal ) { for( long nY = 0L; nY < nHeight; nY++ ) { diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index e60d77c..b30c71e 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -372,14 +372,14 @@ bool Bitmap::Erase(const Color& rFillColor) if (pWriteAcc) { - const sal_uLong nFormat = pWriteAcc->GetScanlineFormat(); + const ScanlineFormat nFormat = pWriteAcc->GetScanlineFormat(); sal_uInt8 cIndex = 0; bool bFast = false; switch (nFormat) { - case BMP_FORMAT_1BIT_MSB_PAL: - case BMP_FORMAT_1BIT_LSB_PAL: + case ScanlineFormat::N1BitMsbPal: + case ScanlineFormat::N1BitLsbPal: { cIndex = static_cast<sal_uInt8>(pWriteAcc->GetBestPaletteIndex(rFillColor)); cIndex = (cIndex ? 255 : 0); @@ -387,8 +387,8 @@ bool Bitmap::Erase(const Color& rFillColor) } break; - case BMP_FORMAT_4BIT_MSN_PAL: - case BMP_FORMAT_4BIT_LSN_PAL: + case ScanlineFormat::N4BitMsnPal: + case ScanlineFormat::N4BitLsnPal: { cIndex = static_cast<sal_uInt8>(pWriteAcc->GetBestPaletteIndex(rFillColor)); cIndex = cIndex | ( cIndex << 4 ); @@ -396,15 +396,15 @@ bool Bitmap::Erase(const Color& rFillColor) } break; - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: { cIndex = static_cast<sal_uInt8>(pWriteAcc->GetBestPaletteIndex(rFillColor)); bFast = true; } break; - case BMP_FORMAT_24BIT_TC_BGR: - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcBgr: + case ScanlineFormat::N24BitTcRgb: { if (rFillColor.GetRed() == rFillColor.GetGreen() && rFillColor.GetRed() == rFillColor.GetBlue()) @@ -1124,14 +1124,14 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uLong nTol ) const const BitmapColor aTest( pReadAcc->GetBestMatchingColor( rTransColor ) ); long nX, nY; - if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_MSN_PAL || - pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_LSN_PAL ) + if( pReadAcc->GetScanlineFormat() == ScanlineFormat::N4BitMsnPal || + pReadAcc->GetScanlineFormat() == ScanlineFormat::N4BitLsnPal ) { // optimized for 4Bit-MSN/LSN source palette const sal_uInt8 cTest = aTest.GetIndex(); - const long nShiftInit = ( ( pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_MSN_PAL ) ? 4 : 0 ); + const long nShiftInit = ( ( pReadAcc->GetScanlineFormat() == ScanlineFormat::N4BitMsnPal ) ? 4 : 0 ); - if( pWriteAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && + if( pWriteAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal && aWhite.GetIndex() == 1 ) { // optimized for 1Bit-MSB destination palette @@ -1165,12 +1165,12 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uLong nTol ) const } } } - else if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + else if( pReadAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal ) { // optimized for 8Bit source palette const sal_uInt8 cTest = aTest.GetIndex(); - if( pWriteAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && + if( pWriteAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal && aWhite.GetIndex() == 1 ) { // optimized for 1Bit-MSB destination palette diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 46826ad..9e5af0e 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -529,8 +529,8 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys ) } } } - else if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR && - pWriteAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + else if( pReadAcc->GetScanlineFormat() == ScanlineFormat::N24BitTcBgr && + pWriteAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal ) { nShift += 8; @@ -549,8 +549,8 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys ) } } } - else if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB && - pWriteAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) + else if( pReadAcc->GetScanlineFormat() == ScanlineFormat::N24BitTcRgb && + pWriteAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal ) { nShift += 8; @@ -2208,7 +2208,7 @@ bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, pAcc->SetPaletteColor( i, aNewCol ); } } - else if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR ) + else if( pAcc->GetScanlineFormat() == ScanlineFormat::N24BitTcBgr ) { for( long nY = 0L; nY < nH; nY++ ) { @@ -2222,7 +2222,7 @@ bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, } } } - else if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ) + else if( pAcc->GetScanlineFormat() == ScanlineFormat::N24BitTcRgb ) { for( long nY = 0L; nY < nH; nY++ ) { diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 03ad08e..ed911d0 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -1068,7 +1068,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod xContent->SetPaletteColor(b, BitmapColor(Color(aBDest))); } } - else if(BMP_FORMAT_24BIT_TC_BGR == xContent->GetScanlineFormat()) + else if(ScanlineFormat::N24BitTcBgr == xContent->GetScanlineFormat()) { for(sal_uInt32 y(0L); y < (sal_uInt32)xContent->Height(); y++) { @@ -1087,7 +1087,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod } } } - else if(BMP_FORMAT_24BIT_TC_RGB == xContent->GetScanlineFormat()) + else if(ScanlineFormat::N24BitTcRgb == xContent->GetScanlineFormat()) { for(sal_uInt32 y(0L); y < (sal_uInt32)xContent->Height(); y++) { diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index e18f242..3bc0a55 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -139,7 +139,7 @@ void BitmapReadAccess::ImplInitScanBuffer( Bitmap& rBitmap ) try { mpScanBuf = new Scanline[ nHeight ]; - if( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN ) + if( mpBuffer->mnFormat & ScanlineFormat::TopDown ) { for( long nY = 0L; nY < nHeight; nY++, pTmpLine += mpBuffer->mnScanlineSize ) mpScanBuf[ nY ] = pTmpLine; @@ -149,7 +149,7 @@ void BitmapReadAccess::ImplInitScanBuffer( Bitmap& rBitmap ) for( long nY = nHeight - 1; nY >= 0; nY--, pTmpLine += mpBuffer->mnScanlineSize ) mpScanBuf[ nY ] = pTmpLine; } - bOk = ImplSetAccessPointers(BMP_SCANLINE_FORMAT(mpBuffer->mnFormat)); + bOk = ImplSetAccessPointers(RemoveScanline(mpBuffer->mnFormat)); } catch (const std::bad_alloc&) { @@ -172,106 +172,106 @@ void BitmapReadAccess::ImplClearScanBuffer() mpScanBuf = nullptr; } -bool BitmapReadAccess::ImplSetAccessPointers( sal_uLong nFormat ) +bool BitmapReadAccess::ImplSetAccessPointers( ScanlineFormat nFormat ) { bool bRet = true; switch( nFormat ) { - case BMP_FORMAT_1BIT_MSB_PAL: + case ScanlineFormat::N1BitMsbPal: { - mFncGetPixel = GetPixelFor_1BIT_MSB_PAL; - mFncSetPixel = SetPixelFor_1BIT_MSB_PAL; + mFncGetPixel = GetPixelForN1BitMsbPal; + mFncSetPixel = SetPixelForN1BitMsbPal; } break; - case BMP_FORMAT_1BIT_LSB_PAL: + case ScanlineFormat::N1BitLsbPal: { - mFncGetPixel = GetPixelFor_1BIT_LSB_PAL; - mFncSetPixel = SetPixelFor_1BIT_LSB_PAL; + mFncGetPixel = GetPixelForN1BitLsbPal; + mFncSetPixel = SetPixelForN1BitLsbPal; } break; - case BMP_FORMAT_4BIT_MSN_PAL: + case ScanlineFormat::N4BitMsnPal: { - mFncGetPixel = GetPixelFor_4BIT_MSN_PAL; - mFncSetPixel = SetPixelFor_4BIT_MSN_PAL; + mFncGetPixel = GetPixelForN4BitMsnPal; + mFncSetPixel = SetPixelForN4BitMsnPal; } break; - case BMP_FORMAT_4BIT_LSN_PAL: + case ScanlineFormat::N4BitLsnPal: { - mFncGetPixel = GetPixelFor_4BIT_LSN_PAL; - mFncSetPixel = SetPixelFor_4BIT_LSN_PAL; + mFncGetPixel = GetPixelForN4BitLsnPal; + mFncSetPixel = SetPixelForN4BitLsnPal; } break; - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N8BitPal: { - mFncGetPixel = GetPixelFor_8BIT_PAL; - mFncSetPixel = SetPixelFor_8BIT_PAL; + mFncGetPixel = GetPixelForN8BitPal; + mFncSetPixel = SetPixelForN8BitPal; } break; - case BMP_FORMAT_8BIT_TC_MASK: + case ScanlineFormat::N8BitTcMask: { - mFncGetPixel = GetPixelFor_8BIT_TC_MASK; - mFncSetPixel = SetPixelFor_8BIT_TC_MASK; + mFncGetPixel = GetPixelForN8BitTcMask; + mFncSetPixel = SetPixelForN8BitTcMask; } break; - case BMP_FORMAT_16BIT_TC_MSB_MASK: + case ScanlineFormat::N16BitTcMsbMask: { - mFncGetPixel = GetPixelFor_16BIT_TC_MSB_MASK; - mFncSetPixel = SetPixelFor_16BIT_TC_MSB_MASK; + mFncGetPixel = GetPixelForN16BitTcMsbMask; + mFncSetPixel = SetPixelForN16BitTcMsbMask; } break; - case BMP_FORMAT_16BIT_TC_LSB_MASK: + case ScanlineFormat::N16BitTcLsbMask: { - mFncGetPixel = GetPixelFor_16BIT_TC_LSB_MASK; - mFncSetPixel = SetPixelFor_16BIT_TC_LSB_MASK; + mFncGetPixel = GetPixelForN16BitTcLsbMask; + mFncSetPixel = SetPixelForN16BitTcLsbMask; } break; - case BMP_FORMAT_24BIT_TC_BGR: + case ScanlineFormat::N24BitTcBgr: { - mFncGetPixel = GetPixelFor_24BIT_TC_BGR; - mFncSetPixel = SetPixelFor_24BIT_TC_BGR; + mFncGetPixel = GetPixelForN24BitTcBgr; + mFncSetPixel = SetPixelForN24BitTcBgr; } break; - case BMP_FORMAT_24BIT_TC_RGB: + case ScanlineFormat::N24BitTcRgb: { - mFncGetPixel = GetPixelFor_24BIT_TC_RGB; - mFncSetPixel = SetPixelFor_24BIT_TC_RGB; + mFncGetPixel = GetPixelForN24BitTcRgb; + mFncSetPixel = SetPixelForN24BitTcRgb; } break; - case BMP_FORMAT_24BIT_TC_MASK: + case ScanlineFormat::N24BitTcMask: { - mFncGetPixel = GetPixelFor_24BIT_TC_MASK; - mFncSetPixel = SetPixelFor_24BIT_TC_MASK; + mFncGetPixel = GetPixelForN24BitTcMask; + mFncSetPixel = SetPixelForN24BitTcMask; } break; - case BMP_FORMAT_32BIT_TC_ABGR: + case ScanlineFormat::N32BitTcAbgr: { - mFncGetPixel = GetPixelFor_32BIT_TC_ABGR; - mFncSetPixel = SetPixelFor_32BIT_TC_ABGR; + mFncGetPixel = GetPixelForN32BitTcAbgr; + mFncSetPixel = SetPixelForN32BitTcAbgr; } break; - case BMP_FORMAT_32BIT_TC_ARGB: + case ScanlineFormat::N32BitTcArgb: { - mFncGetPixel = GetPixelFor_32BIT_TC_ARGB; - mFncSetPixel = SetPixelFor_32BIT_TC_ARGB; + mFncGetPixel = GetPixelForN32BitTcArgb; + mFncSetPixel = SetPixelForN32BitTcArgb; } break; - case BMP_FORMAT_32BIT_TC_BGRA: + case ScanlineFormat::N32BitTcBgra: { - mFncGetPixel = GetPixelFor_32BIT_TC_BGRA; - mFncSetPixel = SetPixelFor_32BIT_TC_BGRA; + mFncGetPixel = GetPixelForN32BitTcBgra; + mFncSetPixel = SetPixelForN32BitTcBgra; } break; - case BMP_FORMAT_32BIT_TC_RGBA: + case ScanlineFormat::N32BitTcRgba: { - mFncGetPixel = GetPixelFor_32BIT_TC_RGBA; - mFncSetPixel = SetPixelFor_32BIT_TC_RGBA; + mFncGetPixel = GetPixelForN32BitTcRgba; + mFncSetPixel = SetPixelForN32BitTcRgba; } break; - case BMP_FORMAT_32BIT_TC_MASK: + case ScanlineFormat::N32BitTcMask: { - mFncGetPixel = GetPixelFor_32BIT_TC_MASK; - mFncSetPixel = SetPixelFor_32BIT_TC_MASK; + mFncGetPixel = GetPixelForN32BitTcMask; + mFncSetPixel = SetPixelForN32BitTcMask; } break; @@ -419,26 +419,26 @@ void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc } void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline, - sal_uLong nSrcScanlineFormat, sal_uLong nSrcScanlineSize ) + ScanlineFormat nSrcScanlineFormat, sal_uLong nSrcScanlineSize ) { - const sal_uLong nFormat = BMP_SCANLINE_FORMAT( nSrcScanlineFormat ); + const ScanlineFormat nFormat = RemoveScanline( nSrcScanlineFormat ); assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination out of range!"); - DBG_ASSERT( ( HasPalette() && nFormat <= BMP_FORMAT_8BIT_PAL ) || - ( !HasPalette() && nFormat > BMP_FORMAT_8BIT_PAL ), + DBG_ASSERT( ( HasPalette() && nFormat <= ScanlineFormat::N8BitPal ) || + ( !HasPalette() && nFormat > ScanlineFormat::N8BitPal ), "No copying possible between palette and non palette scanlines!" ); const sal_uLong nCount = std::min( GetScanlineSize(), nSrcScanlineSize ); if( nCount ) { - if( GetScanlineFormat() == BMP_SCANLINE_FORMAT( nSrcScanlineFormat ) ) + if( GetScanlineFormat() == RemoveScanline( nSrcScanlineFormat ) ) memcpy( mpScanBuf[ nY ], aSrcScanline, nCount ); else { - DBG_ASSERT( 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, + DBG_ASSERT( nFormat != ScanlineFormat::N8BitTcMask && + nFormat != ScanlineFormat::N16BitTcMsbMask && nFormat != ScanlineFormat::N16BitTcLsbMask && + nFormat != ScanlineFormat::N24BitTcMask && nFormat != ScanlineFormat::N32BitTcMask, "No support for pixel formats with color masks yet!" ); // TODO: use fastbmp infrastructure @@ -446,22 +446,22 @@ void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline, switch( nFormat ) { - case BMP_FORMAT_1BIT_MSB_PAL: pFncGetPixel = GetPixelFor_1BIT_MSB_PAL; break; - case BMP_FORMAT_1BIT_LSB_PAL: pFncGetPixel = GetPixelFor_1BIT_LSB_PAL; break; - case BMP_FORMAT_4BIT_MSN_PAL: pFncGetPixel = GetPixelFor_4BIT_MSN_PAL; break; - case BMP_FORMAT_4BIT_LSN_PAL: pFncGetPixel = GetPixelFor_4BIT_LSN_PAL; break; - case BMP_FORMAT_8BIT_PAL: pFncGetPixel = GetPixelFor_8BIT_PAL; break; - case BMP_FORMAT_8BIT_TC_MASK: pFncGetPixel = GetPixelFor_8BIT_TC_MASK; break; - case BMP_FORMAT_16BIT_TC_MSB_MASK: pFncGetPixel = GetPixelFor_16BIT_TC_MSB_MASK; break; - case BMP_FORMAT_16BIT_TC_LSB_MASK: pFncGetPixel = GetPixelFor_16BIT_TC_LSB_MASK; break; - case BMP_FORMAT_24BIT_TC_BGR: pFncGetPixel = GetPixelFor_24BIT_TC_BGR; break; - case BMP_FORMAT_24BIT_TC_RGB: pFncGetPixel = GetPixelFor_24BIT_TC_RGB; break; - case BMP_FORMAT_24BIT_TC_MASK: pFncGetPixel = GetPixelFor_24BIT_TC_MASK; break; - case BMP_FORMAT_32BIT_TC_ABGR: pFncGetPixel = GetPixelFor_32BIT_TC_ABGR; break; - case BMP_FORMAT_32BIT_TC_ARGB: pFncGetPixel = GetPixelFor_32BIT_TC_ARGB; break; - case BMP_FORMAT_32BIT_TC_BGRA: pFncGetPixel = GetPixelFor_32BIT_TC_BGRA; break; - case BMP_FORMAT_32BIT_TC_RGBA: pFncGetPixel = GetPixelFor_32BIT_TC_RGBA; break; - case BMP_FORMAT_32BIT_TC_MASK: pFncGetPixel = GetPixelFor_32BIT_TC_MASK; break; + case ScanlineFormat::N1BitMsbPal: pFncGetPixel = GetPixelForN1BitMsbPal; break; + case ScanlineFormat::N1BitLsbPal: pFncGetPixel = GetPixelForN1BitLsbPal; break; + case ScanlineFormat::N4BitMsnPal: pFncGetPixel = GetPixelForN4BitMsnPal; break; + case ScanlineFormat::N4BitLsnPal: pFncGetPixel = GetPixelForN4BitLsnPal; break; + case ScanlineFormat::N8BitPal: pFncGetPixel = GetPixelForN8BitPal; break; + case ScanlineFormat::N8BitTcMask: pFncGetPixel = GetPixelForN8BitTcMask; break; + case ScanlineFormat::N16BitTcMsbMask: pFncGetPixel = GetPixelForN16BitTcMsbMask; break; + case ScanlineFormat::N16BitTcLsbMask: pFncGetPixel = GetPixelForN16BitTcLsbMask; break; + case ScanlineFormat::N24BitTcBgr: pFncGetPixel = GetPixelForN24BitTcBgr; break; + case ScanlineFormat::N24BitTcRgb: pFncGetPixel = GetPixelForN24BitTcRgb; break; + case ScanlineFormat::N24BitTcMask: pFncGetPixel = GetPixelForN24BitTcMask; break; + case ScanlineFormat::N32BitTcAbgr: pFncGetPixel = GetPixelForN32BitTcAbgr; break; + case ScanlineFormat::N32BitTcArgb: pFncGetPixel = GetPixelForN32BitTcArgb; break; + case ScanlineFormat::N32BitTcBgra: pFncGetPixel = GetPixelForN32BitTcBgra; break; + case ScanlineFormat::N32BitTcRgba: pFncGetPixel = GetPixelForN32BitTcRgba; break; + case ScanlineFormat::N32BitTcMask: pFncGetPixel = GetPixelForN32BitTcMask; break; default: pFncGetPixel = nullptr; diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx index 9d44750..089a246 100644 --- a/vcl/source/gdi/bmpacc2.cxx +++ b/vcl/source/gdi/bmpacc2.cxx @@ -20,12 +20,12 @@ #include <vcl/salbtype.hxx> #include <vcl/bitmapaccess.hxx> -BitmapColor BitmapReadAccess::GetPixelFor_1BIT_MSB_PAL(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN1BitMsbPal(ConstScanline pScanline, long nX, const ColorMask&) { return BitmapColor( pScanline[ nX >> 3 ] & ( 1 << ( 7 - ( nX & 7 ) ) ) ? 1 : 0 ); } -void BitmapReadAccess::SetPixelFor_1BIT_MSB_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN1BitMsbPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { sal_uInt8& rByte = pScanline[ nX >> 3 ]; @@ -33,12 +33,12 @@ void BitmapReadAccess::SetPixelFor_1BIT_MSB_PAL(Scanline pScanline, long nX, con ( rByte &= ~( 1 << ( 7 - ( nX & 7 ) ) ) ); } -BitmapColor BitmapReadAccess::GetPixelFor_1BIT_LSB_PAL(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN1BitLsbPal(ConstScanline pScanline, long nX, const ColorMask&) { return BitmapColor( pScanline[ nX >> 3 ] & ( 1 << ( nX & 7 ) ) ? 1 : 0 ); } -void BitmapReadAccess::SetPixelFor_1BIT_LSB_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN1BitLsbPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { sal_uInt8& rByte = pScanline[ nX >> 3 ]; @@ -46,12 +46,12 @@ void BitmapReadAccess::SetPixelFor_1BIT_LSB_PAL(Scanline pScanline, long nX, con ( rByte &= ~( 1 << ( nX & 7 ) ) ); } -BitmapColor BitmapReadAccess::GetPixelFor_4BIT_MSN_PAL(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN4BitMsnPal(ConstScanline pScanline, long nX, const ColorMask&) { return BitmapColor( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 0 : 4 ) ) & 0x0f ); } -void BitmapReadAccess::SetPixelFor_4BIT_MSN_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN4BitMsnPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { sal_uInt8& rByte = pScanline[ nX >> 1 ]; @@ -59,12 +59,12 @@ void BitmapReadAccess::SetPixelFor_4BIT_MSN_PAL(Scanline pScanline, long nX, con ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) ); } -BitmapColor BitmapReadAccess::GetPixelFor_4BIT_LSN_PAL(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN4BitLsnPal(ConstScanline pScanline, long nX, const ColorMask&) { return BitmapColor( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 4 : 0 ) ) & 0x0f ); } -void BitmapReadAccess::SetPixelFor_4BIT_LSN_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN4BitLsnPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { sal_uInt8& rByte = pScanline[ nX >> 1 ]; @@ -72,12 +72,12 @@ void BitmapReadAccess::SetPixelFor_4BIT_LSN_PAL(Scanline pScanline, long nX, con ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) ); } -BitmapColor BitmapReadAccess::GetPixelFor_8BIT_PAL(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN8BitPal(ConstScanline pScanline, long nX, const ColorMask&) { return BitmapColor( pScanline[ nX ] ); } -void BitmapReadAccess::SetPixelFor_8BIT_PAL(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN8BitPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { if (rBitmapColor.IsIndex()) pScanline[ nX ] = rBitmapColor.GetIndex(); @@ -86,44 +86,44 @@ void BitmapReadAccess::SetPixelFor_8BIT_PAL(Scanline pScanline, long nX, const B pScanline[ nX ] = rBitmapColor.GetBlueOrIndex(); } -BitmapColor BitmapReadAccess::GetPixelFor_8BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask) +BitmapColor BitmapReadAccess::GetPixelForN8BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask) { BitmapColor aColor; rMask.GetColorFor8Bit( aColor, pScanline + nX ); return aColor; } -void BitmapReadAccess::SetPixelFor_8BIT_TC_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) +void BitmapReadAccess::SetPixelForN8BitTcMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) { rMask.SetColorFor8Bit( rBitmapColor, pScanline + nX ); } -BitmapColor BitmapReadAccess::GetPixelFor_16BIT_TC_MSB_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask) +BitmapColor BitmapReadAccess::GetPixelForN16BitTcMsbMask(ConstScanline pScanline, long nX, const ColorMask& rMask) { BitmapColor aColor; rMask.GetColorFor16BitMSB( aColor, pScanline + ( nX << 1UL ) ); return aColor; } -void BitmapReadAccess::SetPixelFor_16BIT_TC_MSB_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) +void BitmapReadAccess::SetPixelForN16BitTcMsbMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) { rMask.SetColorFor16BitMSB( rBitmapColor, pScanline + ( nX << 1UL ) ); } -BitmapColor BitmapReadAccess::GetPixelFor_16BIT_TC_LSB_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask) +BitmapColor BitmapReadAccess::GetPixelForN16BitTcLsbMask(ConstScanline pScanline, long nX, const ColorMask& rMask) { BitmapColor aColor; rMask.GetColorFor16BitLSB( aColor, pScanline + ( nX << 1UL ) ); return aColor; } -void BitmapReadAccess::SetPixelFor_16BIT_TC_LSB_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) +void BitmapReadAccess::SetPixelForN16BitTcLsbMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) { rMask.SetColorFor16BitLSB( rBitmapColor, pScanline + ( nX << 1UL ) ); } -BitmapColor BitmapReadAccess::GetPixelFor_24BIT_TC_BGR(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN24BitTcBgr(ConstScanline pScanline, long nX, const ColorMask&) { BitmapColor aBitmapColor; @@ -134,14 +134,14 @@ BitmapColor BitmapReadAccess::GetPixelFor_24BIT_TC_BGR(ConstScanline pScanline, return aBitmapColor; } -void BitmapReadAccess::SetPixelFor_24BIT_TC_BGR(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN24BitTcBgr(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetBlue(); *pScanline++ = rBitmapColor.GetGreen(); *pScanline = rBitmapColor.GetRed(); } -BitmapColor BitmapReadAccess::GetPixelFor_24BIT_TC_RGB(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN24BitTcRgb(ConstScanline pScanline, long nX, const ColorMask&) { BitmapColor aBitmapColor; @@ -152,26 +152,26 @@ BitmapColor BitmapReadAccess::GetPixelFor_24BIT_TC_RGB(ConstScanline pScanline, return aBitmapColor; } -void BitmapReadAccess::SetPixelFor_24BIT_TC_RGB(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN24BitTcRgb(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetRed(); *pScanline++ = rBitmapColor.GetGreen(); *pScanline = rBitmapColor.GetBlue(); } -BitmapColor BitmapReadAccess::GetPixelFor_24BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask) +BitmapColor BitmapReadAccess::GetPixelForN24BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask) { BitmapColor aColor; rMask.GetColorFor24Bit( aColor, pScanline + nX * 3L ); return aColor; } -void BitmapReadAccess::SetPixelFor_24BIT_TC_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) +void BitmapReadAccess::SetPixelForN24BitTcMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) { rMask.SetColorFor24Bit( rBitmapColor, pScanline + nX * 3L ); } -BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_ABGR(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN32BitTcAbgr(ConstScanline pScanline, long nX, const ColorMask&) { BitmapColor aBitmapColor; @@ -182,7 +182,7 @@ BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_ABGR(ConstScanline pScanline, return aBitmapColor; } -void BitmapReadAccess::SetPixelFor_32BIT_TC_ABGR(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN32BitTcAbgr(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF; *pScanline++ = rBitmapColor.GetBlue(); @@ -190,7 +190,7 @@ void BitmapReadAccess::SetPixelFor_32BIT_TC_ABGR(Scanline pScanline, long nX, co *pScanline = rBitmapColor.GetRed(); } -BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_ARGB(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN32BitTcArgb(ConstScanline pScanline, long nX, const ColorMask&) { BitmapColor aBitmapColor; @@ -201,7 +201,7 @@ BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_ARGB(ConstScanline pScanline, return aBitmapColor; } -void BitmapReadAccess::SetPixelFor_32BIT_TC_ARGB(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN32BitTcArgb(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF; *pScanline++ = rBitmapColor.GetRed(); @@ -209,7 +209,7 @@ void BitmapReadAccess::SetPixelFor_32BIT_TC_ARGB(Scanline pScanline, long nX, co *pScanline = rBitmapColor.GetBlue(); } -BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_BGRA(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN32BitTcBgra(ConstScanline pScanline, long nX, const ColorMask&) { BitmapColor aBitmapColor; @@ -220,7 +220,7 @@ BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_BGRA(ConstScanline pScanline, return aBitmapColor; } -void BitmapReadAccess::SetPixelFor_32BIT_TC_BGRA(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN32BitTcBgra(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetBlue(); *pScanline++ = rBitmapColor.GetGreen(); @@ -228,7 +228,7 @@ void BitmapReadAccess::SetPixelFor_32BIT_TC_BGRA(Scanline pScanline, long nX, co *pScanline = 0xFF; } -BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_RGBA(ConstScanline pScanline, long nX, const ColorMask&) +BitmapColor BitmapReadAccess::GetPixelForN32BitTcRgba(ConstScanline pScanline, long nX, const ColorMask&) { BitmapColor aBitmapColor; @@ -239,7 +239,7 @@ BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_RGBA(ConstScanline pScanline, return aBitmapColor; } -void BitmapReadAccess::SetPixelFor_32BIT_TC_RGBA(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) +void BitmapReadAccess::SetPixelForN32BitTcRgba(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&) { *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetRed(); *pScanline++ = rBitmapColor.GetGreen(); @@ -247,14 +247,14 @@ void BitmapReadAccess::SetPixelFor_32BIT_TC_RGBA(Scanline pScanline, long nX, co *pScanline = 0xFF; } -BitmapColor BitmapReadAccess::GetPixelFor_32BIT_TC_MASK(ConstScanline pScanline, long nX, const ColorMask& rMask) +BitmapColor BitmapReadAccess::GetPixelForN32BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask) { BitmapColor aColor; rMask.GetColorFor32Bit( aColor, pScanline + ( nX << 2UL ) ); return aColor; } -void BitmapReadAccess::SetPixelFor_32BIT_TC_MASK(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) +void BitmapReadAccess::SetPixelForN32BitTcMask(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask) { rMask.SetColorFor32Bit( rBitmapColor, pScanline + ( nX << 2UL ) ); } diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx index e912310..6dd2c96 100644 --- a/vcl/source/gdi/bmpfast.cxx +++ b/vcl/source/gdi/bmpfast.cxx @@ -39,7 +39,7 @@ protected: PIXBYTE* mpPixel; }; -template <sal_uLong PIXFMT> +template <ScanlineFormat PIXFMT> class TrueColorPixelPtr : public BasePixelPtr { public: @@ -54,7 +54,7 @@ public: // template specializations for truecolor pixel formats template <> -class TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_RGB> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N24BitTcRgb> : public BasePixelPtr { public: void operator++() { mpPixel += 3; } @@ -74,7 +74,7 @@ public: }; template <> -class TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_BGR> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N24BitTcBgr> : public BasePixelPtr { public: void operator++() { mpPixel += 3; } @@ -94,7 +94,7 @@ public: }; template <> -class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_ARGB> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N32BitTcArgb> : public BasePixelPtr { public: void operator++() { mpPixel += 4; } @@ -114,7 +114,7 @@ public: }; template <> -class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_ABGR> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N32BitTcAbgr> : public BasePixelPtr { public: void operator++() { mpPixel += 4; } @@ -134,7 +134,7 @@ public: }; template <> -class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_RGBA> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N32BitTcRgba> : public BasePixelPtr { public: void operator++() { mpPixel += 4; } @@ -154,7 +154,7 @@ public: }; template <> -class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_BGRA> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N32BitTcBgra> : public BasePixelPtr { public: void operator++() { mpPixel += 4; } @@ -174,7 +174,7 @@ public: }; template <> -class TrueColorPixelPtr<BMP_FORMAT_16BIT_TC_MSB_MASK> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N16BitTcMsbMask> : public BasePixelPtr { public: void operator++() { mpPixel += 2; } @@ -194,7 +194,7 @@ public: }; template <> -class TrueColorPixelPtr<BMP_FORMAT_16BIT_TC_LSB_MASK> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N16BitTcLsbMask> : public BasePixelPtr { public: void operator++() { mpPixel += 2; } @@ -214,7 +214,7 @@ public: }; template <> -class TrueColorPixelPtr<BMP_FORMAT_8BIT_TC_MASK> : public BasePixelPtr +class TrueColorPixelPtr<ScanlineFormat::N8BitTcMask> : public BasePixelPtr { public: void operator++() { mpPixel += 1; } @@ -222,15 +222,15 @@ public: void SetAlpha( PIXBYTE a ) const { mpPixel[0] = a; } }; -// TODO: for some reason many Alpha maps are BMP_FORMAT_8BIT_PAL -// they should be BMP_FORMAT_8BIT_TC_MASK +// TODO: for some reason many Alpha maps are ScanlineFormat::N8BitPal +// they should be ScanlineFormat::N8BitTcMask template <> -class TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL> -: public TrueColorPixelPtr<BMP_FORMAT_8BIT_TC_MASK> +class TrueColorPixelPtr<ScanlineFormat::N8BitPal> +: public TrueColorPixelPtr<ScanlineFormat::N8BitTcMask> {}; // converting truecolor formats -template <sal_uLong SRCFMT, sal_uLong DSTFMT> +template <ScanlineFormat SRCFMT, ScanlineFormat DSTFMT> inline void ImplConvertPixel( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc ) { @@ -239,9 +239,9 @@ inline void ImplConvertPixel( const TrueColorPixelPtr<DSTFMT>& rDst, } template <> -inline void ImplConvertPixel<BMP_FORMAT_16BIT_TC_LSB_MASK, BMP_FORMAT_16BIT_TC_MSB_MASK> ( - const TrueColorPixelPtr<BMP_FORMAT_16BIT_TC_MSB_MASK>& rDst, - const TrueColorPixelPtr<BMP_FORMAT_16BIT_TC_LSB_MASK>& rSrc ) +inline void ImplConvertPixel<ScanlineFormat::N16BitTcLsbMask, ScanlineFormat::N16BitTcMsbMask> ( + const TrueColorPixelPtr<ScanlineFormat::N16BitTcMsbMask>& rDst, + const TrueColorPixelPtr<ScanlineFormat::N16BitTcLsbMask>& rSrc ) { // byte swapping const PIXBYTE* pSrc = rSrc.GetRawPtr(); @@ -250,7 +250,7 @@ inline void ImplConvertPixel<BMP_FORMAT_16BIT_TC_LSB_MASK, BMP_FORMAT_16BIT_TC_M pDst[0] = pSrc[1]; } -template <sal_uLong SRCFMT, sal_uLong DSTFMT> +template <ScanlineFormat SRCFMT, ScanlineFormat DSTFMT> inline void ImplConvertLine( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc, int nPixelCount ) { @@ -265,7 +265,7 @@ inline void ImplConvertLine( const TrueColorPixelPtr<DSTFMT>& rDst, } // alpha blending truecolor pixels -template <sal_uLong SRCFMT, sal_uLong DSTFMT> +template <ScanlineFormat SRCFMT, ScanlineFormat DSTFMT> inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal ) { @@ -292,7 +292,7 @@ inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst, } } -template <sal_uLong MASKFMT, sal_uLong SRCFMT, sal_uLong DSTFMT> +template <ScanlineFormat MASKFMT, ScanlineFormat SRCFMT, ScanlineFormat DSTFMT> inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst, const TrueColorPixelPtr<SRCFMT>& rSrc, const TrueColorPixelPtr<MASKFMT>& rMsk, int nPixelCount ) @@ -318,7 +318,7 @@ static bool ImplCopyImage( BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuf PIXBYTE* pRawDst = rDstBuffer.mpBits; // source and destination don't match upside down - if( BMP_FORMAT_TOP_DOWN & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) ) + if( ScanlineFormat::TopDown & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) ) { pRawDst += (rSrcBuffer.mnHeight - 1) * nDstLinestep; nDstLinestep = -rDstBuffer.mnScanlineSize; @@ -343,7 +343,7 @@ static bool ImplCopyImage( BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuf return true; } -template <sal_uLong DSTFMT,sal_uLong SRCFMT> +template <ScanlineFormat DSTFMT,ScanlineFormat SRCFMT> bool ImplConvertToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer ) { @@ -358,7 +358,7 @@ bool ImplConvertToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, TrueColorPixelPtr<DSTFMT> aDstLine; aDstLine.SetRawPtr( rDstBuffer.mpBits ); // source and destination don't match upside down - if( BMP_FORMAT_TOP_DOWN & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) ) + if( ScanlineFormat::TopDown & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) ) { aDstLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nDstLinestep ); nDstLinestep = -nDstLinestep; @@ -374,55 +374,56 @@ bool ImplConvertToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, return true; } -template <sal_uLong SRCFMT> +template <ScanlineFormat SRCFMT> inline bool ImplConvertFromBitmap( BitmapBuffer& rDst, const BitmapBuffer& rSrc ) { TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits ); // select the matching instantiation for the destination's bitmap format - switch( rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN ) + switch( rDst.mnFormat & ~ScanlineFormat::TopDown ) { - case BMP_FORMAT_1BIT_MSB_PAL: - case BMP_FORMAT_1BIT_LSB_PAL: - case BMP_FORMAT_4BIT_MSN_PAL: - case BMP_FORMAT_4BIT_LSN_PAL: - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N1BitMsbPal: + case ScanlineFormat::N1BitLsbPal: + case ScanlineFormat::N4BitMsnPal: + case ScanlineFormat::N4BitLsnPal: + case ScanlineFormat::N8BitPal: break; - case BMP_FORMAT_8BIT_TC_MASK: -// return ImplConvertToBitmap<BMP_FORMAT_8BIT_TC_MASK>( aSrcType, rDst, rSrc ); - case BMP_FORMAT_24BIT_TC_MASK: -// return ImplConvertToBitmap<BMP_FORMAT_24BIT_TC_MASK>( aSrcType, rDst, rSrc ); - case BMP_FORMAT_32BIT_TC_MASK: -// return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_MASK>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N8BitTcMask: +// return ImplConvertToBitmap<ScanlineFormat::N8BitTcMask>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N24BitTcMask: +// return ImplConvertToBitmap<ScanlineFormat::N24BitTcMask>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N32BitTcMask: +// return ImplConvertToBitmap<ScanlineFormat::N32BitTcMask>( aSrcType, rDst, rSrc ); break; - case BMP_FORMAT_16BIT_TC_MSB_MASK: - return ImplConvertToBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( aSrcType, rDst, rSrc ); - case BMP_FORMAT_16BIT_TC_LSB_MASK: - return ImplConvertToBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N16BitTcMsbMask: + return ImplConvertToBitmap<ScanlineFormat::N16BitTcMsbMask>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N16BitTcLsbMask: + return ImplConvertToBitmap<ScanlineFormat::N16BitTcLsbMask>( aSrcType, rDst, rSrc ); - case BMP_FORMAT_24BIT_TC_BGR: - return ImplConvertToBitmap<BMP_FORMAT_24BIT_TC_BGR>( aSrcType, rDst, rSrc ); - case BMP_FORMAT_24BIT_TC_RGB: - return ImplConvertToBitmap<BMP_FORMAT_24BIT_TC_RGB>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N24BitTcBgr: + return ImplConvertToBitmap<ScanlineFormat::N24BitTcBgr>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N24BitTcRgb: + return ImplConvertToBitmap<ScanlineFormat::N24BitTcRgb>( aSrcType, rDst, rSrc ); - case BMP_FORMAT_32BIT_TC_ABGR: - return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_ABGR>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N32BitTcAbgr: + return ImplConvertToBitmap<ScanlineFormat::N32BitTcAbgr>( aSrcType, rDst, rSrc ); #ifdef FAST_ARGB_BGRA - case BMP_FORMAT_32BIT_TC_ARGB: - return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_ARGB>( aSrcType, rDst, rSrc ); - case BMP_FORMAT_32BIT_TC_BGRA: - return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_BGRA>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N32BitTcArgb: + return ImplConvertToBitmap<ScanlineFormat::N32BitTcArgb>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N32BitTcBgra: + return ImplConvertToBitmap<ScanlineFormat::N32BitTcBgra>( aSrcType, rDst, rSrc ); #endif - case BMP_FORMAT_32BIT_TC_RGBA: - return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_RGBA>( aSrcType, rDst, rSrc ); + case ScanlineFormat::N32BitTcRgba: + return ImplConvertToBitmap<ScanlineFormat::N32BitTcRgba>( aSrcType, rDst, rSrc ); + default: break; } static int nNotAccelerated = 0; SAL_WARN_IF( rSrc.mnWidth * rSrc.mnHeight >= 4000 && ++nNotAccelerated == 100, "vcl.gdi", - "ImplConvertFromBitmap for not accelerated case (" << std::hex << rSrc.mnFormat << "->" << rDst.mnFormat << ")" ); + "ImplConvertFromBitmap for not accelerated case (" << std::hex << (int)rSrc.mnFormat << "->" << (int)rDst.mnFormat << ")" ); return false; } @@ -437,7 +438,7 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc, return false; // vertical mirroring if( rTR.mnDestHeight < 0 ) - // TODO: rDst.mnFormat ^= BMP_FORMAT_TOP_DOWN; + // TODO: rDst.mnFormat ^= ScanlineFormat::TopDown; return false; // offseted conversion is not implemented yet @@ -464,16 +465,16 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc, if( rDst.mnHeight < rTR.mnDestY + rTR.mnDestHeight ) return false; - const sal_uLong nSrcFormat = rSrc.mnFormat & ~BMP_FORMAT_TOP_DOWN; - const sal_uLong nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN; + const ScanlineFormat nSrcFormat = rSrc.mnFormat & ~ScanlineFormat::TopDown; + const ScanlineFormat nDstFormat = rDst.mnFormat & ~ScanlineFormat::TopDown; // TODO: also implement conversions for 16bit colormasks with non-565 format - if( nSrcFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) ) + if( nSrcFormat & (ScanlineFormat::N16BitTcLsbMask | ScanlineFormat::N16BitTcMsbMask) ) if( rSrc.maColorMask.GetRedMask() != 0xF800 || rSrc.maColorMask.GetGreenMask()!= 0x07E0 || rSrc.maColorMask.GetBlueMask() != 0x001F ) return false; - if( nDstFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) ) + if( nDstFormat & (ScanlineFormat::N16BitTcLsbMask | ScanlineFormat::N16BitTcMsbMask) ) if( rDst.maColorMask.GetRedMask() != 0xF800 || rDst.maColorMask.GetGreenMask()!= 0x07E0 || rDst.maColorMask.GetBlueMask() != 0x001F ) @@ -491,63 +492,64 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc, // select the matching instantiation for the source's bitmap format switch( nSrcFormat ) { - case BMP_FORMAT_1BIT_MSB_PAL: - case BMP_FORMAT_1BIT_LSB_PAL: - case BMP_FORMAT_4BIT_MSN_PAL: - case BMP_FORMAT_4BIT_LSN_PAL: - case BMP_FORMAT_8BIT_PAL: + case ScanlineFormat::N1BitMsbPal: + case ScanlineFormat::N1BitLsbPal: + case ScanlineFormat::N4BitMsnPal: + case ScanlineFormat::N4BitLsnPal: + case ScanlineFormat::N8BitPal: break; - case BMP_FORMAT_8BIT_TC_MASK: -// return ImplConvertFromBitmap<BMP_FORMAT_8BIT_TC_MASK>( rDst, rSrc ); - case BMP_FORMAT_24BIT_TC_MASK: -// return ImplConvertFromBitmap<BMP_FORMAT_24BIT_TC_MASK>( rDst, rSrc ); - case BMP_FORMAT_32BIT_TC_MASK: -// return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_MASK>( rDst, rSrc ); + case ScanlineFormat::N8BitTcMask: +// return ImplConvertFromBitmap<ScanlineFormat::N8BitTcMask>( rDst, rSrc ); + case ScanlineFormat::N24BitTcMask: +// return ImplConvertFromBitmap<ScanlineFormat::N24BitTcMask>( rDst, rSrc ); + case ScanlineFormat::N32BitTcMask: +// return ImplConvertFromBitmap<ScanlineFormat::N32BitTcMask>( rDst, rSrc ); break; - case BMP_FORMAT_16BIT_TC_MSB_MASK: - return ImplConvertFromBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( rDst, rSrc ); - case BMP_FORMAT_16BIT_TC_LSB_MASK: - return ImplConvertFromBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( rDst, rSrc ); + case ScanlineFormat::N16BitTcMsbMask: + return ImplConvertFromBitmap<ScanlineFormat::N16BitTcMsbMask>( rDst, rSrc ); + case ScanlineFormat::N16BitTcLsbMask: + return ImplConvertFromBitmap<ScanlineFormat::N16BitTcLsbMask>( rDst, rSrc ); - case BMP_FORMAT_24BIT_TC_BGR: - return ImplConvertFromBitmap<BMP_FORMAT_24BIT_TC_BGR>( rDst, rSrc ); - case BMP_FORMAT_24BIT_TC_RGB: - return ImplConvertFromBitmap<BMP_FORMAT_24BIT_TC_RGB>( rDst, rSrc ); + case ScanlineFormat::N24BitTcBgr: + return ImplConvertFromBitmap<ScanlineFormat::N24BitTcBgr>( rDst, rSrc ); + case ScanlineFormat::N24BitTcRgb: + return ImplConvertFromBitmap<ScanlineFormat::N24BitTcRgb>( rDst, rSrc ); - case BMP_FORMAT_32BIT_TC_ABGR: - return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_ABGR>( rDst, rSrc ); + case ScanlineFormat::N32BitTcAbgr: + return ImplConvertFromBitmap<ScanlineFormat::N32BitTcAbgr>( rDst, rSrc ); #ifdef FAST_ARGB_BGRA - case BMP_FORMAT_32BIT_TC_ARGB: - return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_ARGB>( rDst, rSrc ); - case BMP_FORMAT_32BIT_TC_BGRA: - return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_BGRA>( rDst, rSrc ); + case ScanlineFormat::N32BitTcArgb: + return ImplConvertFromBitmap<ScanlineFormat::N32BitTcArgb>( rDst, rSrc ); + case ScanlineFormat::N32BitTcBgra: + return ImplConvertFromBitmap<ScanlineFormat::N32BitTcBgra>( rDst, rSrc ); #endif - case BMP_FORMAT_32BIT_TC_RGBA: - return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_RGBA>( rDst, rSrc ); + case ScanlineFormat::N32BitTcRgba: + return ImplConvertFromBitmap<ScanlineFormat::N32BitTcRgba>( rDst, rSrc ); + default: break; } static int nNotAccelerated = 0; SAL_WARN_IF( rSrc.mnWidth * rSrc.mnHeight >= 4000 && ++nNotAccelerated == 100, "vcl.gdi", - "ImplFastBitmapConversion for not accelerated case (" << std::hex << rSrc.mnFormat << "->" << rDst.mnFormat << ")" ); + "ImplFastBitmapConversion for not accelerated case (" << std::hex << (int)rSrc.mnFormat << "->" << (int)rDst.mnFormat << ")" ); return false; } -template <sal_uLong DSTFMT,sal_uLong SRCFMT> //,sal_uLong MSKFMT> +template <ScanlineFormat DSTFMT, ScanlineFormat SRCFMT> //,sal_uLong MSKFMT> bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer, const BitmapBuffer& rMskBuffer ) { - DBG_ASSERT( rMskBuffer.mnFormat == BMP_FORMAT_8BIT_PAL, "FastBmp BlendImage: unusual MSKFMT" ); + DBG_ASSERT( rMskBuffer.mnFormat == ScanlineFormat::N8BitPal, "FastBmp BlendImage: unusual MSKFMT" ); const int nSrcLinestep = rSrcBuffer.mnScanlineSize; int nMskLinestep = rMskBuffer.mnScanlineSize; int nDstLinestep = rDstBuffer.mnScanlineSize; - TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL> aMskLine; aMskLine.SetRawPtr( rMskBuffer.mpBits ); + TrueColorPixelPtr<ScanlineFormat::N8BitPal> aMskLine; aMskLine.SetRawPtr( rMskBuffer.mpBits ); TrueColorPixelPtr<DSTFMT> aDstLine; aDstLine.SetRawPtr( rDstBuffer.mpBits ); // special case for single line masks @@ -555,14 +557,14 @@ bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, nMskLinestep = 0; // source and mask don't match: upside down - if( (rSrcBuffer.mnFormat ^ rMskBuffer.mnFormat) & BMP_FORMAT_TOP_DOWN ) + if( (rSrcBuffer.mnFormat ^ rMskBuffer.mnFormat) & ScanlineFormat::TopDown ) { aMskLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nMskLinestep ); nMskLinestep = -nMskLinestep; } // source and destination don't match: upside down - if( (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) & BMP_FORMAT_TOP_DOWN ) + if( (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) & ScanlineFormat::TopDown ) { aDstLine.AddByteOffset( (rDstBuffer.mnHeight - 1) * nDstLinestep ); nDstLinestep = -nDstLinestep; @@ -582,84 +584,85 @@ bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, // some specializations to reduce the code size template <> -inline bool ImplBlendToBitmap<BMP_FORMAT_24BIT_TC_BGR,BMP_FORMAT_24BIT_TC_BGR>( - TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_BGR>&, +inline bool ImplBlendToBitmap<ScanlineFormat::N24BitTcBgr,ScanlineFormat::N24BitTcBgr>( + TrueColorPixelPtr<ScanlineFormat::N24BitTcBgr>&, BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer, const BitmapBuffer& rMskBuffer ) { - TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_RGB> aSrcType; aSrcType.SetRawPtr( rSrcBuffer.mpBits ); - return ImplBlendToBitmap<BMP_FORMAT_24BIT_TC_RGB>( aSrcType, rDstBuffer, rSrcBuffer, rMskBuffer ); + TrueColorPixelPtr<ScanlineFormat::N24BitTcRgb> aSrcType; aSrcType.SetRawPtr( rSrcBuffer.mpBits ); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits