Remove window size check from AllocSurface.
[SDL.s60v3.git] / symbian / include / internal / dsa.h
blobf713535e19b318690bcdae491b0c3a58cbb16a8c
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:
60 inline const TSize& SwSize() const;
61 inline const TRect& HwRect() const;
63 inline const TRect& ScreenRect() const;
65 CDsa(RWsSession& aSession);
66 void SetTargetRect();
67 void Start();
69 enum
71 ERunning = 0x1,
72 EUpdating = 0x2,
73 EPaletteLocked = 0x4,
74 EUsePalette = 0x8,
75 ESdlThreadSuspend = 0x100,
76 ESdlThreadExplicitStop = 0x200
79 private:
80 virtual void CreateSurfaceL() = 0;
82 void ClipCopy(TUint8* aTarget, const TUint8* aSource, const TRect& aUpdateRect, const TRect& aSourceRect) const;
83 static void Copy256(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt);
84 static void CopySlow(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt);
85 static void CopyMem(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt);
87 void SetCopyFunction();
89 TInt iStateFlags;
90 RWsSession& iSession;
91 TRect iScreenRect;
93 TInt iTargetBpp;
94 TInt iSourceBpp;
95 TDisplayMode iSourceMode;
96 TDisplayMode iTargetMode;
97 TUint32* iLut256;
98 TCopyFunction iCopyFunction;
99 TUint8* iTargetAddr;
100 TCopyFunction iCFTable[3];
101 TInt iNewFlags;
102 TSize iSwSize;
103 TRect iTargetRect;
104 RWindow* iWindow;
105 friend class TDsa;
108 inline TDisplayMode CDsa::DisplayMode() const
110 return iTargetMode;
113 inline const TRect& CDsa::HwRect() const
115 return iTargetRect;
118 inline const TSize& CDsa::SwSize() const
120 return iSwSize;
123 inline TBool CDsa::IsDsaAvailable() const
125 return iStateFlags & ERunning;
128 inline const TRect& CDsa::ScreenRect() const
130 return iScreenRect;
133 #endif