os/graphics/fbs/fontandbitmapserver/inc/BITMAP.H
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#if !defined(__BITMAP_H__)
sl@0
    17
#define __BITMAP_H__
sl@0
    18
#if !defined(__E32STD_H__)
sl@0
    19
#include <e32std.h>
sl@0
    20
#endif
sl@0
    21
#if !defined(__F32FILE_H__)
sl@0
    22
#include <f32file.h>
sl@0
    23
#endif
sl@0
    24
#if !defined(__GDI_H__)
sl@0
    25
#include <gdi.h>
sl@0
    26
#endif
sl@0
    27
sl@0
    28
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
    29
#include <graphics/bitmapuid.h>
sl@0
    30
#endif
sl@0
    31
sl@0
    32
#ifdef _DEBUG
sl@0
    33
	#define SYMBIAN_DEBUG_FBS_LOCKHEAP
sl@0
    34
#endif
sl@0
    35
sl@0
    36
//Forward declarations
sl@0
    37
class CChunkPile;
sl@0
    38
class TCompressionBookMark;
sl@0
    39
class CFbsRasterizer;
sl@0
    40
sl@0
    41
/** 
sl@0
    42
Defines the types of file compression. 
sl@0
    43
@publishedAll
sl@0
    44
@released
sl@0
    45
*/
sl@0
    46
enum TBitmapfileCompression
sl@0
    47
	{
sl@0
    48
	/** Bitmap file is not compressed. */
sl@0
    49
	ENoBitmapCompression,
sl@0
    50
	/** File is compressed using run-length encoding compression. */
sl@0
    51
	EByteRLECompression,
sl@0
    52
	/** File is compressed using twelve bit run-length encoding compression. */
sl@0
    53
	ETwelveBitRLECompression,
sl@0
    54
	/** File is compressed using sixteen bit run-length encoding compression. */
sl@0
    55
	ESixteenBitRLECompression,
sl@0
    56
	/** File is compressed using twenty four bit run-length encoding compression. */
sl@0
    57
	ETwentyFourBitRLECompression,
sl@0
    58
	/** File is compressed using twenty four bit run-length encoding compression from 32-bit bitmap buffer. */
sl@0
    59
	EThirtyTwoUBitRLECompression,
sl@0
    60
	/** File is compressed using thirty two bit run-length encoding compression from 32-bit bitmap buffer. */
sl@0
    61
	EThirtyTwoABitRLECompression,
sl@0
    62
	/** File is compressed as a palette plus reduced bit-per-pixel.  Only applicable to bitmaps already loaded in RAM. */
sl@0
    63
	EGenericPaletteCompression,
sl@0
    64
	/** Extended bitmap. Data format is proprietary to licensee. */
sl@0
    65
	EProprietaryCompression,
sl@0
    66
	//Insert new enum items here!
sl@0
    67
	ERLECompressionLast = 255
sl@0
    68
	};
sl@0
    69
sl@0
    70
/** 
sl@0
    71
Defines the available file compression schemes. 
sl@0
    72
@publishedAll
sl@0
    73
@released
sl@0
    74
*/
sl@0
    75
enum TBitmapfileCompressionScheme
sl@0
    76
	{
sl@0
    77
	/** File is compressed using run-length encoding compression. */
sl@0
    78
	ERLECompression,
sl@0
    79
	/** File is compressed as a palette plus reduced bit-per-pixel. */
sl@0
    80
	EPaletteCompression,
sl@0
    81
	/** File is compressed as a palette plus reduced bit-per-pixel, with automatic fallback to RLE if bitmap is not suitable*/
sl@0
    82
	EPaletteCompressionWithRLEFallback
sl@0
    83
	};
sl@0
    84
sl@0
    85
/**
sl@0
    86
WARNING: Typedef for internal use ONLY. Compatibility is not guaranteed in future releases.
sl@0
    87
@publishedAll
sl@0
    88
@released
sl@0
    89
 */
sl@0
    90
typedef void (*TAssignFunction)(TUint8*& aDestPtr, TUint32 aColor);
sl@0
    91
/**
sl@0
    92
WARNING: Typedef for internal use ONLY. Compatibility is not guaranteed in future releases.
sl@0
    93
@publishedAll
sl@0
    94
@released
sl@0
    95
 */
sl@0
    96
