Kaydet (Commit) 08cb6e93 authored tarafından Caolán McNamara's avatar Caolán McNamara

expand this 1980's shift-fest, torture-by-ternery and magic '3' into human

Change-Id: Ifb18d5fd0b330dde0edc428621af417ddc836b21
üst 5e5b90c1
......@@ -24,14 +24,20 @@
#include <tools/rc.hxx>
#include <vcl/region.hxx>
// predefines
class SvStream;
class BitmapEx;
class Bitmap;
// - Compression defines
#define COMPRESS_OWN ('S'|('D'<<8UL))
#define COMPRESS_NONE ( 0UL )
#define RLE_8 ( 1UL )
#define RLE_4 ( 2UL )
#define BITFIELDS ( 3UL )
#define ZCOMPRESS ( COMPRESS_OWN | 0x01000000UL ) /* == 'SD01' (binary) */
bool VCL_DLLPUBLIC ReadDIB( // ReadDIB(rBitmap, rIStm, true);
Bitmap& rTarget,
......
......@@ -856,15 +856,29 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt,
aMemStm.SeekRel( 8 );
aMemStm.ReadUInt32( nColsUsed );
nPalCount = ( nBitCount <= 8 ) ? ( nColsUsed ? nColsUsed : ( 1 << (sal_uInt32) nBitCount ) ) :
( ( 3 == nCompression ) ? 3 : 0 );
if (nBitCount <= 8)
{
if (nColsUsed)
nPalCount = nColsUsed;
else
nPalCount = 1 << (sal_uInt32)nBitCount;
}
else
{
if (nCompression == BITFIELDS)
nPalCount = 3;
else
nPalCount = 0;
}
sal_uInt32 nPalSize = nPalCount * 4;
m_rStm.Write( aMemStm.GetData(), nDIBSize );
const sal_uLong nEndPos = m_rStm.Tell();
m_rStm.Seek( nOffPos );
m_rStm.WriteUInt32( 80 ).WriteUInt32( nHeaderSize + ( nPalCount << 2 ) );
m_rStm.WriteUInt32( 80 + ( nHeaderSize + ( nPalCount << 2 ) ) ).WriteUInt32( nImageSize );
m_rStm.WriteUInt32( 80 ).WriteUInt32( nHeaderSize + nPalSize );
m_rStm.WriteUInt32( 80 + nHeaderSize + nPalSize ).WriteUInt32( nImageSize );
m_rStm.Seek( nEndPos );
ImplEndRecord();
......
......@@ -37,15 +37,6 @@
#define DIBINFOHEADERSIZE ( sizeof(DIBInfoHeader) )
#define DIBV5HEADERSIZE ( sizeof(DIBV5Header) )
// - Compression defines
#define COMPRESS_OWN ('S'|('D'<<8UL))
#define COMPRESS_NONE ( 0UL )
#define RLE_8 ( 1UL )
#define RLE_4 ( 2UL )
#define BITFIELDS ( 3UL )
#define ZCOMPRESS ( COMPRESS_OWN | 0x01000000UL ) /* == 'SD01' (binary) */
// - DIBInfoHeader and DIBV5Header
typedef sal_Int32 FXPT2DOT30;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment