diff options
author | Kurt Zenker <kz@openoffice.org> | 2005-07-14 10:35:38 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2005-07-14 10:35:38 +0000 |
commit | 8db254a95f17b842d49d0b9f9b20d2cb531f91f4 (patch) | |
tree | 7ccab07fa68d906d43dfdbf7db814dbed592a213 /vcl/source | |
parent | 51da5cf4f1ad2b6959ed840d0e2d186142917723 (diff) |
INTEGRATION: CWS thb08 (1.6.376); FILE MERGED
2005/07/11 21:21:29 thb 1.6.376.1: #i51123# Handling the case of 32 bit bitmap formats correctly on BMP export.
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/bitmap2.cxx | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx index 30168671e8f6..252fc356be99 100644 --- a/vcl/source/gdi/bitmap2.cxx +++ b/vcl/source/gdi/bitmap2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bitmap2.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: rt $ $Date: 2004-06-17 12:14:50 $ + * last change: $Author: kz $ $Date: 2005-07-14 11:35:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,9 @@ #include <bitmap.hxx> #endif +#include <utility> + + // ----------- // - Defines - // ----------- @@ -721,7 +724,15 @@ BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompre default: { - aHeader.nBitCount = rAcc.GetBitCount(); + // #i5xxx# Limit bitcount to 24bit, the 32 bit cases are + // not handled properly below (would have to set color + // masks, and nCompression=BITFIELDS - but color mask is + // not set for formats != *_TC_*). Note that this very + // problem might cause trouble at other places - the + // introduction of 32 bit RGBA bitmaps is relatively + // recent. + aHeader.nBitCount = ::std::min( 24U, + (unsigned int)rAcc.GetBitCount() ); if( bCompressed ) { @@ -903,8 +914,16 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, } else if( !nCompression ) { - const ULONG nAlignedWidth = AlignedWidth4Bytes( rAcc.Width() * rAcc.GetBitCount() ); - BOOL bNative = FALSE; + // #i5xxx# Limit bitcount to 24bit, the 32 bit cases are not + // handled properly below (would have to set color masks, and + // nCompression=BITFIELDS - but color mask is not set for + // formats != *_TC_*). Note that this very problem might cause + // trouble at other places - the introduction of 32 bit RGBA + // bitmaps is relatively recent. + const USHORT nBitCount = ::std::min( 24U, + (unsigned int)rAcc.GetBitCount() ); + const ULONG nAlignedWidth = AlignedWidth4Bytes( rAcc.Width() * nBitCount); + BOOL bNative = FALSE; switch( rAcc.GetScanlineFormat() ) { @@ -934,7 +953,7 @@ BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, BYTE* pTmp; BYTE cTmp; - switch( rAcc.GetBitCount() ) + switch( nBitCount ) { case( 1 ): { |