typedef void (*TDecodeFunction)(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction);
sl@0
    97
sl@0
    98
/** 
sl@0
    99
Contains information about the bitmap when streaming bitmaps to stores. 
sl@0
   100
@publishedAll
sl@0
   101
@released
sl@0
   102
*/
sl@0
   103
class SEpocBitmapHeader
sl@0
   104
	{
sl@0
   105
public:
sl@0
   106
	inline SEpocBitmapHeader() :
sl@0
   107
		iBitmapSize(sizeof(SEpocBitmapHeader)),
sl@0
   108
		iStructSize(sizeof(SEpocBitmapHeader)),
sl@0
   109
		iSizeInPixels(0, 0),
sl@0
   110
		iSizeInTwips(0, 0),
sl@0
   111
		iBitsPerPixel(0),
sl@0
   112
		iColor(0),
sl@0
   113
		iPaletteEntries(0),
sl@0
   114
		iCompression(ENoBitmapCompression)
sl@0
   115
		{
sl@0
   116
		}
sl@0
   117
public:
sl@0
   118
	/** Defines whether bitmap is colour and if it comprises an alpha channel. */ 
sl@0
   119
	enum TColor 
sl@0
   120
		{
sl@0
   121
		/** Bitmap doesn't comprise color */
sl@0
   122
		ENoColor=0, 
sl@0
   123
		/** Bitmap comprises color */
sl@0
   124
		EColor=1, 
sl@0
   125
		/** Bitmap comprises color with alpha channel */
sl@0
   126
		EColorAlpha=2, 
sl@0
   127
		/** Bitmap comprises pre-multiplied colors with alpha channel */
sl@0
   128
		EColorAlphaPM=3,
sl@0
   129
		/** Unknown format */
sl@0
   130
		EColorUndefined=8
sl@0
   131
		};
sl@0
   132
public:
sl@0
   133
	/** The size of the bitmap data, in bytes. */
sl@0
   134
	TInt iBitmapSize;
sl@0
   135
	/** The size of the structure in which the bitmap data is stored. */
sl@0
   136
	TInt iStructSize;
sl@0
   137
	/** The size of the bitmap, in pixels. */
sl@0
   138
	TSize iSizeInPixels;
sl@0
   139
	/** The size of the bitmap, in twips. */
sl@0
   140
	TSize iSizeInTwips;
sl@0
   141
	/** The bitmap's number of bits per pixel */
sl@0
   142
	TInt iBitsPerPixel;
sl@0
   143
	/** Whether or not the bitmap is colour and comprises an alpha value. */
sl@0
   144
	TInt iColor;
sl@0
   145
	/** The number of entries in the bitmap's palette. */
sl@0
   146
	TInt iPaletteEntries;
sl@0
   147
	/** The type of compression used to store the bitmap. */
sl@0
   148
	TBitmapfileCompression iCompression;
sl@0
   149
	};
sl@0
   150
sl@0
   151
/**
sl@0
   152
WARNING: Class for internal use ONLY.  Compatibility is not guaranteed in future releases.
sl@0
   153
sl@0
   154
@publishedAll
sl@0
   155
@released 
sl@0
   156
 */
sl@0
   157
class TLineScanningPosition
sl@0
   158
	{
sl@0
   159
public:
sl@0
   160
	inline TLineScanningPosition(TUint32* aSrcDataPtr);
sl@0
   161
public:
sl@0
   162
	TUint8* iSrcDataPtr;
sl@0
   163
	TInt iCursorPos;
sl@0
   164
	HBufC8* iScanLineBuffer;
sl@0
   165
	CFbsRasterizer* const iRasterizer;
sl@0
   166
	};
sl@0
   167
sl@0
   168
class CShiftedFileStore;
sl@0
   169
sl@0
   170
/**
sl@0
   171
BitGdi bitmap class (pseudo-CXxx class).
sl@0
   172
WARNING: Class for internal use ONLY.  Compatibility is not guaranteed in future releases.
sl@0
   173
@released
sl@0
   174
*/
sl@0
   175
