diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2006-09-08 07:34:09 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2006-09-08 07:34:09 +0000 |
commit | c6395310af620ad7a42e2bae29349f3f432b3a48 (patch) | |
tree | cb93350a415942aeba88133f04e4df06f8878183 /vcl | |
parent | 335edf6b9837107b04c6a8de3c01b651bbef008a (diff) |
INTEGRATION: CWS pngperf (1.3.18); FILE MERGED
2006/08/21 10:48:51 hdu 1.3.18.5: #i67660# get rid of assertions about non-matching color format
2006/08/15 16:01:15 hdu 1.3.18.4: RESYNC: make wntmsci10.pro warning free after resync
2006/08/14 19:49:04 hdu 1.3.18.3: RESYNC: (1.4-1.5); FILE MERGED
2005/11/15 09:58:59 hdu 1.3.18.2: RESYNC: (1.3-1.4); FILE MERGED
2005/09/27 10:14:22 hdu 1.3.18.1: #i54953# implement fast bitmap buffer erase
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/bmpfast.cxx | 87 |
1 files changed, 84 insertions, 3 deletions
diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx index 2f6661d9b175..b7c5a467d4ea 100644 --- a/vcl/source/gdi/bmpfast.cxx +++ b/vcl/source/gdi/bmpfast.cxx @@ -4,9 +4,9 @@ * * $RCSfile: bmpfast.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: hr $ $Date: 2006-06-19 19:21:54 $ + * last change: $Author: vg $ $Date: 2006-09-08 08:34:09 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -41,7 +41,7 @@ #define _SOLAR__PRIVATE 1 #include <bmpacc.hxx> -//#define FAST_ARGB_BGRA +#define FAST_ARGB_BGRA #include <stdlib.h> static bool bDisableFastBitops = (getenv( "SAL_DISABLE_BITMAPS_OPTS" ) != NULL); @@ -946,6 +946,82 @@ bool ImplFastBitmapBlending( BitmapWriteAccess& rDstWA, return false; } +bool ImplFastEraseBitmap( BitmapBuffer& rDst, const BitmapColor& rColor ) +{ + if( bDisableFastBitops ) + return false; + + const ULONG nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN; + + // erasing a bitmap is often just a byte-wise memory fill + bool bByteFill = true; + BYTE nFillByte; + + switch( nDstFormat ) + { + case BMP_FORMAT_1BIT_MSB_PAL: + case BMP_FORMAT_1BIT_LSB_PAL: + nFillByte = rColor.GetIndex(); + nFillByte = static_cast<BYTE>( -(nFillByte & 1) ); // 0x00 or 0xFF + break; + case BMP_FORMAT_4BIT_MSN_PAL: + case BMP_FORMAT_4BIT_LSN_PAL: + nFillByte = rColor.GetIndex(); + nFillByte &= 0x0F; + nFillByte |= (nFillByte << 4); + break; + case BMP_FORMAT_8BIT_PAL: + case BMP_FORMAT_8BIT_TC_MASK: + nFillByte = rColor.GetIndex(); + break; + + case BMP_FORMAT_24BIT_TC_MASK: + case BMP_FORMAT_24BIT_TC_BGR: + case BMP_FORMAT_24BIT_TC_RGB: + nFillByte = rColor.GetRed(); + if( (nFillByte != rColor.GetGreen()) + || (nFillByte != rColor.GetBlue()) ) + bByteFill = false; + break; + + default: + bByteFill = false; + nFillByte = 0x00; + break; + } + + if( bByteFill ) + { + long nByteCount = rDst.mnHeight * rDst.mnScanlineSize; + rtl_fillMemory( rDst.mpBits, nByteCount, nFillByte ); + return true; + } + + // TODO: handle other bitmap formats + switch( nDstFormat ) + { + case BMP_FORMAT_32BIT_TC_MASK: + case BMP_FORMAT_16BIT_TC_MSB_MASK: + case BMP_FORMAT_16BIT_TC_LSB_MASK: + + case BMP_FORMAT_24BIT_TC_BGR: + case BMP_FORMAT_24BIT_TC_RGB: + + case BMP_FORMAT_32BIT_TC_ABGR: +#ifdef FAST_ARGB_BGRA + case BMP_FORMAT_32BIT_TC_ARGB: + case BMP_FORMAT_32BIT_TC_BGRA: +#endif + case BMP_FORMAT_32BIT_TC_RGBA: + break; + + default: + break; + } + + return false; +} + // ======================================================================= #else // NO_OPTIMIZED_BITMAP_ACCESS @@ -962,4 +1038,9 @@ bool ImplFastBitmapBlending( BitmapWriteAccess&, return false; } +bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& ) +{ + return false; +} + #endif |