sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #if !defined(__BITMAP_H__) sl@0: #define __BITMAP_H__ sl@0: #if !defined(__E32STD_H__) sl@0: #include sl@0: #endif sl@0: #if !defined(__F32FILE_H__) sl@0: #include sl@0: #endif sl@0: #if !defined(__GDI_H__) sl@0: #include sl@0: #endif sl@0: sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #endif sl@0: sl@0: #ifdef _DEBUG sl@0: #define SYMBIAN_DEBUG_FBS_LOCKHEAP sl@0: #endif sl@0: sl@0: //Forward declarations sl@0: class CChunkPile; sl@0: class TCompressionBookMark; sl@0: class CFbsRasterizer; sl@0: sl@0: /** sl@0: Defines the types of file compression. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: enum TBitmapfileCompression sl@0: { sl@0: /** Bitmap file is not compressed. */ sl@0: ENoBitmapCompression, sl@0: /** File is compressed using run-length encoding compression. */ sl@0: EByteRLECompression, sl@0: /** File is compressed using twelve bit run-length encoding compression. */ sl@0: ETwelveBitRLECompression, sl@0: /** File is compressed using sixteen bit run-length encoding compression. */ sl@0: ESixteenBitRLECompression, sl@0: /** File is compressed using twenty four bit run-length encoding compression. */ sl@0: ETwentyFourBitRLECompression, sl@0: /** File is compressed using twenty four bit run-length encoding compression from 32-bit bitmap buffer. */ sl@0: EThirtyTwoUBitRLECompression, sl@0: /** File is compressed using thirty two bit run-length encoding compression from 32-bit bitmap buffer. */ sl@0: EThirtyTwoABitRLECompression, sl@0: /** File is compressed as a palette plus reduced bit-per-pixel. Only applicable to bitmaps already loaded in RAM. */ sl@0: EGenericPaletteCompression, sl@0: /** Extended bitmap. Data format is proprietary to licensee. */ sl@0: EProprietaryCompression, sl@0: //Insert new enum items here! sl@0: ERLECompressionLast = 255 sl@0: }; sl@0: sl@0: /** sl@0: Defines the available file compression schemes. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: enum TBitmapfileCompressionScheme sl@0: { sl@0: /** File is compressed using run-length encoding compression. */ sl@0: ERLECompression, sl@0: /** File is compressed as a palette plus reduced bit-per-pixel. */ sl@0: EPaletteCompression, sl@0: /** File is compressed as a palette plus reduced bit-per-pixel, with automatic fallback to RLE if bitmap is not suitable*/ sl@0: EPaletteCompressionWithRLEFallback sl@0: }; sl@0: sl@0: /** sl@0: WARNING: Typedef for internal use ONLY. Compatibility is not guaranteed in future releases. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: typedef void (*TAssignFunction)(TUint8*& aDestPtr, TUint32 aColor); sl@0: /** sl@0: WARNING: Typedef for internal use ONLY. Compatibility is not guaranteed in future releases. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: typedef void (*TDecodeFunction)(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction); sl@0: sl@0: /** sl@0: Contains information about the bitmap when streaming bitmaps to stores. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class SEpocBitmapHeader sl@0: { sl@0: public: sl@0: inline SEpocBitmapHeader() : sl@0: iBitmapSize(sizeof(SEpocBitmapHeader)), sl@0: iStructSize(sizeof(SEpocBitmapHeader)), sl@0: iSizeInPixels(0, 0), sl@0: iSizeInTwips(0, 0), sl@0: iBitsPerPixel(0), sl@0: iColor(0), sl@0: iPaletteEntries(0), sl@0: iCompression(ENoBitmapCompression) sl@0: { sl@0: } sl@0: public: sl@0: /** Defines whether bitmap is colour and if it comprises an alpha channel. */ sl@0: enum TColor sl@0: { sl@0: /** Bitmap doesn't comprise color */ sl@0: ENoColor=0, sl@0: /** Bitmap comprises color */ sl@0: EColor=1, sl@0: /** Bitmap comprises color with alpha channel */ sl@0: EColorAlpha=2, sl@0: /** Bitmap comprises pre-multiplied colors with alpha channel */ sl@0: EColorAlphaPM=3, sl@0: /** Unknown format */ sl@0: EColorUndefined=8 sl@0: }; sl@0: public: sl@0: /** The size of the bitmap data, in bytes. */ sl@0: TInt iBitmapSize; sl@0: /** The size of the structure in which the bitmap data is stored. */ sl@0: TInt iStructSize; sl@0: /** The size of the bitmap, in pixels. */ sl@0: TSize iSizeInPixels; sl@0: /** The size of the bitmap, in twips. */ sl@0: TSize iSizeInTwips; sl@0: /** The bitmap's number of bits per pixel */ sl@0: TInt iBitsPerPixel; sl@0: /** Whether or not the bitmap is colour and comprises an alpha value. */ sl@0: TInt iColor; sl@0: /** The number of entries in the bitmap's palette. */ sl@0: TInt iPaletteEntries; sl@0: /** The type of compression used to store the bitmap. */ sl@0: TBitmapfileCompression iCompression; sl@0: }; sl@0: sl@0: /** sl@0: WARNING: Class for internal use ONLY. Compatibility is not guaranteed in future releases. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TLineScanningPosition sl@0: { sl@0: public: sl@0: inline TLineScanningPosition(TUint32* aSrcDataPtr); sl@0: public: sl@0: TUint8* iSrcDataPtr; sl@0: TInt iCursorPos; sl@0: HBufC8* iScanLineBuffer; sl@0: CFbsRasterizer* const iRasterizer; sl@0: }; sl@0: sl@0: class CShiftedFileStore; sl@0: sl@0: /** sl@0: BitGdi bitmap class (pseudo-CXxx class). sl@0: WARNING: Class for internal use ONLY. Compatibility is not guaranteed in future releases. sl@0: @released sl@0: */ sl@0: class CBitwiseBitmap sl@0: { sl@0: friend class CFbTop; sl@0: friend class CFbClient; sl@0: friend class CFbsBitmap; sl@0: friend class CBitmapObject; sl@0: friend class CFbsBitmapAsyncStreamer; sl@0: friend class CFbsBackgroundCompression; sl@0: friend class CleanupDelete; sl@0: public: sl@0: IMPORT_C TUid Uid() const; sl@0: IMPORT_C void ExternalizeL(RWriteStream& aStream,const CFbsBitmap& aHandleBitmap) const; sl@0: IMPORT_C void ExternalizeRectangleL(RWriteStream& aStream,const TRect& aRect,const CFbsBitmap& aHandleBitmap) const; sl@0: IMPORT_C void InternalizeL(RReadStream& aStream); sl@0: IMPORT_C static void InternalizeHeaderL(RReadStream& aStream,SEpocBitmapHeader& aHeader); sl@0: IMPORT_C TSize SizeInPixels() const; sl@0: IMPORT_C TSize SizeInTwips() const; sl@0: IMPORT_C TDisplayMode DisplayMode() const; sl@0: IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const; sl@0: IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const; sl@0: IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const; sl@0: IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const; sl@0: IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPos,TUint32* aBase, CFbsRasterizer* aRasterizer) const; sl@0: IMPORT_C TInt GetScanLinePtr(TUint32*& aSlptr, TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: IMPORT_C TInt GetScanLinePtr(TUint32*& aSlptr, TInt& aLength, TPoint& aPixel,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: 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: IMPORT_C void GetScanLine(TUint32*& aSlptr, TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode) const; sl@0: IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase) const; sl@0: IMPORT_C void GetVerticalScanLine(TDes8& aBuf,TInt aX,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase, CFbsRasterizer* aRasterizer) const; sl@0: 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: 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: IMPORT_C TUint32* ScanLineAddress(TUint32* aBase,TUint aY) const; sl@0: IMPORT_C TBool IsMonochrome(TUint32* aBase) const; sl@0: IMPORT_C TBool IsLargeBitmap() const; sl@0: IMPORT_C TInt CompressData(); sl@0: IMPORT_C TInt CompressData(TBitmapfileCompressionScheme aScheme); sl@0: IMPORT_C TInt CheckBackgroundCompressData(); sl@0: IMPORT_C void SetCompressionBookmark(TLineScanningPosition& aLineScanningPosition, TUint32* aBase, const CFbsBitmap* aFbsBitmap); sl@0: IMPORT_C TInt HardwareBitmapHandle() const; sl@0: IMPORT_C TBool IsCompressedInRAM() const; sl@0: IMPORT_C TBool IsCompressed() const; sl@0: IMPORT_C TInt DataStride() const; sl@0: IMPORT_C SEpocBitmapHeader Header() const; sl@0: private: sl@0: IMPORT_C void operator delete(TAny*); sl@0: void operator delete(TAny*, TAny*) {} // This function exists only to prevent a compiler warning sl@0: IMPORT_C CBitwiseBitmap(RHeap* aHeap,CChunkPile* aPile); sl@0: IMPORT_C ~CBitwiseBitmap(); sl@0: IMPORT_C void Reset(); sl@0: IMPORT_C TInt Construct(const TSize& aSize,TDisplayMode aDispMode,TUid aCreatorUid); sl@0: IMPORT_C TInt ConstructExtended(const TSize& aSize, TDisplayMode aDispMode, TUid aType, TInt aDataSize); sl@0: IMPORT_C void ConstructL(RFs& aFs,const TDesC& aFilename,TInt32 aId,TUint aFileOffset); sl@0: IMPORT_C void ConstructL(RFile& aFile,TInt32 aId,TUint aFileOffset); sl@0: IMPORT_C void ConstructL(CShiftedFileStore* aFileStore,TStreamId aStreamId); sl@0: IMPORT_C TInt CopyData(const CBitwiseBitmap& aSourceBitmap); sl@0: private: sl@0: void GenerateLineFromCompressedTwelveBitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: void GenerateLineFromCompressedEightBitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: TUint8 GetGrayPixelEx(TInt aX,TUint32* aScanLineAddress) const; sl@0: TRgb GetRgbPixelEx(TInt aX,TUint32* aScanLineAddress) const; sl@0: void GetRgbPixelExMany(TInt aX,TUint32* aScanlinePtr,TUint32* aDest,TInt aLength) const; sl@0: void GetRgbPixelExMany16M(TInt aX,TUint32* aScanlinePtr,TUint8* aDest,TInt aLength) const; sl@0: void GetRgbPixelExMany16MAP(TInt aX,TUint32* aScanlinePtr,TUint32* aDest,TInt aLength) const; sl@0: void GetScanLineGray2(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TUint32* aScanlinePtr) const; sl@0: void GetScanLineGray4(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TUint32* aScanlinePtr) const; sl@0: void GetScanLineGray16(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineGray256(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineColor16(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineColor256(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineColor4K(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineColor64K(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineColor16M(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineColor16MU(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineColorRgb(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineExBits(TDes8& aBuf,TInt aX,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineExBytes(TDes8& aBuf,TInt aX,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void DoExternalizeDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const; sl@0: void DoExternalizeByteDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const; sl@0: void DoExternalizeTwelveBitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const; sl@0: void DoExternalizeSixteenBitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const; sl@0: void DoExternalizeTwentyFourBitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const; sl@0: void DoExternalizeThirtyTwoUBitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const; sl@0: void DoExternalizeThirtyTwoABitDataCompressedL(RWriteStream& aStream,TUint8* aData,TInt aSizeInBytes) const; sl@0: TInt SizeOfDataCompressed(TUint8* aData,TInt aSizeInBytes) const; sl@0: TInt SizeOfByteDataCompressed(TUint8* aData,TInt aSizeInBytes) const; sl@0: TInt SizeOfTwelveBitDataCompressed(TUint8* aData,TInt aSizeInBytes) const; sl@0: TInt SizeOfSixteenBitDataCompressed(TUint8* aData,TInt aSizeInBytes) const; sl@0: TInt SizeOfTwentyFourBitDataCompressed(TUint8* aData,TInt aSizeInBytes) const; sl@0: TInt SizeOfThirtyTwoUBitDataCompressed(TUint8* aData,TInt aSizeInBytes) const; sl@0: TInt SizeOfThirtyTwoABitDataCompressed(TUint8* aData,TInt aSizeInBytes) const; sl@0: TBool TrueColorPointerCompare(TUint8* aColorPointer,TUint8 aComponent1,TUint8 aComponent2,TUint8 aComponent3) const; sl@0: TBool ColorAlphaPointerCompare(TUint8* aColorPointer,TUint8 aComponent1,TUint8 aComponent2,TUint8 aComponent3,TUint8 aComponent4) const; sl@0: void DoInternalizeL(RReadStream& aStream,TInt aSrceSize,TUint32* aBase); sl@0: void DoInternalizeCompressedDataL(RReadStream& aStream,TInt aSrceSize,TUint32* aBase,TBitmapfileCompression aCompression); sl@0: void DoDecompressByteData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize); sl@0: sl@0: void DoDecompressByteDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase); sl@0: void DoDecompressTwelveBitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize); sl@0: void DoDecompressTwelveBitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase); sl@0: void DoDecompressSixteenBitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize); sl@0: void DoDecompressSixteenBitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase); sl@0: void DoDecompressTwentyFourBitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize); sl@0: void DoDecompressTwentyFourBitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase); sl@0: void DoDecompressThirtyTwoUBitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize); sl@0: void DoDecompressThirtyTwoUBitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase); sl@0: void DoDecompressThirtyTwoABitData(TUint8* aDestBuffer,TInt aDestSize,TUint8* aSrceBuffer,TInt aSrceSize); sl@0: void DoDecompressThirtyTwoABitDataAltL(RReadStream& aStream,TInt aSrceSizeInBytes,TUint32* aBase); sl@0: 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: 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: TUint32 HashTo1bpp(TUint32 aGray256,TBool aOddX,TBool aOddY) const; sl@0: TUint32 HashTo2bpp(TUint32 aGray256,TInt aDitherIndex) const; sl@0: TBool IsWordMonochrome(TUint32 aWord) const; sl@0: TUint32* DataAddress() const; sl@0: static void WhiteFill(TUint8* aData,TInt aDataSize,TDisplayMode aDispMode); sl@0: static TInt ByteWidth(TInt aPixelWidth,TDisplayMode aDispMode); sl@0: static TInt Bpp(TDisplayMode aDispMode); sl@0: static TInt IsColor(TDisplayMode aDispMode); sl@0: static TDisplayMode DisplayMode(TInt aBpp,TInt aColor); sl@0: static TBitmapfileCompression CompressionType(TInt aBpp, TInt aColor); sl@0: TInt DoGetScanLinePtr(TUint32*& aSlptr, TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: void GenerateLineFromCompressedSixteenBitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: TDisplayMode InitialDisplayMode() const; sl@0: TInt SetDisplayMode(TDisplayMode aDisplayMode, TUint32* aDataAddress); sl@0: TInt DisplayModeArgCheck(TDisplayMode aDisplayMode, TUint32* aDataAddress) const; sl@0: void ChangeDisplayMode( TDisplayMode aNewDisplayMode, sl@0: TInt aScanLineWidthNew, sl@0: TUint8* aDataAddrNew, sl@0: TUint32* aDataAddress, sl@0: TInt aYStart, sl@0: TInt aYInc, sl@0: TInt aYEnd); sl@0: void UpdateBitmapProperties(TDisplayMode aNewDisplayMode); sl@0: TInt SwapWidthAndHeight(TUint32* aDataAddress); sl@0: void GenerateLineFromCompressed24BitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: void GenerateLineFromCompressed32UBitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: void GenerateLineFromCompressed32ABitData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: void AdjustXCoord(TInt& aX) const; sl@0: void GetLineScanPos(TLineScanningPosition& aLineScanPos, sl@0: const TCompressionBookMark*& aComprBookMark, sl@0: const TUint8* aBase) const; sl@0: void UpdateBookMark(const TLineScanningPosition& aLineScanPos, sl@0: TCompressionBookMark* aComprBookMark, sl@0: const TUint8* aBase) const; sl@0: void GetScanLineColor16MA(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: void GetScanLineColor16MAP(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TUint32* aScanlinePtr) const; sl@0: TInt PaletteCompress(); sl@0: void GenerateLineFromPaletteCompressedData(TUint8* aDestBuffer, const TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const; sl@0: TUint PaletteBitsPerPixel(TInt aNumColors) const; sl@0: TUint PaletteBytesPerPixel(TInt aBitsPerPixel) const; sl@0: void PaletteDecodeAndAssignGeneric(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TUint aStartPixel, TUint aEndPixel, TUint aCompressedPixelsPerByte, TUint aCompressedBitsPerPixel) const; sl@0: static void PaletteDecode1PixelPerByte(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction); sl@0: static void PaletteDecode2PixelPerByte(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction); sl@0: static void PaletteDecode4PixelPerByte(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction); sl@0: static void PaletteDecode8PixelPerByte(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction); sl@0: static void PaletteAssign16BitColor(TUint8*& aDestPtr, TUint32 aColor); sl@0: static void PaletteAssign24BitColor(TUint8*& aDestPtr, TUint32 aColor); sl@0: static void PaletteAssign32BitColor(TUint8*& aDestPtr, TUint32 aColor); sl@0: void UpdatePaddingData(TUint32* aData); sl@0: static void CheckHeaderIsValidL(const SEpocBitmapHeader& aHeader); sl@0: static TInt CompressedFormatInfo(TDisplayMode aDispMode, TInt& aBytesPerPack, TInt& aBytesPerCompressed); sl@0: static void BitmapFill32(TUint32* aDestPtr32, TInt aCount, TUint32 aValue32); sl@0: static inline void BitmapFill16(TUint16* aDestPtr16, TInt aCount, TUint16 aValue16); sl@0: private: sl@0: struct TExtra sl@0: { sl@0: #ifdef SYMBIAN_DEBUG_FBS_LOCKHEAP sl@0: TInt iLockCount; // number of calls to CFbsBitmap::LockHeap() not balanced by calls to CFbsBitmap::UnlockHeap() sl@0: TThreadId iThreadId; // id of thread that called CFbsBitmap::LockHeap() if any sl@0: #endif sl@0: TInt64 iSerialNumber; // serial number of bitmap which is unique to the whole FBServ sl@0: TInt iTouchCount; // number of calls to TouchBitmap()i.e. number of times bitmap has been changed sl@0: }; sl@0: inline TExtra* Extra() const; // only for bitmaps created in RAM sl@0: private: sl@0: TUid iUid; sl@0: struct TSettings sl@0: { sl@0: TSettings(TDisplayMode aDisplayMode); sl@0: void SetDisplayModes(TDisplayMode aDisplayMode); sl@0: void SetCurrentDisplayMode(TDisplayMode aDisplayMode); sl@0: TDisplayMode CurrentDisplayMode() const; sl@0: TDisplayMode InitialDisplayMode() const; sl@0: inline void SetDirtyBitmap(); sl@0: inline TBool IsDirtyBitmap() const; sl@0: inline void SetVolatileBitmap(); sl@0: inline TBool IsVolatileBitmap() const; sl@0: enum sl@0: { sl@0: EBitmapFlagDirty = 0x00010000, // set in the old bitmap when a re-allocating operation has created a new bitmap sl@0: EBitmapFlagVolatile = 0x00020000, // set when DataAddress() has been called but BeginDataAccess() has not sl@0: }; sl@0: TUint32 iData; sl@0: } iSettings; sl@0: RHeap* iHeap; sl@0: CChunkPile* iPile; sl@0: TInt iByteWidth; sl@0: SEpocBitmapHeader iHeader; sl@0: TInt iSpare; sl@0: TInt iDataOffset; // offset in bytes from "this" or from base of bitmap chunk, or hardware bitmap handle sl@0: TBool iIsCompressedInRAM; //flag indicating whether CompressData has been called sl@0: }; sl@0: sl@0: #endif