class CBitwiseBitmap
sl@0
   176
	{
sl@0
   177
	friend class CFbTop;
sl@0
   178
	friend class CFbClient;
sl@0
   179
	friend class CFbsBitmap;
sl@0
   180
	friend class CBitmapObject;
sl@0
   181
	friend class CFbsBitmapAsyncStreamer;
sl@0
   182
	friend class CFbsBackgroundCompression;
sl@0
   183
	friend class CleanupDelete<CBitwiseBitmap>;
sl@0
   184
public:
sl@0
   185
	IMPORT_C TUid Uid() const;
sl@0
   186
	IMPORT_C void ExternalizeL(RWriteStream& aStream,const CFbsBitmap& aHandleBitmap) const;
sl@0
   187
	IMPORT_C void ExternalizeRectangleL(RWriteStream& aStream,const TRect& aRect,const CFbsBitmap& aHandleBitmap) const;
sl@0
   188
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
   189
	IMPORT_C static void InternalizeHeaderL(RReadStream& aStream,SEpocBitmapHeader& aHeader);
sl@0
   190
	IMPORT_C TSize SizeInPixels() const;
sl@0
   191
	IMPORT_C TSize SizeInTwips() const;
sl@0
   192
	IMPORT_C TDisplayMode DisplayMode() const;
sl@0
   193
	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
sl@0
   194
	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
sl@0
   195
	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
sl@0
   196
	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
sl@0
   197
	IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPos,TUint32* aBase, CFbsRasterizer* aRasterizer) const;
sl@0
   198
	IMPORT_C TInt GetScanLinePtr(TUint32*& aSlptr, TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   199
	IMPORT_C TInt GetScanLinePtr(TUint32*& aSlptr, TInt& aLength, TPoint& aPixel,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   200
	IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   201
	IMPORT_C void GetScanLine(TUint32*& aSlptr, TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode) const;
sl@0
   202
	IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase) const;
sl@0
   203
	IMPORT_C void GetVerticalScanLine(TDes8& aBuf,TInt aX,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase, CFbsRasterizer* aRasterizer) const;
sl@0
   204
	IMPORT_C void StretchScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aClipStrchX,TInt aClipStrchLen,TInt aStretchLength,TInt aOrgX,TInt aOrgLen,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase) const;
sl@0
   205
	IMPORT_C void StretchScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aClipStrchX,TInt aClipStrchLen,TInt aStretchLength,TInt aOrgX,TInt aOrgLen,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   206
	IMPORT_C TUint32* ScanLineAddress(TUint32* aBase,TUint aY) const;
sl@0
   207
	IMPORT_C TBool IsMonochrome(TUint32* aBase) const;
sl@0
   208
	IMPORT_C TBool IsLargeBitmap() const;
sl@0
   209
	IMPORT_C TInt CompressData();
sl@0
   210
	IMPORT_C TInt CompressData(TBitmapfileCompressionScheme aScheme);
sl@0
   211
	IMPORT_C TInt CheckBackgroundCompressData();
sl@0
   212
	IMPORT_C void SetCompressionBookmark(TLineScanningPosition& aLineScanningPosition, TUint32* aBase, const CFbsBitmap* aFbsBitmap);
sl@0
   213
	IMPORT_C TInt HardwareBitmapHandle() const;
sl@0
   214
	IMPORT_C TBool IsCompressedInRAM() const;
sl@0
   215
	IMPORT_C TBool IsCompressed() const;
sl@0
   216
	IMPORT_C TInt DataStride() const;
sl@0
   217
	IMPORT_C SEpocBitmapHeader Header() const;
sl@0
   218
private:
sl@0
   219
	IMPORT_C void operator delete(TAny*);
sl@0
   220
	void operator delete(TAny*, TAny*) {}     // This function exists only to prevent a compiler warning
sl@0
   221
	IMPORT_C CBitwiseBitmap(RHeap* aHeap,CChunkPile* aPile);
sl@0
   222
	IMPORT_C ~CBitwiseBitmap();
sl@0
   223
	IMPORT_C void Reset();
sl@0
   224
	IMPORT_C TInt Construct(const TSize& aSize,TDisplayMode aDispMode,TUid aCreatorUid);
sl@0
   225
	IMPORT_C TInt ConstructExtended(const TSize& aSize, TDisplayMode aDispMode, TUid aType, TInt aDataSize);
sl@0
   226
	IMPORT_C void ConstructL(RFs& aFs,const TDesC& aFilename,TInt32 aId,TUint aFileOffset);
