diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-06-29 21:50:59 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-07-01 07:36:15 +0200 |
commit | 8663d81828541072999b26451f7d6e6bfcb5f951 (patch) | |
tree | 860b25d54b3ffab526dc0c0ff4c24ed5d1934fff /vcl/source/gdi/salmisc.cxx | |
parent | eb959d4a964e973ea1cf4b066f6007878c22fcf5 (diff) |
remove code duplication for BitmapReadAccess pixel functions
Change-Id: Ib243fea4276cfb86b4fdff8d0c84cea7c4523d82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97487
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source/gdi/salmisc.cxx')
-rw-r--r-- | vcl/source/gdi/salmisc.cxx | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index a6a5e36279a2..6f790f727ca6 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -26,11 +26,6 @@ #include <tools/helpers.hxx> #include <memory> -#define IMPL_CASE_GET_FORMAT( Format ) \ -case( ScanlineFormat::Format ): \ - pFncGetPixel = BitmapReadAccess::GetPixelFor##Format; \ -break - #define IMPL_CASE_SET_FORMAT( Format, BitCount ) \ case( ScanlineFormat::Format ): \ { \ @@ -270,29 +265,14 @@ std::unique_ptr<BitmapBuffer> StretchAndConvert( std::unique_ptr<BitmapBuffer> pDstBuffer(new BitmapBuffer); // set function for getting pixels - switch( RemoveScanline( rSrcBuffer.mnFormat ) ) - { - IMPL_CASE_GET_FORMAT( N1BitMsbPal ); - IMPL_CASE_GET_FORMAT( N1BitLsbPal ); - IMPL_CASE_GET_FORMAT( N4BitMsnPal ); - IMPL_CASE_GET_FORMAT( N4BitLsnPal ); - IMPL_CASE_GET_FORMAT( N8BitPal ); - IMPL_CASE_GET_FORMAT( N8BitTcMask ); - IMPL_CASE_GET_FORMAT( N24BitTcBgr ); - IMPL_CASE_GET_FORMAT( N24BitTcRgb ); - IMPL_CASE_GET_FORMAT( N32BitTcAbgr ); - IMPL_CASE_GET_FORMAT( N32BitTcArgb ); - IMPL_CASE_GET_FORMAT( N32BitTcBgra ); - IMPL_CASE_GET_FORMAT( N32BitTcRgba ); - IMPL_CASE_GET_FORMAT( N32BitTcMask ); - - default: - // should never come here - // initialize pFncGetPixel to something valid that is - // least likely to crash - pFncGetPixel = BitmapReadAccess::GetPixelForN1BitMsbPal; - OSL_FAIL( "unknown read format" ); - break; + pFncGetPixel = BitmapReadAccess::GetPixelFunction( rSrcBuffer.mnFormat ); + if( !pFncGetPixel ) + { + // should never come here + // initialize pFncGetPixel to something valid that is + // least likely to crash + pFncGetPixel = BitmapReadAccess::GetPixelForN1BitMsbPal; + OSL_FAIL( "unknown read format" ); } // set function for setting pixels |