epoc32/include/bitstd.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // 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
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    18 
    18 
    19 #include <e32std.h>
    19 #include <e32std.h>
    20 #include <gdi.h>
    20 #include <gdi.h>
    21 #include <fbs.h>
    21 #include <fbs.h>
    22 #include <bitbase.h>
    22 #include <bitbase.h>
       
    23 
       
    24 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    25 #include <bitgdi/bitgcextradata.h>
       
    26 #endif
    23 
    27 
    24 // For use when testing the code, allows the fast blending to be disabled so back to back comparisons
    28 // For use when testing the code, allows the fast blending to be disabled so back to back comparisons
    25 // can done be to check either timing or exact output.
    29 // can done be to check either timing or exact output.
    26 //#define __ALLOW_FAST_BLEND_DISABLE__
    30 //#define __ALLOW_FAST_BLEND_DISABLE__
    27 
    31 
   228 	friend class TSwapActiveEdges;
   232 	friend class TSwapActiveEdges;
   229 	friend class TSwapScanLineIntersections;
   233 	friend class TSwapScanLineIntersections;
   230 	};
   234 	};
   231 
   235 
   232 class CFbsDevice;
   236 class CFbsDevice;
       
   237 class CFbsDrawDevice;
   233 class TOpenFontCharMetrics;
   238 class TOpenFontCharMetrics;
   234 class CGraphicsAccelerator;
   239 class CGraphicsAccelerator;
   235 class CWsBitmap;
   240 class CWsBitmap;
   236 class MFastBlend;
   241 class MFastBlend;
   237 
   242 class CFbsRasterizer;
   238 /**
   243 class CFbsBitGcExtraData;
   239 Class used to extend the CFbsBitGc class to avoid BC break. Any data member which needs 
       
   240 to be added in CFbsBitGc should be added to this class.
       
   241 @internalAll
       
   242 @released
       
   243 */
       
   244 class CFbsBitGcExtraData:public CBase
       
   245 	{
       
   246 public:
       
   247 	CFbsBitGcExtraData();
       
   248 	~CFbsBitGcExtraData();
       
   249 	void Reset();
       
   250 	inline TInt* PenArray(){return iPenArray;};
       
   251 	inline TRgb ShadowColor(){return iShadowColor;}
       
   252 	inline void SetPenArray(TInt* aPenArray);
       
   253 	inline void SetShadowColor(const TRgb& aShadowColor);
       
   254 	inline void ResetPenArray();
       
   255 private:
       
   256 	TInt* iPenArray;
       
   257 	TRgb iShadowColor;
       
   258 	};
       
   259 
       
   260 inline void CFbsBitGcExtraData::SetPenArray(TInt* aPenArray)
       
   261 	{
       
   262 	delete[] iPenArray;
       
   263 	iPenArray = aPenArray;
       
   264 	}
       
   265 
       
   266 inline void CFbsBitGcExtraData::SetShadowColor(const TRgb& aShadowColor)
       
   267 	{
       
   268 	iShadowColor = aShadowColor;
       
   269 	}
       
   270 
       
   271 inline void CFbsBitGcExtraData::ResetPenArray()
       
   272 	{
       
   273 	delete[] iPenArray;
       
   274 	iPenArray = NULL;
       
   275 	}
       
   276 
   244 
   277 /** 
   245 /** 
   278 Concrete implementation of a bitmapped graphics context.
   246 Concrete implementation of a bitmapped graphics context.
   279 
   247 
   280 The class provides new functionality, and implementations of the pure virtual 
   248 The class provides new functionality, and implementations of the pure virtual 
   412 											const CWsBitmap* aAlphaBmp,
   380 											const CWsBitmap* aAlphaBmp,
   413 											const TPoint& aAlphaPt);
   381 											const TPoint& aAlphaPt);
   414 	IMPORT_C TRgb BrushColor();
   382 	IMPORT_C TRgb BrushColor();
   415 	IMPORT_C TRgb PenColor();	
   383 	IMPORT_C TRgb PenColor();	
   416 	IMPORT_C void ChangeDevice(CFbsDevice* aDevice);
   384 	IMPORT_C void ChangeDevice(CFbsDevice* aDevice);
       
   385 	// New DrawText API's that take in extra paramemters such as context. Extensible.
       
   386 	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* aParam);
       
   387 	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition);
       
   388 	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aBox);
       
   389 	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aBox,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0);
       
   390 	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aBox,TInt aBaselineOffset,TInt aTextWidth,TTextAlign aHrz=ELeft,TInt aMargin=0);
       
   391 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp);
       
   392 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition,TBool aUp);
       
   393 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aBox,TBool aUp);
       
   394 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
       
   395 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aBox,TInt aBaselineOffset,TInt aTextWidth,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
       
   396 	IMPORT_C void UpdateJustification(const TDesC& aText,const TTextParameters* aParam);
       
   397 	IMPORT_C void UpdateJustificationVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp);
   417 private:
   398 private:
   418 	CFbsBitGc();
   399 	CFbsBitGc();
   419 	void AddRect(const TRect& aRect);
   400 	void AddRect(const TRect& aRect);
   420 	TBool AnalyseEllipse(const TRect& rc, TPoint& srad, TPoint& erad, TInt& startq, TInt& endq, TBool* quads);
   401 	TBool AnalyseEllipse(const TRect& rc, TPoint& srad, TPoint& erad, TInt& startq, TInt& endq, TBool* quads);
   421 	void BitMultiply(TUint32* aBinaryDataPtr,TInt aBitLength,TInt aMultiplier);
   402 	void BitMultiply(TUint32* aBinaryDataPtr,TInt aBitLength,TInt aMultiplier);
   423 	TBool CheckDevice(const TRect& aRect) const;
   404 	TBool CheckDevice(const TRect& aRect) const;
   424 	TUint32* ClipBinaryArray(TUint32* aArray,TUint32* aArrayLimit,TInt aArrayWordWd,TInt& aDataWd,TInt& aDataHt,TPoint& aPos);
   405 	TUint32* ClipBinaryArray(TUint32* aArray,TUint32* aArrayLimit,TInt aArrayWordWd,TInt& aDataWd,TInt& aDataHt,TPoint& aPos);
   425 	void ClipFillLine(TPoint,TPoint);
   406 	void ClipFillLine(TPoint,TPoint);
   426 	void CopyCharWord(TUint32* aBinaryDataPtr,const TUint8* aData,TInt aBitShift);
   407 	void CopyCharWord(TUint32* aBinaryDataPtr,const TUint8* aData,TInt aBitShift);
   427 	void CopyCharLine(TUint32* aBinaryDataPtr,TInt aBufferWords,const TUint8* aData,TInt aBitShift,TInt aCharWidth);
   408 	void CopyCharLine(TUint32* aBinaryDataPtr,TInt aBufferWords,const TUint8* aData,TInt aBitShift,TInt aCharWidth);
   428 	void DrawText(const TDesC& aText,const TPoint& aPosition,TTextAlign aAlignment,
   409 	void DrawText(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition,TTextAlign aAlignment,
   429 				  CFont::TTextDirection aDirection,const TRect* aBox = NULL);
   410 				  CFont::TTextDirection aDirection,const TRect* aBox = NULL);
   430 	void DoBitBlt(const TPoint& aDest,CFbsDevice* aDevice,const TRect& aSourceRect);
   411 	void DoBitBlt(const TPoint& aDest,CFbsDevice* aDevice,const TRect& aSourceRect);
   431 	void DoBitBlt(const TPoint& aDest,CBitwiseBitmap* aBitmap,TUint32* aBase,TInt aStride,const TRect& aSourceRect);
   412 	void DoBitBlt(const TPoint& aDest,CBitwiseBitmap* aBitmap,TUint32* aBase,TInt aStride,const TRect& aSourceRect);
   432 	void DoBitBltMasked(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   413 	void DoBitBltMasked(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   433 	void DoBitBltMaskedFlicker(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   414 	void DoBitBltMaskedFlicker(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   434 	void DoBitBltMaskedNonFlicker(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   415 	void DoBitBltMaskedNonFlicker(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   435 	void DoBitBltMaskedNonFlickerSolid(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   416 	void DoBitBltMaskedNonFlickerSolid(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   436 	void DoBitBltMaskedNonFlickerPatterned(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   417 	void DoBitBltMaskedNonFlickerPatterned(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
   437 	void DoBitBltAlpha(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,const TPoint& aDitherOrigin,TInt aShadowMode, TBool aInvertMask);
   418 	void DoBitBltAlpha(const TPoint& aDest, CBitwiseBitmap* aSourceBitmap,
       
   419 					   TUint32* aSourceBase, const TRect& aSourceRect,
       
   420 					   CBitwiseBitmap* aMaskBitmap, TUint32* aMaskBase,
       
   421 					   const TPoint& aAlphaPoint, TInt aShadowMode, TBool aInvertMask);
   438 	void DoBitBltAlpha(const TPoint& aDestPt,
   422 	void DoBitBltAlpha(const TPoint& aDestPt,
   439 					   const CBitwiseBitmap* aSrcBmp1,
   423 					   const CBitwiseBitmap* aSrcBmp1,
   440 					   TUint32* aSrcBmpDataAddr1,
   424 					   TUint32* aSrcBmpDataAddr1,
   441 					   const CBitwiseBitmap* aSrcBmp2,
   425 					   const CBitwiseBitmap* aSrcBmp2,
   442 					   TUint32* aSrcBmpDataAddr2,
   426 					   TUint32* aSrcBmpDataAddr2,
   450 	void DoDrawBitmap(const TRect&,CBitwiseBitmap*,TUint32* aBase,TInt aStride,const TRect&,const TPoint& aDitherOrigin);
   434 	void DoDrawBitmap(const TRect&,CBitwiseBitmap*,TUint32* aBase,TInt aStride,const TRect&,const TPoint& aDitherOrigin);
   451 	void DoDrawBitmapMasked(const TRect& aDestRect,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin);
   435 	void DoDrawBitmapMasked(const TRect& aDestRect,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin);
   452 	void DoDrawLine(TPoint aStart,TPoint aEnd,TBool aDrawStartPoint);
   436 	void DoDrawLine(TPoint aStart,TPoint aEnd,TBool aDrawStartPoint);
   453 	void DoDrawDottedWideLine(const TPoint& pt1,const TPoint& pt2,TBool drawstart,const TRect& screenrect);
   437 	void DoDrawDottedWideLine(const TPoint& pt1,const TPoint& pt2,TBool drawstart,const TRect& screenrect);
   454 	void DoDrawSolidWideLine(const TPoint& pt1,const TPoint& pt2,TBool drawstart,const TRect& screenrect);
   438 	void DoDrawSolidWideLine(const TPoint& pt1,const TPoint& pt2,TBool drawstart,const TRect& screenrect);
   455 	void DoDrawText(CFont::TPositionParam& aParam);
   439 	void DoDrawText(CFont::TPositionParam& aParam,const TInt aEnd);
   456 	void DoDrawCharacter(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData);
   440 	void DoDrawCharacter(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData);
   457 	void DoDrawTextEx(CFont::TPositionParam& aParam,const CBitmapFont* font);
   441 	void DoDrawTextEx(CFont::TPositionParam& aParam,const CBitmapFont* font,const TInt aEnd, const TInt aUnderlineStrikethroughOffset);
   458 	void DoDrawCharacterEx(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   442 	void DoDrawCharacterEx(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   459 		TBool aBold,TBool aItalic,TInt aSemiAscent);
   443 		TBool aBold,TBool aItalic,TInt aSemiAscent);
   460 	void DoDrawCharacterAntiAliased(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData);
   444 	void DoDrawCharacterAntiAliased(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData, const TGlyphBitmapType aGlyphType);
   461 	void DoDrawTextLarge(CFont::TPositionParam& aParam,const CBitmapFont* font);
   445 	void DoDrawTextLarge(CFont::TPositionParam& aParam,const CBitmapFont* font,const TInt aEnd);
   462 	void DoDrawCharacterLarge(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   446 	void DoDrawCharacterLarge(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   463 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor);
   447 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor);
   464 	void DoDrawCharacterExLarge(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   448 	void DoDrawCharacterExLarge(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   465 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor);
   449 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor);
   466 	void DoDrawCharacterMultiplied(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   450 	void DoDrawCharacterMultiplied(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   467 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthMultiplier,TInt aHeightMultiplier);
   451 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthMultiplier,TInt aHeightMultiplier);
   468 	void DoDrawTextVertical(CFont::TPositionParam& aParam,const CBitmapFont* font,TBool aUp);
   452 	void DoDrawTextVertical(CFont::TPositionParam& aParam,const CBitmapFont* font,TBool aUp,const TInt aEnd);
   469 	void DoDrawCharacterVertical(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   453 	void DoDrawCharacterVertical(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
   470 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor,TBool aUp);
   454 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor,TBool aUp);
   471 	void DoDrawCharacterVerticalAntiAliased(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,TBool aUp);
   455 	void DoDrawCharacterVerticalAntiAliased(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,TBool aUp, TGlyphBitmapType aGlyphBitmapType);
   472 	void DoPlot(const TPoint& pt);
   456 	void DoPlot(const TPoint& pt);
   473 	void EllipseFill(const TRect& aRect);
   457 	void EllipseFill(const TRect& aRect);
   474 	void EllipseOutline(const TRect& aRect);
   458 	void EllipseOutline(const TRect& aRect);
   475 	void EllipseOutlineWide(const TRect& aRect);
   459 	void EllipseOutlineWide(const TRect& aRect);
   476 	void GetStrikethroughMetrics(TInt& aTop,TInt& aBottom);
   460 	void GetStrikethroughMetrics(TInt& aTop,TInt& aBottom);
   505 	void APIExGetUnderlineMetrics(TAny*& aOutput);
   489 	void APIExGetUnderlineMetrics(TAny*& aOutput);
   506 	TInt APIExSetShadowColor(TAny* aShadowColor);
   490 	TInt APIExSetShadowColor(TAny* aShadowColor);
   507 	TInt APIExGetShadowColor(TAny*& aShadowColor);
   491 	TInt APIExGetShadowColor(TAny*& aShadowColor);
   508 	TInt FastBlendInterface(const CBitwiseBitmap* aSource, const CBitwiseBitmap* aMask, MFastBlend*& aFastBlend) const;
   492 	TInt FastBlendInterface(const CBitwiseBitmap* aSource, const CBitwiseBitmap* aMask, MFastBlend*& aFastBlend) const;
   509 	TInt APIExIsFbsBitGc(TAny*& aIsCFbsBitGc);
   493 	TInt APIExIsFbsBitGc(TAny*& aIsCFbsBitGc);
       
   494 	TDisplayMode ScanLineBufferDisplayMode(CFbsDrawDevice* aDrawDevice);
       
   495 	TInt BaselineCorrection();
       
   496 	CFbsRasterizer* PrepareRasterizerForExtendedBitmap(const CFbsBitmap& aBitmap);
       
   497 	CFbsRasterizer* PrepareRasterizerForExtendedBitmap(const CFbsBitmap& aBitmap, const TRect& aDestRect, const TPoint& aOffset);
       
   498 	CFbsRasterizer* PrepareRasterizerForExtendedBitmap(const CFbsBitmap& aBitmap, const TRect& aDestRect, const TRect& aSourceRect);
   510 protected:
   499 protected:
   511 	/** This function should not be used by externals but must retain the
   500 	/** This function should not be used by externals but must retain the
   512 	same ordinal number to maintain BC, thus is exported.*/
   501 	same ordinal number to maintain BC, thus is exported.*/
   513 	IMPORT_C TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);
   502 	IMPORT_C TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);
   514 	
   503 	
   572 	{SetFaded(aFadeMode);}
   561 	{SetFaded(aFadeMode);}
   573 inline void CFbsBitGc::SetFadingParameters(TUint8 aBlackMap /*=0*/)
   562 inline void CFbsBitGc::SetFadingParameters(TUint8 aBlackMap /*=0*/)
   574 	{SetFadingParameters(aBlackMap,255);}		//255 is the value of white map when not fading
   563 	{SetFadingParameters(aBlackMap,255);}		//255 is the value of white map when not fading
   575 
   564 
   576 #endif
   565 #endif
       
   566