sl@0
   227
	IMPORT_C void ConstructL(RFile& aFile,TInt32 aId,TUint aFileOffset);
sl@0
   228
	IMPORT_C void ConstructL(CShiftedFileStore* aFileStore,TStreamId aStreamId);
sl@0
   229
	IMPORT_C TInt CopyData(const CBitwiseBitmap& aSourceBitmap);
sl@0
   230
private:
sl@0
   231
	void GenerateLineFromCompressedTwelveBitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   232
	void GenerateLineFromCompressedEightBitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   233
	TUint8 GetGrayPixelEx(TInt aX,TUint32* aScanLineAddress) const;
sl@0
   234
	TRgb GetRgbPixelEx(TInt aX,TUint32* aScanLineAddress) const;
sl@0
   235
	void GetRgbPixelExMany(TInt aX,TUint32* aScanlinePtr,TUint32* aDest,TInt aLength) const;
sl@0
   236
    void GetRgbPixelExMany16M(TInt aX,TUint32* aScanlinePtr,TUint8* aDest,TInt aLength) const;
sl@0
   237
    void GetRgbPixelExMany16MAP(TInt aX,TUint32* aScanlinePtr,TUint32* aDest,TInt aLength) const;
sl@0
   238
	void GetScanLineGray2(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TUint32* aScanlinePtr) const;
sl@0
   239
	void GetScanLineGray4(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TUint32* aScanlinePtr) const;
sl@0
   240
	void GetScanLineGray16(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   241
	void GetScanLineGray256(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   242
	void GetScanLineColor16(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   243
	void GetScanLineColor256(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   244
	void GetScanLineColor4K(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   245
	void GetScanLineColor64K(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   246
	void GetScanLineColor16M(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   247
	void GetScanLineColor16MU(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   248
	void GetScanLineColorRgb(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   249
	void GetScanLineExBits(TDes8& aBuf,TInt aX,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   250
	void GetScanLineExBytes(TDes8& aBuf,TInt aX,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   251
	void DoExternalizeDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const;
sl@0
   252
	void DoExternalizeByteDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const;
sl@0
   253
	void DoExternalizeTwelveBitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const;
sl@0
   254
	void DoExternalizeSixteenBitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const;
sl@0
   255
	void DoExternalizeTwentyFourBitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const;
sl@0
   256
	void DoExternalizeThirtyTwoUBitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const;
sl@0
   257
	void DoExternalizeThirtyTwoABitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const;
sl@0
   258
	TInt SizeOfDataCompressed(TUint8* aData,TInt aSizeInBytes) const;
sl@0
   259
	TInt SizeOfByteDataCompressed(TUint8* aData,TInt aSizeInBytes) const;
sl@0
   260
	TInt SizeOfTwelveBitDataCompressed(TUint8* aData,TInt aSizeInBytes) const;
sl@0
   261
	TInt SizeOfSixteenBitDataCompressed(TUint8* aData,TInt aSizeInBytes) const;
sl@0
   262
	TInt SizeOfTwentyFourBitDataCompressed(TUint8* aData,TInt aSizeInBytes) const;
sl@0
   263
	TInt SizeOfThirtyTwoUBitDataCompressed(TUint8* aData,TInt aSizeInBytes) const;
sl@0
   264
	TInt SizeOfThirtyTwoABitDataCompressed(TUint8* aData,TInt aSizeInBytes) const;
sl@0
   265
	TBool TrueColorPointerCompare(TUint8* aColorPointer,TUint8 aComponent1,TUint8 aComponent2,TUint8 aComponent3) const;
sl@0
   266
	TBool ColorAlphaPointerCompare(TUint8* aColorPointer,TUint8 aComponent1,TUint8 aComponent2,TUint8 aComponent3,TUint8 aComponent4) const;
sl@0
   267
	void DoInternalizeL(RReadStream& aStream,TInt aSrceSize,TUint32* aBase);
sl@0
   268
	void DoInternalizeCompressedDataL(RReadStream& aStream,TInt aSrceSize,TUint32* aBase,TBitmapfileCompression aCompression);
sl@0
   269
	void DoDecompressByteData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize);
sl@0
   270
sl@0
   271
	void DoDecompressByteDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase);
sl@0
   272
	void DoDecompressTwelveBitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize);
sl@0
   273
	void DoDecompressTwelveBitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase);
sl@0
   274
	void DoDecompressSixteenBitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize);
sl@0
   275
	void DoDecompressSixteenBitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase);
sl@0
   276
	void DoDecompressTwentyFourBitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize);
sl@0
   277
	void DoDecompressTwentyFourBitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase);
sl@0
   278
	void DoDecompressThirtyTwoUBitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize);
sl@0
   279
	void DoDecompressThirtyTwoUBitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase);
sl@0
   280
	void DoDecompressThirtyTwoABitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize);
