epoc32/include/bitmap.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
     1.1 --- a/epoc32/include/bitmap.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/bitmap.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,9 +1,9 @@
     1.4  // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5  // All rights reserved.
     1.6  // This component and the accompanying materials are made available
     1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// under the terms of "Eclipse Public License v1.0"
     1.9  // which accompanies this distribution, and is available
    1.10 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.12  //
    1.13  // Initial Contributors:
    1.14  // Nokia Corporation - initial contribution.
    1.15 @@ -25,23 +25,18 @@
    1.16  #include <gdi.h>
    1.17  #endif
    1.18  
    1.19 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.20 +#include <graphics/bitmapuid.h>
    1.21 +#endif
    1.22 +
    1.23  #ifdef _DEBUG
    1.24  	#define SYMBIAN_DEBUG_FBS_LOCKHEAP
    1.25  #endif
    1.26  
    1.27 -/**
    1.28 -@internalComponent
    1.29 -*/
    1.30 -const TUid KCBitwiseBitmapUid={268435520};
    1.31 -const TUid KCBitwiseBitmapHardwareUid={0x10009a3d};
    1.32 -const TUid KMultiBitmapFileImageUid={268435522};
    1.33 -const TInt KCompressionBookMarkThreshold=0x2000;
    1.34 -const TInt KNumBytesPerBitmapHandle = sizeof(TInt); 						// Bitmap handle is the size of a TInt
    1.35 -const TInt KMaxBitmapHandleBufferSize = KNumBytesPerBitmapHandle * 2000; 	// Maximum size of buffer to store all bitmap handles. 
    1.36 -
    1.37  //Forward declarations
    1.38  class CChunkPile;
    1.39  class TCompressionBookMark;
    1.40 +class CFbsRasterizer;
    1.41  
    1.42  /** 
    1.43  Defines the types of file compression. 
    1.44 @@ -66,6 +61,8 @@
    1.45  	EThirtyTwoABitRLECompression,
    1.46  	/** File is compressed as a palette plus reduced bit-per-pixel.  Only applicable to bitmaps already loaded in RAM. */
    1.47  	EGenericPaletteCompression,
    1.48 +	/** Extended bitmap. Data format is proprietary to licensee. */
    1.49 +	EProprietaryCompression,
    1.50  	//Insert new enum items here!
    1.51  	ERLECompressionLast = 255
    1.52  	};
    1.53 @@ -86,26 +83,18 @@
    1.54  	};
    1.55  
    1.56  /**
    1.57 -@internalTechnology
    1.58 -*/
    1.59 +WARNING: Typedef for internal use ONLY. Compatibility is not guaranteed in future releases.
    1.60 +@publishedAll
    1.61 +@released
    1.62 + */
    1.63  typedef void (*TAssignFunction)(TUint8*& aDestPtr, TUint32 aColor);
    1.64 -
    1.65  /**
    1.66 -@internalTechnology
    1.67 -*/
    1.68 +WARNING: Typedef for internal use ONLY. Compatibility is not guaranteed in future releases.
    1.69 +@publishedAll
    1.70 +@released
    1.71 + */
    1.72  typedef void (*TDecodeFunction)(TUint8* aDataPtr, TUint32* aPalettePtr, TUint8*& aDestPtr, TAssignFunction aAssignFunction);
    1.73  
    1.74 -class TRgb24bit
    1.75 -/**
    1.76 -@internalComponent
    1.77 -*/
    1.78 -	{
    1.79 -public:
    1.80 -	TUint8 iRed;
    1.81 -	TUint8 iGreen;
    1.82 -	TUint8 iBlue;
    1.83 -	};
    1.84 -
    1.85  /** 
    1.86  Contains information about the bitmap when streaming bitmaps to stores. 
    1.87  @publishedAll
    1.88 @@ -159,23 +148,28 @@
    1.89  	TBitmapfileCompression iCompression;
    1.90  	};
    1.91  
    1.92 +/**
    1.93 +WARNING: Class for internal use ONLY.  Compatibility is not guaranteed in future releases.
    1.94 +
    1.95 +@publishedAll
    1.96 +@released 
    1.97 + */
    1.98  class TLineScanningPosition
    1.99 -/**
   1.100 -@internalTechnology
   1.101 -*/
   1.102  	{
   1.103  public:
   1.104 -	TLineScanningPosition(TUint32* aSrcDataPtr): iSrcDataPtr((TUint8*)aSrcDataPtr), iCursorPos(0), iScanLineBuffer(NULL) {}
   1.105 +	inline TLineScanningPosition(TUint32* aSrcDataPtr);
   1.106  public:
   1.107  	TUint8* iSrcDataPtr;
   1.108  	TInt iCursorPos;
   1.109  	HBufC8* iScanLineBuffer;
   1.110 +	CFbsRasterizer* const iRasterizer;
   1.111  	};
   1.112  
   1.113  class CShiftedFileStore;
   1.114 +
   1.115  /**
   1.116  BitGdi bitmap class (pseudo-CXxx class).
   1.117 -@internalComponent
   1.118 +WARNING: Class for internal use ONLY.  Compatibility is not guaranteed in future releases.
   1.119  @released
   1.120  */
   1.121  class CBitwiseBitmap
   1.122 @@ -200,13 +194,13 @@
   1.123  	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
   1.124  	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
   1.125  	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
   1.126 -	IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPos,TUint32* aBase) const;
   1.127 +	IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPos,TUint32* aBase, CFbsRasterizer* aRasterizer) const;
   1.128  	IMPORT_C TInt GetScanLinePtr(TUint32*& aSlptr, TPoint& aPixel,TInt aLength, TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
   1.129  	IMPORT_C TInt GetScanLinePtr(TUint32*& aSlptr, TInt& aLength, TPoint& aPixel,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
   1.130  	IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase, TLineScanningPosition& aLineScanningPosition) const;
   1.131  	IMPORT_C void GetScanLine(TUint32*& aSlptr, TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode) const;
   1.132  	IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase) const;
   1.133 -	IMPORT_C void GetVerticalScanLine(TDes8& aBuf,TInt aX,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase) const;
   1.134 +	IMPORT_C void GetVerticalScanLine(TDes8& aBuf,TInt aX,TBool aDither,const TPoint& aDitherOffset,TDisplayMode aDispMode,TUint32* aBase, CFbsRasterizer* aRasterizer) const;
   1.135  	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;
   1.136  	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;
   1.137  	IMPORT_C TUint32* ScanLineAddress(TUint32* aBase,TUint aY) const;
   1.138 @@ -228,6 +222,7 @@
   1.139  	IMPORT_C ~CBitwiseBitmap();
   1.140  	IMPORT_C void Reset();
   1.141  	IMPORT_C TInt Construct(const TSize& aSize,TDisplayMode aDispMode,TUid aCreatorUid);
   1.142 +	IMPORT_C TInt ConstructExtended(const TSize& aSize, TDisplayMode aDispMode, TUid aType, TInt aDataSize);
   1.143  	IMPORT_C void ConstructL(RFs& aFs,const TDesC& aFilename,TInt32 aId,TUint aFileOffset);
   1.144  	IMPORT_C void ConstructL(RFile& aFile,TInt32 aId,TUint aFileOffset);
   1.145  	IMPORT_C void ConstructL(CShiftedFileStore* aFileStore,TStreamId aStreamId);
   1.146 @@ -340,6 +335,17 @@
   1.147  	static void BitmapFill32(TUint32* aDestPtr32, TInt aCount, TUint32 aValue32);
   1.148  	static inline void BitmapFill16(TUint16* aDestPtr16, TInt aCount, TUint16 aValue16);
   1.149  private:
   1.150 +	struct TExtra
   1.151 +		{
   1.152 +#ifdef SYMBIAN_DEBUG_FBS_LOCKHEAP
   1.153 +		TInt iLockCount; // number of calls to CFbsBitmap::LockHeap() not balanced by calls to CFbsBitmap::UnlockHeap()
   1.154 +		TThreadId iThreadId; // id of thread that called CFbsBitmap::LockHeap() if any
   1.155 +#endif
   1.156 +		TInt64 iSerialNumber; // serial number of bitmap which is unique to the whole FBServ
   1.157 +		TInt iTouchCount; // number of calls to TouchBitmap()i.e. number of times bitmap has been changed
   1.158 +		};
   1.159 +	inline TExtra* Extra() const; // only for bitmaps created in RAM
   1.160 +private:
   1.161  	TUid iUid;
   1.162  	struct TSettings
   1.163  		{
   1.164 @@ -350,9 +356,12 @@
   1.165  		TDisplayMode InitialDisplayMode() const;
   1.166  		inline void SetDirtyBitmap();
   1.167  		inline TBool IsDirtyBitmap() const;
   1.168 +		inline void SetVolatileBitmap();
   1.169 +		inline TBool IsVolatileBitmap() const;
   1.170  		enum
   1.171  			{
   1.172 -			EBitmapFlagDirty = 0x10000 // set in the old bitmap when a re-allocating operation has created a new bitmap
   1.173 +			EBitmapFlagDirty = 0x00010000, // set in the old bitmap when a re-allocating operation has created a new bitmap
   1.174 +			EBitmapFlagVolatile = 0x00020000, // set when DataAddress() has been called but BeginDataAccess() has not
   1.175  			};
   1.176  		TUint32 iData;
   1.177  		} iSettings;
   1.178 @@ -360,12 +369,7 @@
   1.179  	CChunkPile* iPile;
   1.180  	TInt iByteWidth;
   1.181  	SEpocBitmapHeader iHeader;
   1.182 -	struct TExtra // used only in builds with SYMBIAN_DEBUG_FBS_LOCKHEAP defined
   1.183 -		{
   1.184 -		TInt iLockCount; // number of calls to CFbsBitmap::LockHeap() not balanced by calls to CFbsBitmap::UnlockHeap()
   1.185 -		TThreadId iThreadId; // id of thread that called CFbsBitmap::LockHeap() if any
   1.186 -		}
   1.187 -		*iExtra; // only for bitmaps created in RAM, set to 0xFFFFFFFF for ROM bitmaps by the tool chain
   1.188 +	TInt iSpare;
   1.189  	TInt iDataOffset; // offset in bytes from "this" or from base of bitmap chunk, or hardware bitmap handle
   1.190  	TBool iIsCompressedInRAM; //flag indicating whether CompressData has been called
   1.191  	};