Clipping code rewrite.
[SDL.s60v3.git] / symbian / include / internal / dsa.h
blob8f9c0e7dc37faa2b89eb6db0e70de90ffca176d0
1 #ifndef __DSA_H__
2 #define __DSA_H__
4 #include <e32base.h>
5 #include <w32std.h>
6 #include "epoc_sdl.h"
7 #include "sdlepocapi.h"
9 class CDsa;
11 typedef void (*TCopyFunction)(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen);
13 NONSHARABLE_CLASS(CDsa) : public CBase
15 public:
16 enum
18 ELastDsaRequest = EpocSdlEnv::ELastService,
21 inline TBool IsDsaAvailable() const;
23 static CDsa* CreateL(RWsSession& aSession);
25 ~CDsa();
27 TUint8* LockHwSurface();
28 TInt AllocSurface(const TSize& aSize, TDisplayMode aMode);
29 inline TDisplayMode DisplayMode() const;
31 TInt SetPalette(TInt aFirst, TInt aCount, TUint32* aPalette);
32 void LockPalette(TBool aLock);
33 TBool AddUpdateRect(const TUint8* aBits, const TRect& aUpdateRect, const TRect& aRect);
34 void UpdateSwSurface();
35 void SetSuspend();
38 TBool Stopped() const;
39 RWsSession& Session();
40 RWindow* Window();
41 CDsa* CreateGlesDsaL();
43 void DoStop();
45 virtual void Free();
47 virtual void ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice);
48 virtual void SetUpdating(TBool aUpdate);
50 virtual TUint8* LockSurface() = 0;
51 virtual void UnlockHwSurface() = 0;
52 virtual void Resume() = 0;
53 virtual void Stop();
54 virtual void DoBlt(CFbsBitmap& aBmp);
56 bool m_updateWholeScreen;
58 protected:
59 CDsa(RWsSession& aSession);
60 void Start();
62 enum
64 ERunning = 0x1,
65 EUpdating = 0x2,
66 EPaletteLocked = 0x4,
67 EUsePalette = 0x8,
68 ESdlThreadSuspend = 0x100,
69 ESdlThreadExplicitStop = 0x200
72 private:
73 virtual void CreateSurfaceL(const TSize& aSize) = 0;
75 void ClipCopy(TUint8* aTarget, const TUint8* aSource, const TRect& aUpdateRect, const TRect& aSourceRect) const;
76 static void Copy256(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt);
77 static void CopySlow(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt);
78 static void CopyMem(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt);
80 void SetCopyFunction();
82 TInt iStateFlags;
83 RWsSession& iSession;
85 TInt iTargetBpp;
86 TInt iSourceBpp;
87 TDisplayMode iSourceMode;
88 TDisplayMode iTargetMode;
89 TUint32* iLut256;
90 TCopyFunction iCopyFunction;
91 TUint8* iTargetAddr;
92 TCopyFunction iCFTable[3];
93 TInt iNewFlags;
94 RWindow* iWindow;
95 friend class TDsa;
98 inline TDisplayMode CDsa::DisplayMode() const
100 return iTargetMode;
103 inline TBool CDsa::IsDsaAvailable() const
105 return iStateFlags & ERunning;
108 #endif