sl@0
   281
	void DoDecompressThirtyTwoABitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase);
sl@0
   282
	void DoStretchScanLine(TDes8& aBuf,TInt x,TInt y,TInt aClipStrchX,TInt aClipStrchLen,TInt aStretchLength,TInt aOrgX,TInt aOrgLen,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase,TLineScanningPosition& aLineScanningPosition) const;
sl@0
   283
	void DoCompressScanLine(TDes8& aBuf,TInt x,TInt y,TInt aClipStrchX,TInt aClipStrchLen,TInt aStretchLength,TInt aOrgX,TInt aOrgLen,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase,TLineScanningPosition& aLineScanningPosition) const;
sl@0
   284
	TUint32 HashTo1bpp(TUint32 aGray256,TBool aOddX,TBool aOddY) const;
sl@0
   285
	TUint32 HashTo2bpp(TUint32 aGray256,TInt aDitherIndex) const;
sl@0
   286
	TBool IsWordMonochrome(TUint32 aWord) const;
sl@0
   287
	TUint32* DataAddress() const;
sl@0
   288
	static void WhiteFill(TUint8* aData,TInt aDataSize,TDisplayMode aDispMode);
sl@0
   289
	static TInt ByteWidth(TInt aPixelWidth,TDisplayMode aDispMode);
sl@0
   290
	static TInt Bpp(TDisplayMode aDispMode);
sl@0
   291
	static TInt IsColor(TDisplayMode aDispMode);
sl@0
   292
	static TDisplayMode DisplayMode(TInt aBpp,TInt aColor);
sl@0
   293
	static TBitmapfileCompression CompressionType(TInt aBpp, TInt aColor);
