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