diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2005-03-10 12:17:09 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2005-03-10 12:17:09 +0000 |
commit | ea2e320999fdf8d2029ca751bed0c922cb9dd5c2 (patch) | |
tree | 8ec03cfd39aa1b38bb9255791d9a7aea76c02a0a /vcl/source/gdi/salmisc.cxx | |
parent | 08e7b8198ecfe9b61b19ea5896db92594741e08c (diff) |
INTEGRATION: CWS presfixes01 (1.5.162); FILE MERGED
2005/02/10 13:38:49 hdu 1.5.162.3: #i42314# prepare more general operations in case they become perf critical
2005/02/09 13:39:14 hdu 1.5.162.2: #i42314# short circuit the most dominant bitmap conversions
2005/01/28 12:27:24 hdu 1.5.162.1: #i41536# get rid of redundant zeroing of bitmap memory
Diffstat (limited to 'vcl/source/gdi/salmisc.cxx')
-rw-r--r-- | vcl/source/gdi/salmisc.cxx | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index 1d7fa5841c42..f3d46ca7ee29 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salmisc.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: rt $ $Date: 2004-07-23 10:04:42 $ + * last change: $Author: vg $ $Date: 2005-03-10 13:17:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,6 +64,7 @@ #endif #include <bmpacc.hxx> #include <salbtype.hxx> +#include <bmpfast.hxx> // ----------- // - Defines - @@ -317,6 +318,8 @@ static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffe delete[] pColToPalMap; } +// ----------------------------------------------------------------------------- + // --------------------- // - StretchAndConvert - // --------------------- @@ -327,16 +330,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec FncGetPixel pFncGetPixel; FncSetPixel pFncSetPixel; BitmapBuffer* pDstBuffer = new BitmapBuffer; - const ULONG nDstScanlineFormat = BMP_SCANLINE_FORMAT( nDstBitmapFormat ); - const long nSrcX = rTwoRect.mnSrcX, nSrcY = rTwoRect.mnSrcY; - const long nSrcDX = rTwoRect.mnSrcWidth, nSrcDY = rTwoRect.mnSrcHeight; - const long nDstDX = rTwoRect.mnDestWidth, nDstDY = rTwoRect.mnDestHeight; - Scanline* pSrcScan = new Scanline[ rSrcBuffer.mnHeight ]; - Scanline* pDstScan = new Scanline[ nDstDY ]; - long* pMapX = new long[ nDstDX ]; - long* pMapY = new long[ nDstDY ]; - Scanline pTmpScan; - long i, nTmp, nOffset; + long i; // set function for getting pixels switch( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) ) @@ -368,6 +362,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec } // set function for setting pixels + const ULONG nDstScanlineFormat = BMP_SCANLINE_FORMAT( nDstBitmapFormat ); switch( nDstScanlineFormat ) { IMPL_CASE_SET_FORMAT( _1BIT_MSB_PAL, 1 ); @@ -399,11 +394,10 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec // fill destination buffer pDstBuffer->mnFormat = nDstBitmapFormat; - pDstBuffer->mnWidth = nDstDX; - pDstBuffer->mnHeight = nDstDY; - pDstBuffer->mnScanlineSize = AlignedWidth4Bytes( pDstBuffer->mnBitCount * nDstDX ); - pDstBuffer->mpBits = new BYTE[ pDstBuffer->mnScanlineSize * nDstDY ]; - rtl_zeroMemory( pDstBuffer->mpBits, pDstBuffer->mnScanlineSize * nDstDY ); + pDstBuffer->mnWidth = rTwoRect.mnDestWidth; + pDstBuffer->mnHeight = rTwoRect.mnDestHeight; + pDstBuffer->mnScanlineSize = AlignedWidth4Bytes( pDstBuffer->mnBitCount * pDstBuffer->mnWidth ); + pDstBuffer->mpBits = new BYTE[ pDstBuffer->mnScanlineSize * pDstBuffer->mnHeight ]; // do we need a destination palette or color mask? if( ( nDstScanlineFormat == BMP_FORMAT_1BIT_MSB_PAL ) || @@ -425,6 +419,20 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec pDstBuffer->maColorMask = *pDstMask; } + // short circuit the most important conversions + bool bFastConvert = ImplFastBitmapConversion( *pDstBuffer, rSrcBuffer, rTwoRect ); + if( bFastConvert ) + return pDstBuffer; + + const long nSrcX = rTwoRect.mnSrcX, nSrcY = rTwoRect.mnSrcY; + const long nSrcDX = rTwoRect.mnSrcWidth, nSrcDY = rTwoRect.mnSrcHeight; + const long nDstDX = rTwoRect.mnDestWidth, nDstDY = rTwoRect.mnDestHeight; + Scanline* pSrcScan = new Scanline[ rSrcBuffer.mnHeight ]; + Scanline* pDstScan = new Scanline[ nDstDY ]; + long* pMapX = new long[ nDstDX ]; + long* pMapY = new long[ nDstDY ]; + long nTmp, nOffset; + // horizontal mapping table if( nDstDX != nSrcDX ) { @@ -454,6 +462,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec } // source scanline buffer + Scanline pTmpScan; if( BMP_SCANLINE_ADJUSTMENT( rSrcBuffer.mnFormat ) == BMP_FORMAT_TOP_DOWN ) pTmpScan = rSrcBuffer.mpBits, nOffset = rSrcBuffer.mnScanlineSize; else |