sl@0
   294
	TInt DoGetScanLinePtr(TUint32*& aSlptr, TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   295
	void GenerateLineFromCompressedSixteenBitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   296
	TDisplayMode InitialDisplayMode() const;
sl@0
   297
	TInt SetDisplayMode(TDisplayMode aDisplayMode, TUint32* aDataAddress);
sl@0
   298
	TInt DisplayModeArgCheck(TDisplayMode aDisplayMode, TUint32* aDataAddress) const;
sl@0
   299
	void ChangeDisplayMode( TDisplayMode aNewDisplayMode,
sl@0
   300
							TInt aScanLineWidthNew,
sl@0
   301
							TUint8* aDataAddrNew,
sl@0
   302
							TUint32* aDataAddress,
sl@0
   303
							TInt aYStart,
sl@0
   304
							TInt aYInc,
sl@0
   305
							TInt aYEnd);
sl@0
   306
	void UpdateBitmapProperties(TDisplayMode aNewDisplayMode);
sl@0
   307
	TInt SwapWidthAndHeight(TUint32* aDataAddress);	
sl@0
   308
	void GenerateLineFromCompressed24BitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   309
	void GenerateLineFromCompressed32UBitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   310
	void GenerateLineFromCompressed32ABitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   311
	void AdjustXCoord(TInt& aX) const;
sl@0
   312
	void GetLineScanPos(TLineScanningPosition& aLineScanPos, 
sl@0
   313
						const TCompressionBookMark*& aComprBookMark, 
sl@0
   314
						const TUint8* aBase) const;
sl@0
   315
	void UpdateBookMark(const TLineScanningPosition& aLineScanPos, 
sl@0
   316
						TCompressionBookMark* aComprBookMark, 
sl@0
   317
						const TUint8* aBase) const;
sl@0
   318
	void GetScanLineColor16MA(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   319
	void GetScanLineColor16MAP(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const;
sl@0
   320
	TInt PaletteCompress();
sl@0
   321
	void GenerateLineFromPaletteCompressedData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
sl@0
   322
	TUint PaletteBitsPerPixel(TInt aNumColors) const;
sl@0
   323
	TUint PaletteBytesPerPixel(TInt aBitsPerPixel) const;
sl@0
   324
	void PaletteDecodeAndAssignGeneric(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TUint aStartPixel, TUint aEndPixel, TUint aCompressedPixelsPerByte, TUint aCompressedBitsPerPixel) const;
sl@0
   325
	static void PaletteDecode1PixelPerByte(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction);
sl@0
   326
	static void PaletteDecode2PixelPerByte(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction);
sl@0
   327
	static void PaletteDecode4PixelPerByte(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction);
sl@0
   328
	static void PaletteDecode8PixelPerByte(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction);
sl@0
   329
	static void PaletteAssign16BitColor(TUint8*& aDestPtr, TUint32 aColor);
sl@0
   330
	static void PaletteAssign24BitColor(TUint8*& aDestPtr, TUint32 aColor);
sl@0
   331
	static void PaletteAssign32BitColor(TUint8*& aDestPtr, TUint32 aColor);
sl@0
   332
	void UpdatePaddingData(TUint32* aData);
sl@0
   333
	static void CheckHeaderIsValidL(const SEpocBitmapHeader& aHeader);
sl@0
   334
	static TInt CompressedFormatInfo(TDisplayMode aDispMode, TInt& aBytesPerPack, TInt& aBytesPerCompressed);
sl@0
   335
	static void BitmapFill32(TUint32* aDestPtr32, TInt aCount, TUint32 aValue32);
sl@0
   336
	static inline void BitmapFill16(TUint16* aDestPtr16, TInt aCount, TUint16 aValue16);
sl@0
   337
private:
sl@0
   338
	struct TExtra
sl@0
   339
		{
sl@0
   340
#ifdef SYMBIAN_DEBUG_FBS_LOCKHEAP
sl@0
   341
		TInt iLockCount; // number of calls to CFbsBitmap::LockHeap() not balanced by calls to CFbsBitmap::UnlockHeap()
sl@0
   342
		TThreadId iThreadId; // id of thread that called CFbsBitmap::LockHeap() if any
sl@0
   343
#endif
sl@0
   344
		TInt64 iSerialNumber; // serial number of bitmap which is unique to the whole FBServ
sl@0
   345
		TInt iTouchCount; // number of calls to TouchBitmap()i.e. number of times bitmap has been changed
sl@0
   346
		};
sl@0
   347
	inline TExtra* Extra() const; // only for bitmaps created in RAM
sl@0
   348
private:
sl@0
   349
	TUid iUid;
sl@0
   350
	struct TSettings
sl@0
   351
		{
sl@0
   352
		TSettings(TDisplayMode aDisplayMode);
sl@0
   353
		void SetDisplayModes(TDisplayMode aDisplayMode);
sl@0
   354
		void SetCurrentDisplayMode(TDisplayMode aDisplayMode);
sl@0
   355
		TDisplayMode CurrentDisplayMode() const;
sl@0
   356
		TDisplayMode InitialDisplayMode() const;
sl@0
   357
		inline void SetDirtyBitmap();
sl@0
   358
		inline TBool IsDirtyBitmap() const;
sl@0
   359
		inline void SetVolatileBitmap();
sl@0
   360
		inline TBool IsVolatileBitmap() const;
sl@0
   361
		enum
sl@0
   362
			{
sl@0
   363
			EBitmapFlagDirty = 0x00010000, // set in the old bitmap when a re-allocating operation has created a new bitmap
sl@0
   364
			EBitmapFlagVolatile = 0x00020000, // set when DataAddress() has been called but BeginDataAccess() has not
sl@0
   365
			};
sl@0
   366
		TUint32 iData;
sl@0
   367
		} iSettings;
sl@0
   368
	RHeap* iHeap;
sl@0
   369
	CChunkPile* iPile;
sl@0
   370
	TInt iByteWidth;
sl@0
   371
	SEpocBitmapHeader iHeader;
sl@0
   372
	TInt iSpare;
sl@0
   373
	TInt iDataOffset; // offset in bytes from "this" or from base of bitmap chunk, or hardware bitmap handle
sl@0
   374
	TBool iIsCompressedInRAM; //flag indicating whether CompressData has been called
sl@0
   375
	};
sl@0
   376
sl@0
   377
#endif