First public contribution.
1 // Copyright (c) 2001-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __ACCELHARD_H__
17 #define __ACCELHARD_H__
19 #include "GraphicsAccelerator.h"
24 enum TGraphicsAcceleratorPanic
26 EGraphicsAcceleratorPanicInvalidOperationBuffer,
27 EGraphicsAcceleratorAttemptedDrawOutsideBitmap,
33 GLREF_C void GraphicsAcceleratorPanic(TGraphicsAcceleratorPanic aPanicCode);
38 class CHardwareGraphicsAcceleratorBase : public CHardwareGraphicsAccelerator
41 void ConstructL(RHardwareBitmap aBitmap);
43 // From CGraphicsAccelerator
44 virtual const TGraphicsAcceleratorCaps* Capabilities();
45 virtual TInt Operation(const TGraphicsOperation& aOperation);
46 virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects);
47 virtual TInt Operation(TDes8& aBuffer);
48 virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects);
49 // From CGraphicsAccelerator
50 virtual void Reserved_1();
51 virtual void Reserved_2();
52 virtual void Reserved_3();
53 virtual void Reserved_4();
56 // Generic pure virtual operations
57 virtual void DoFillRect(const TRect& aRect,TUint32 aFillValue) = 0;
58 virtual TInt DoFilledRectWithPattern(const TRect& aRect,TGopFillPattern aPattern) = 0;
59 virtual void DoInvertRect(const TRect& aRect) = 0;
60 virtual TInt DoBitBlt(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSourceBitmapSpec,const TRect& aSourceRect) = 0;
61 virtual TInt DoBitBltMasked(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSourceBitmapSpec,const TRect& aSourceRect,const TAcceleratedBitmapSpec& aMaskSpec) = 0;
62 virtual void DoFadeRect(const TRect& aRect,const TGopFadeParams aFade) = 0;
63 virtual TInt DoBitBltAlphaBitmap(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSourceBitmapSpec,const TRect& aSourceRect,const TAcceleratedBitmapSpec& aAlphaBitmapSpec) = 0;
64 virtual TInt DoAlphaBlendTwoBitmaps(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSrceBitmapSpec1,const TAcceleratedBitmapSpec& aSrceBitmapSpec2,const TRect& aSourceRect,const TPoint& aSrcPt2,const TAcceleratedBitmapSpec& aAlphaBitmapSpec,const TPoint& aAlphaPt) = 0;
65 virtual TInt DoAlphaBlendOneBitmap(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSrceBitmapSpec,const TRect& aSourceRect,const TAcceleratedBitmapSpec& aAlphaBitmapSpec,const TPoint& aAlphaPt) = 0;
69 virtual TUint32 FillValue(TRgb aColor) = 0; // Return a TUint32 value which has all pixels set to the given color
70 virtual void DoUpdateScreen(const TRect& aRect) = 0;
71 inline void UpdateScreen(const TRect& aRect);
73 TGraphicsAcceleratorCaps const* iCaps;
74 TAcceleratedBitmapInfo iBitmapInfo;
78 inline void CHardwareGraphicsAcceleratorBase::UpdateScreen(const TRect& aRect)
81 DoUpdateScreen(aRect);
87 class CColor256HardwareGraphicsAccelerator : public CHardwareGraphicsAcceleratorBase
90 static CColor256HardwareGraphicsAccelerator* NewL(RHardwareBitmap aBitmap);
92 void ConstructL(RHardwareBitmap aBitmap);
93 // From CHardwareGraphicsAcceleratorBase
94 virtual void DoFillRect(const TRect& aRect,TUint32 aFillValue);
95 virtual TInt DoFilledRectWithPattern(const TRect& aRect,TGopFillPattern aPattern);
96 virtual void DoInvertRect(const TRect& aRect);
97 virtual TInt DoBitBlt(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSourceBitmapSpec,const TRect& aSourceRect);
98 virtual TInt DoBitBltMasked(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSourceBitmapSpec,const TRect& aSourceRect,const TAcceleratedBitmapSpec& aMaskSpec);
99 virtual void DoFadeRect(const TRect& aRect,const TGopFadeParams aFade);
100 virtual TInt DoBitBltAlphaBitmap(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSourceBitmapSpec,const TRect& aSourceRect,const TAcceleratedBitmapSpec& aAlphaBitmapSpec);
101 virtual TInt DoAlphaBlendTwoBitmaps(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSrceBitmapSpec1,const TAcceleratedBitmapSpec& aSrceBitmapSpec2,const TRect& aSourceRect,const TPoint& aSrcPt2,const TAcceleratedBitmapSpec& aAlphaBitmapSpec,const TPoint& aAlphaPt);
102 virtual TInt DoAlphaBlendOneBitmap(const TPoint& aDestination,const TAcceleratedBitmapSpec& aSrceBitmapSpec,const TRect& aSourceRect,const TAcceleratedBitmapSpec& aAlphaBitmapSpec,const TPoint& aAlphaPt);
103 virtual TUint32 FillValue(TRgb aColor);
104 virtual void DoUpdateScreen(const TRect& aRect);