os/graphics/graphicsdeviceinterface/screendriver/swins/Accelhard.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __ACCELHARD_H__
    17 #define __ACCELHARD_H__
    18 
    19 #include "GraphicsAccelerator.h"
    20 
    21 /**
    22 @internalComponent
    23 */
    24 enum TGraphicsAcceleratorPanic
    25 	{
    26 	EGraphicsAcceleratorPanicInvalidOperationBuffer,
    27 	EGraphicsAcceleratorAttemptedDrawOutsideBitmap,
    28 	};
    29 
    30 /**
    31 @internalComponent
    32 */
    33 GLREF_C void GraphicsAcceleratorPanic(TGraphicsAcceleratorPanic aPanicCode);
    34 
    35 /**
    36 @internalComponent
    37 */
    38 class CHardwareGraphicsAcceleratorBase : public CHardwareGraphicsAccelerator
    39 	{
    40 protected:
    41 	void ConstructL(RHardwareBitmap aBitmap);
    42 public:
    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();
    54 	
    55 protected:
    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;
    66 	//
    67 
    68 	// New pure virtual
    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);
    72 protected:
    73 	TGraphicsAcceleratorCaps const*	iCaps;
    74 	TAcceleratedBitmapInfo			iBitmapInfo;
    75 	TBool							iIsScreen;
    76 	};
    77 
    78 inline void CHardwareGraphicsAcceleratorBase::UpdateScreen(const TRect& aRect)
    79 	{
    80 	if(iIsScreen)
    81 		DoUpdateScreen(aRect);
    82 	}
    83 
    84 /**
    85 @internalComponent
    86 */
    87 class CColor256HardwareGraphicsAccelerator : public CHardwareGraphicsAcceleratorBase
    88 	{
    89 public:
    90 	static CColor256HardwareGraphicsAccelerator* NewL(RHardwareBitmap aBitmap);
    91 protected:
    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);
   105 private:
   106     TInt iScreenNo;
   107 	};
   108 
   109 #endif