annotate src/video/symbian/EKA2/dsa.cpp @ 3975:e85e65aec22f SDL-1.2

Added S60 port.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 24 Jun 2007 18:26:35 +0000
parents
children ce8046809062
rev   line source
3975
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1 #include "dsa.h"
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 #include "sdlepocapi.h"
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
3 #include <cdsb.h>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
6 LOCAL_C TInt BytesPerPixel(TDisplayMode aMode)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
8 return ((TDisplayModeUtils::NumDisplayModeBitsPerPixel(aMode) - 1) >> 3) + 1;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
13
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
15 class CBitmapSurface : public T
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
16 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
17 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18 CBitmapSurface(RWsSession& aSession);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 void ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21 ~CBitmapSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
22 TUint8* LockSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23 void UnlockHwSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
24 void CreateSurfaceL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
25 void Wipe(TInt aLength);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26 void Free();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
27 void Update(CFbsBitmap& aBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
28 TInt ExternalUpdate();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
29 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30 CFbsBitmap* iBmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
31 CFbsBitmap* iCopyBmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
34
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
35 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
36 void CBitmapSurface<T>::ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
37 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
38 delete iCopyBmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
39 iCopyBmp = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
40 iCopyBmp = new (ELeave) CFbsBitmap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
41 T::ConstructL(aWindow, aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
42 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
43
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
44 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
45 CBitmapSurface<T>::CBitmapSurface(RWsSession& aSession) : T(aSession)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
46 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
47 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
48
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
49 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
50 void CBitmapSurface<T>::Free()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
51 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
52 delete iBmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
53 iBmp = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
54 T::Free();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
55 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
56
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
57 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
58 CBitmapSurface<T>::~CBitmapSurface()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
59 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
60 __ASSERT_DEBUG(iBmp == NULL, PANIC(KErrNotReady));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
61 delete iCopyBmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
62 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
63
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
64 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
65 TUint8* CBitmapSurface<T>::LockSurface()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
66 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
67 iBmp->LockHeap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
68 return reinterpret_cast<TUint8*>(iBmp->DataAddress());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
69 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
70
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
71
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
72 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
73 void CBitmapSurface<T>::UnlockHwSurface()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
74 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
75 iBmp->UnlockHeap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
76 T::SetUpdating(EFalse);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
77 Update(*iBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
78 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
79
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
80
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
81 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
82 void CBitmapSurface<T>::Update(CFbsBitmap& aBmp)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
83 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
84 if(!T::Blitter(aBmp))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
85 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
86 if(T::SwSize() == T::HwRect().Size())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
87 T::Gc().BitBlt(T::HwRect().iTl, &aBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
88 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
89 T::Gc().DrawBitmap(T::HwRect(), &aBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
90 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
91 T::DrawOverlays();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
92 T::CompleteUpdate();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
93 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
94
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
95 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
96 void CBitmapSurface<T>::CreateSurfaceL()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
97 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
98 Free();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
99 iBmp = new (ELeave) CFbsBitmap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
100 User::LeaveIfError(iBmp->Create(T::SwSize(), T::DisplayMode()));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
101 T::CreateSurfaceL(*iBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
102 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
103
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
104 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
105 void CBitmapSurface<T>::Wipe(TInt aLength) //dont call in drawing
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
106 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
107 iBmp->LockHeap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
108 Mem::FillZ(iBmp->DataAddress(), aLength);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
109 iBmp->UnlockHeap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
110 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
111
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
112 template<class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
113 TInt CBitmapSurface<T>::ExternalUpdate()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
114 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
115 if(iCopyBmp->Handle() == 0)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
116 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
117 const TInt err = iCopyBmp->Duplicate(iBmp->Handle());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
118 if(err != KErrNone)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
119 return err;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
120 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
121 Update(*iCopyBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
122 return KErrNone;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
123 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
124
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
125
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
126 //////////////////////////////////////////////////////////////////////
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
127
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
128
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
129
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
130 NONSHARABLE_CLASS(CDsaBitgdi) : public CDsa
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
131 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
132 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
133 CDsaBitgdi(RWsSession& aSession);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
134 protected:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
135 void ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
136 CBitmapContext& Gc();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
137 void CompleteUpdate();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
138 ~CDsaBitgdi();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
139 void CreateSurfaceL(CFbsBitmap& aBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
140 void Free();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
141 void UnlockHWSurfaceRequestComplete();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
142 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
143 void Resume();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
144
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
145 CFbsBitGc* iGc;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
146 CFbsDevice* iDevice;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
147 CFbsBitmap* iBitGdiBmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
148 CWindowGc* iWinGc;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
149 RWindow* iWindow;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
150 TInt iHandle;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
151 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
152
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
153
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
154 CDsaBitgdi::CDsaBitgdi(RWsSession& aSession) : CDsa(aSession)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
155 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
156 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
157
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
158 CDsaBitgdi::~CDsaBitgdi()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
159 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
160 delete iWinGc;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
161 delete iBitGdiBmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
162 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
163
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
164 void CDsaBitgdi::CompleteUpdate()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
165 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
166 EpocSdlEnv::Request(CDsa::ERequestUpdate);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
167 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
168
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
169
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
170 void CDsaBitgdi::UnlockHWSurfaceRequestComplete()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
171 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
172 if(iHandle == 0)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
173 return;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
174
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
175 if(iBitGdiBmp == NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
176 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
177 iBitGdiBmp = new CFbsBitmap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
178 if(iBitGdiBmp == NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
179 return;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
180 iBitGdiBmp->Duplicate(iHandle);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
181 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
182
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
183 iWindow->Invalidate();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
184
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
185 iWindow->BeginRedraw();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
186 iWinGc->Activate(*iWindow);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
187 iWinGc->BitBlt(TPoint(0, 0), iBitGdiBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
188 iWinGc->Deactivate();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
189 iWindow->EndRedraw();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
190 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
191
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
192 void CDsaBitgdi::Resume()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
193 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
194 Start();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
195 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
196
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
197 CBitmapContext& CDsaBitgdi::Gc()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
198 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
199 return *iGc;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
200 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
201
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
202 void CDsaBitgdi::ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
203 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
204
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
205 delete iBitGdiBmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
206 iBitGdiBmp = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
207 delete iWinGc;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
208 iWinGc = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
209 iHandle = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
210
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
211 iWindow = &aWindow;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
212 User::LeaveIfError(aDevice.CreateContext(iWinGc));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
213 CDsa::ConstructL(aWindow, aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
214 Start();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
215 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
216
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
217 void CDsaBitgdi::CreateSurfaceL(CFbsBitmap& aBmp)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
218 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
219 iDevice = CFbsBitmapDevice::NewL(&aBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
220 User::LeaveIfError(iDevice->CreateContext(iGc));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
221 iHandle = aBmp.Handle();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
222 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
223
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
224 void CDsaBitgdi::Free()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
225 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
226 delete iGc;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
227 iGc = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
228 delete iDevice;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
229 iDevice = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
230 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
231
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
232 ////////////////////////////////////////////////////////////////////////
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
233 ///////////////////////////////////////////////////////////////////////
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
234
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
235 NONSHARABLE_CLASS(CDsaBase) : public CDsa, public MDirectScreenAccess
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
236 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
237 protected:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
238 inline CDirectScreenAccess& Dsa() const;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
239 CDsaBase(RWsSession& aSession);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
240 ~CDsaBase();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
241 void ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
242 void Stop();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
243 void Resume();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
244 CBitmapContext& Gc();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
245 protected:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
246 CDirectScreenAccess* iDsa;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
247 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
248 void AbortNow(RDirectScreenAccess::TTerminationReasons aReason);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
249 void Restart(RDirectScreenAccess::TTerminationReasons aReason);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
250 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
251 void RestartL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
252 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
253
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
254
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
255 inline CDirectScreenAccess& CDsaBase::Dsa() const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
256 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
257 return *iDsa;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
258 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
259
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
260
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
261 CDsaBase::CDsaBase(RWsSession& aSession) : CDsa(aSession)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
262 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
263 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
264
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
265 CBitmapContext& CDsaBase::Gc()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
266 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
267 return *Dsa().Gc();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
268 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
269
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
270 void CDsaBase::ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
271 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
272 CDsa::ConstructL(aWindow, aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
273 if(iDsa != NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
274 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
275 iDsa->Cancel();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
276 delete iDsa;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
277 iDsa = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
278 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
279
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
280 iDsa = CDirectScreenAccess::NewL(
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
281 Session(),
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
282 aDevice,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
283 aWindow,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
284 *this);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
285 RestartL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
286 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
287
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
288 void CDsaBase::Resume()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
289 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
290 if(Stopped())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
291 Restart(RDirectScreenAccess::ETerminateRegion);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
292 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
293
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
294 CDsaBase::~CDsaBase()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
295 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
296 if(iDsa != NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
297 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
298 iDsa->Cancel();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
299 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
300 delete iDsa;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
301 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
302
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
303
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
304 void CDsaBase::RestartL()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
305 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
306
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
307
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
308 iDsa->StartL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
309
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
310 const RRegion* r = iDsa->DrawingRegion();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
311 const TRect rect = r->BoundingRect();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
312 iDsa->Gc()->SetClippingRegion(r);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
313
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
314 if(rect != ScreenRect())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
315 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
316 return ;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
317 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
318
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
319
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
320 SetTargetRect();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
321 RecreateL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
322
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
323 Start();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
324
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
325
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
326 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
327
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
328 void CDsaBase::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
329 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
330 Stop();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
331 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
332
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
333 void CDsaBase::Restart(RDirectScreenAccess::TTerminationReasons aReason)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
334 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
335 if(aReason == RDirectScreenAccess::ETerminateRegion) //auto restart
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
336 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
337 TRAPD(err, RestartL());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
338 PANIC_IF_ERROR(err);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
339 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
340 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
341
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
342
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
343 void CDsaBase::Stop()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
344 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
345 CDsa::Stop();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
346 iDsa->Cancel();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
347 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
348
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
349
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
350 ///////////////////////////////////////////////////////////////////////
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
351 ///////////////////////////////////////////////////////////////////////
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
352 NONSHARABLE_CLASS(TDsa)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
353 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
354 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
355 inline TDsa(const CDsa& aDsa);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
356 inline TBool IsFlip() const;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
357 inline TBool IsTurn() const;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
358 inline const TSize& SwSize() const;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
359 inline void Copy(TUint32* aTarget, const TUint8* aSrc, TInt aBytes, TInt aHeight) const;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
360 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
361 const CDsa& iDsa;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
362 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
363
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
364
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
365
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
366
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
367 inline TDsa::TDsa(const CDsa& aDsa) : iDsa(aDsa)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
368 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
369 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
370
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
371 inline TBool TDsa::IsTurn() const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
372 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
373 return iDsa.iStateFlags & CDsa::EOrientation90;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
374 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
375
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
376 inline TBool TDsa::IsFlip() const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
377 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
378 return iDsa.iStateFlags & CDsa::EOrientation180;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
379 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
380
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
381 inline const TSize& TDsa::SwSize() const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
382 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
383 return iDsa.SwSize();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
384 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
385
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
386 inline void TDsa::Copy(TUint32* aTarget, const TUint8* aSrc, TInt aBytes, TInt aHeight) const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
387 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
388 iDsa.iCopyFunction(iDsa, aTarget, aSrc, aBytes, aHeight);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
389 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
390
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
391 template<class T, class S>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
392 void ClipCopy(const TDsa& iDsa, TUint8* aTarget,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
393 const TUint8* aSource,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
394 const TRect& aUpdateRect,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
395 const TRect& aSourceRect)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
396 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
397 const S* source = reinterpret_cast<const S*>(aSource);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
398 const TInt lineWidth = aSourceRect.Width();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
399
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
400 source += (aUpdateRect.iTl.iY * lineWidth);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
401 const TInt sourceStartOffset = aUpdateRect.iTl.iX;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
402 source += sourceStartOffset;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
403
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
404 T* targetPtr = reinterpret_cast<T*>(aTarget);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
405
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
406 const TInt scanLineWidth = iDsa.SwSize().iWidth;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
407
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
408 targetPtr += (aSourceRect.iTl.iY + aUpdateRect.iTl.iY ) * scanLineWidth;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
409 const TInt targetStartOffset = (aUpdateRect.iTl.iX + aSourceRect.iTl.iX);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
410
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
411 targetPtr += targetStartOffset;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
412
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
413
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
414 const TInt height = aUpdateRect.Height();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
415
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
416 const TInt lineMove = iDsa.IsTurn() ? 1 : lineWidth;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
417 const TInt copyLen = aUpdateRect.Width();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
418
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
419
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
420 if(iDsa.IsFlip())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
421 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
422
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
423 targetPtr += scanLineWidth * (height - 1);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
424
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
425 for(TInt i = 0; i < height; i++) //source is always smaller
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
426 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
427 iDsa.Copy(reinterpret_cast<TUint32*>(targetPtr), reinterpret_cast<const TUint8*>(source), copyLen, height);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
428 source += lineMove;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
429 targetPtr -= scanLineWidth;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
430 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
431 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
432 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
433 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
434
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
435
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
436 for(TInt i = 0; i < height; i++) //source is always smaller
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
437 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
438 iDsa.Copy(reinterpret_cast<TUint32*>(targetPtr), reinterpret_cast<const TUint8*>(source), copyLen, height);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
439 source += lineMove;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
440 targetPtr += scanLineWidth; // >> 2;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
441 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
442 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
443
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
444 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
445
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
446
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
447
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
448 NONSHARABLE_CLASS(CDsaA) : public CDsaBase
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
449 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
450 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
451 CDsaA(RWsSession& aSession);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
452 protected:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
453 void ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
454 void CompleteUpdate();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
455 void CreateSurfaceL(CFbsBitmap& aBmp);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
456 void Free();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
457 void UnlockHWSurfaceRequestComplete();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
458 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
459
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
460
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
461 CDsaA::CDsaA(RWsSession& aSession) : CDsaBase(aSession)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
462 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
463 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
464
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
465
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
466 void CDsaA::ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
467 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
468 CDsaBase::ConstructL(aWindow, aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
469 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
470
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
471 void CDsaA::CompleteUpdate()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
472 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
473 iDsa->ScreenDevice()->Update();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
474 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
475
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
476 void CDsaA::CreateSurfaceL(CFbsBitmap& /*aBmp*/)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
477 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
478 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
479
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
480 void CDsaA::Free()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
481 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
482
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
483 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
484
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
485 void CDsaA::UnlockHWSurfaceRequestComplete()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
486 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
487 PANIC(KErrNotSupported);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
488 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
489
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
490
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
491
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
492 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
493
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
494 NONSHARABLE_CLASS(MDsbObs)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
495 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
496 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
497 virtual void SurfaceReady() = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
498 virtual CDirectScreenBitmap& Dsb() = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
499 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
500
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
501 NONSHARABLE_CLASS(CDsbSurface) : public CActive
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
502 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
503 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
504 CDsbSurface(MDsbObs& aDsb);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
505 TUint8* Address();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
506 void Complete();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
507 ~CDsbSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
508 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
509 void RunL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
510 void DoCancel();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
511 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
512 MDsbObs& iDsb;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
513 TUint8* iAddress;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
514 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
515
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
516 CDsbSurface::CDsbSurface(MDsbObs& aDsb) : CActive(CActive::EPriorityHigh) , iDsb(aDsb)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
517 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
518 CActiveScheduler::Add(this);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
519 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
520
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
521 CDsbSurface::~CDsbSurface()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
522 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
523 Cancel();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
524 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
525
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
526 void CDsbSurface::Complete()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
527 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
528 if(iAddress != NULL && !IsActive())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
529 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
530 iAddress = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
531 SetActive();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
532 iDsb.Dsb().EndUpdate(iStatus);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
533 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
534 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
535
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
536 TUint8* CDsbSurface::Address()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
537 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
538 if(iAddress == NULL && !IsActive())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
539 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
540 TAcceleratedBitmapInfo info;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
541 if(KErrNone == iDsb.Dsb().BeginUpdate(info))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
542 iAddress = info.iAddress;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
543 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
544 return iAddress;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
545 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
546
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
547 void CDsbSurface::RunL()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
548 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
549 iDsb.SurfaceReady();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
550 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
551
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
552 void CDsbSurface::DoCancel()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
553 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
554 //empty
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
555 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
556
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
557 NONSHARABLE_CLASS(CDsaB) : public CDsaBase,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
558 public MDsbObs
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
559 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
560 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
561 CDsaB(RWsSession& aSession, TInt aFlags);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
562 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
563 ~CDsaB();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
564 TUint8* LockSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
565 void UnlockHWSurfaceRequestComplete();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
566 void UnlockHwSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
567 void CreateSurfaceL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
568 void Wipe(TInt aLength);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
569 void RecreateL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
570 void ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
571 CDirectScreenBitmap& Dsb();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
572 void SurfaceReady();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
573 TInt ExternalUpdate();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
574 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
575 CDsbSurface* iSurface1;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
576 CDsbSurface* iSurface2;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
577 CDirectScreenBitmap* iDsb;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
578 TInt iType;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
579 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
580
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
581 CDsaB::CDsaB(RWsSession& aSession, TInt aFlags) : CDsaBase(aSession), iType(aFlags)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
582 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
583 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
584
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
585
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
586
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
587 void CDsaB::UnlockHWSurfaceRequestComplete()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
588 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
589 iSurface1->Complete();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
590 if(iSurface2 != NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
591 iSurface2->Complete();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
592 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
593
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
594 void CDsaB::CreateSurfaceL()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
595 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
596 __ASSERT_ALWAYS(SwSize() == HwRect().Size(), PANIC(KErrNotSupported));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
597 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
598
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
599 void CDsaB::Wipe(TInt aLength) //dont call in drawing
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
600 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
601 TUint8* addr = LockSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
602 if(addr != NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
603 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
604 Mem::FillZ(addr, aLength);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
605 UnlockHwSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
606 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
607 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
608
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
609
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
610 void CDsaB::UnlockHwSurface()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
611 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
612 EpocSdlEnv::Request(CDsa::ERequestUpdate);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
613 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
614
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
615 TUint8* CDsaB::LockSurface()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
616 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
617 TUint8* addr = iSurface1->Address();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
618 if(addr == NULL && iSurface2 != NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
619 addr = iSurface2->Address();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
620 SetUpdating(addr == NULL);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
621 return addr;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
622 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
623
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
624 void CDsaB::SurfaceReady()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
625 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
626 SetUpdating(EFalse);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
627 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
628
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
629 CDirectScreenBitmap& CDsaB::Dsb()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
630 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
631 return *iDsb;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
632 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
633
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
634 void CDsaB::ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
635 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
636 if(iDsb == NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
637 iDsb = CDirectScreenBitmap::NewL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
638 CDsaBase::ConstructL(aWindow, aDevice);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
639 if(iSurface1 == NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
640 iSurface1 = new (ELeave) CDsbSurface(*this);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
641 if(iSurface2 == NULL && iType & CDirectScreenBitmap::EDoubleBuffer)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
642 iSurface2 = new (ELeave) CDsbSurface(*this);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
643 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
644
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
645 CDsaB::~CDsaB()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
646 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
647 delete iSurface1;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
648 delete iSurface2;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
649 delete iDsb;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
650 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
651
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
652 void CDsaB::RecreateL()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
653 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
654 iDsb->Close();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
655 iDsb->Create(HwRect(), CDirectScreenBitmap::TSettingsFlags(iType));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
656 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
657
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
658 TInt CDsaB::ExternalUpdate()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
659 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
660 if(LockSurface())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
661 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
662 UnlockHWSurfaceRequestComplete();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
663 return KErrNone;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
664 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
665 return KErrNotReady;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
666 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
667
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
668
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
669 /////////////////////////////////////////////////////////////////////////////////////////////////////
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
670
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
671
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
672
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
673 CDsa* CDsa::CreateL(RWsSession& aSession)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
674 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
675 if(EpocSdlEnv::Flags(CSDL::EDrawModeDSB))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
676 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
677 TInt flags = CDirectScreenBitmap::ENone;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
678 if(EpocSdlEnv::Flags(CSDL::EDrawModeDSBDoubleBuffer))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
679 flags |= CDirectScreenBitmap::EDoubleBuffer;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
680 if(EpocSdlEnv::Flags(CSDL::EDrawModeDSBIncrementalUpdate))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
681 flags |= CDirectScreenBitmap::EIncrementalUpdate;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
682 return new (ELeave) CDsaB(aSession, flags);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
683 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
684 else if(EpocSdlEnv::Flags(CSDL::EDrawModeGdi))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
685 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
686 return new (ELeave) CBitmapSurface<CDsaBitgdi>(aSession);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
687 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
688 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
689 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
690 return new (ELeave) CBitmapSurface<CDsaA>(aSession);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
691 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
692 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
693
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
694
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
695 void CDsa::RecreateL()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
696 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
697 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
698
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
699 void CDsa::Free()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
700 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
701 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
702
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
703 TSize CDsa::WindowSize() const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
704 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
705 TSize size = iSwSize;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
706 if(iStateFlags & EOrientation90)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
707 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
708 const TInt tmp = size.iWidth;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
709 size.iWidth = size.iHeight;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
710 size.iHeight = tmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
711 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
712 return size;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
713 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
714
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
715 void CDsa::SetSuspend()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
716 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
717 iStateFlags |= ESdlThreadSuspend;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
718 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
719
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
720
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
721 void CDsa::SetUpdating(TBool aUpdate)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
722 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
723 if(aUpdate)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
724 iStateFlags |= EUpdating;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
725 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
726 iStateFlags &= ~EUpdating;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
727 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
728
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
729
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
730 TBool CDsa::Stopped() const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
731 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
732 return (iStateFlags & ESdlThreadExplicitStop);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
733 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
734
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
735 void CDsa::SetOrientation(CSDL::TOrientationMode aOrientation)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
736 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
737 TInt flags = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
738 switch(aOrientation)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
739 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
740 case CSDL::EOrientation90:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
741 flags = EOrientation90;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
742 break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
743 case CSDL::EOrientation180:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
744 flags = EOrientation180;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
745 break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
746 case CSDL::EOrientation270:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
747 flags = EOrientation90 | EOrientation180;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
748 break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
749 case CSDL::EOrientation0:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
750 flags = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
751 break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
752 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
753 if(flags != (iStateFlags & EOrientationFlags))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
754 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
755 iStateFlags |= EOrientationChanged;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
756 iNewFlags = flags; //cannot be set during drawing...
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
757 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
758 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
759
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
760 CDsa::~CDsa()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
761 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
762 iOverlays.Close();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
763 User::Free(iLut256);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
764 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
765
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
766 void CDsa::ConstructL(RWindow& aWindow, CWsScreenDevice& /*aDevice*/)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
767 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
768 if(iLut256 == NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
769 iLut256 = (TUint32*) User::AllocL(256 * sizeof(TUint32));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
770 iTargetMode = aWindow.DisplayMode();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
771 iTargetBpp = BytesPerPixel(DisplayMode());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
772 iScreenRect = TRect(aWindow.Position(), aWindow.Size());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
773 SetTargetRect();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
774 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
775
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
776 void CDsa::DrawOverlays()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
777 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
778 const TInt last = iOverlays.Count() - 1;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
779 for(TInt i = last; i >= 0 ; i--)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
780 iOverlays[i].iOverlay->Draw(Gc(), HwRect(), SwSize());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
781 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
782
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
783 TInt CDsa::AppendOverlay(MOverlay& aOverlay, TInt aPriority)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
784 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
785 TInt i;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
786 for(i = 0; i < iOverlays.Count() && iOverlays[i].iPriority < aPriority; i++)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
787 {}
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
788 const TOverlay overlay = {&aOverlay, aPriority};
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
789 return iOverlays.Insert(overlay, i);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
790 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
791
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
792 TInt CDsa::RemoveOverlay(MOverlay& aOverlay)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
793 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
794 for(TInt i = 0; i < iOverlays.Count(); i++)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
795 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
796 if(iOverlays[i].iOverlay == &aOverlay)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
797 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
798 iOverlays.Remove(i);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
799 return KErrNone;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
800 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
801 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
802 return KErrNotFound;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
803 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
804
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
805 void CDsa::LockPalette(TBool aLock)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
806 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
807 if(aLock)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
808 iStateFlags |= EPaletteLocked;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
809 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
810 iStateFlags &= ~EPaletteLocked;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
811 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
812 TInt CDsa::SetPalette(TInt aFirst, TInt aCount, TUint32* aPalette)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
813 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
814 if(iLut256 == NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
815 return KErrNotFound;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
816 const TInt count = aCount - aFirst;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
817 if(count > 256)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
818 return KErrArgument;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
819 if(iStateFlags & EPaletteLocked)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
820 return KErrNone;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
821 for(TInt i = aFirst; i < count; i++) //not so busy here:-)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
822 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
823 iLut256[i] = aPalette[i];
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
824 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
825 return KErrNone;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
826 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
827
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
828
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
829
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
830
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
831
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
832 CDsa::CDsa(RWsSession& aSession) :
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
833 iSession(aSession),
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
834 iStateFlags(0)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
835 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
836 // CActiveScheduler::Add(this);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
837 iCFTable[0] = CopyMem;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
838 iCFTable[1] = CopyMemFlipReversed;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
839 iCFTable[2] = CopyMemReversed;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
840 iCFTable[3] = CopyMemFlip;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
841
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
842 iCFTable[4] = Copy256;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
843 iCFTable[5] = Copy256FlipReversed;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
844 iCFTable[6] = Copy256Reversed;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
845 iCFTable[7] = Copy256Flip;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
846
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
847
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
848 iCFTable[8] = CopySlow;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
849 iCFTable[9] = CopySlowFlipReversed;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
850 iCFTable[10] = CopySlowReversed;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
851 iCFTable[11] = CopySlowFlip;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
852 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
853
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
854 RWsSession& CDsa::Session()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
855 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
856 return iSession;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
857 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
858
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
859 TInt CDsa::RedrawRequest()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
860 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
861 if(!(iStateFlags & (EUpdating) && (iStateFlags & ERunning)))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
862 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
863 return ExternalUpdate();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
864 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
865 return KErrNotReady;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
866 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
867
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
868 TUint8* CDsa::LockHwSurface()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
869 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
870 if((iStateFlags & EUpdating) == 0) //else frame is skipped
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
871 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
872 return LockSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
873 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
874 return NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
875 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
876
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
877 /*
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
878 void CDsa::RunL()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
879 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
880 iStateFlags &= ~EUpdating;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
881 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
882
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
883
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
884 void CDsa::DoCancel()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
885 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
886 iStateFlags &= ~EUpdating;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
887 //nothing can do, just wait?
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
888 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
889 */
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
890
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
891
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
892 TInt CDsa::AllocSurface(TBool aHwSurface, const TSize& aSize, TDisplayMode aMode)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
893 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
894 if(aHwSurface && aMode != DisplayMode())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
895 return KErrArgument;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
896
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
897 iSourceMode = aMode;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
898
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
899 iSourceBpp = BytesPerPixel(aMode);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
900
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
901 const TSize size = WindowSize();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
902 if(aSize.iWidth > size.iWidth)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
903 return KErrTooBig;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
904 if(aSize.iHeight > size.iHeight)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
905 return KErrTooBig;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
906
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
907 TRAPD(err, CreateSurfaceL());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
908 if(err != KErrNone)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
909 return err;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
910
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
911 SetCopyFunction();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
912
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
913 return KErrNone;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
914 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
915
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
916
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
917 void CDsa::CreateZoomerL(const TSize& aSize)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
918 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
919 iSwSize = aSize;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
920 iStateFlags |= EResizeRequest;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
921 CreateSurfaceL();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
922 SetTargetRect();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
923 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
924
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
925
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
926 /*
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
927 void SaveBmp(const TDesC& aName, const TAny* aData, TInt aLength, const TSize& aSz, TDisplayMode aMode)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
928 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
929 CFbsBitmap* s = new CFbsBitmap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
930 s->Create(aSz, aMode);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
931 s->LockHeap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
932 TUint32* addr = s->DataAddress();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
933 Mem::Copy(addr, aData, aLength);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
934 s->UnlockHeap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
935 s->Save(aName);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
936 s->Reset();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
937 delete s;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
938 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
939
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
940 void SaveBmp(const TDesC& aName, const TUint32* aData, const TSize& aSz)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
941 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
942 CFbsBitmap* s = new CFbsBitmap();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
943 s->Create(aSz, EColor64K);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
944 TBitmapUtil bmp(s);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
945 bmp.Begin(TPoint(0, 0));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
946 for(TInt j = 0; j < aSz.iHeight; j++)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
947 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
948 bmp.SetPos(TPoint(0, j));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
949 for(TInt i = 0; i < aSz.iWidth; i++)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
950 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
951 bmp.SetPixel(*aData);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
952 aData++;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
953 bmp.IncXPos();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
954 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
955 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
956 bmp.End();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
957 s->Save(aName);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
958 s->Reset();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
959 delete s;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
960 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
961
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
962 TBuf<16> FooName(TInt aFoo)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
963 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
964 TBuf<16> b;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
965 b.Format(_L("C:\\pic%d.mbm"), aFoo);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
966 return b;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
967 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
968
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
969 */
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
970
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
971
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
972 void CDsa::ClipCopy(TUint8* aTarget,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
973 const TUint8* aSource,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
974 const TRect& aUpdateRect,
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
975 const TRect& aSourceRect) const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
976 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
977 const TDsa dsa(*this);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
978 switch(iSourceBpp)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
979 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
980 case 1:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
981 ::ClipCopy<TUint32, TUint8>(dsa, aTarget, aSource, aUpdateRect, aSourceRect);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
982 break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
983 case 2:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
984 ::ClipCopy<TUint32, TUint16>(dsa, aTarget, aSource, aUpdateRect, aSourceRect);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
985 break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
986 case 4:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
987 ::ClipCopy<TUint32, TUint32>(dsa, aTarget, aSource, aUpdateRect, aSourceRect);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
988 break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
989 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
990 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
991
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
992
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
993 void CDsa::Wipe() //dont call in drawing
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
994 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
995 if(IsDsaAvailable())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
996 Wipe(iTargetBpp * SwSize().iWidth * SwSize().iHeight);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
997 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
998
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
999 void CDsa::SetCopyFunction()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1000 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1001 //calculate offset to correct function in iCFTable according to given parameters
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1002 TInt function = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1003 const TInt KCopyFunctions = 4;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1004 const TInt KOffsetToNative = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1005 const TInt KOffsetTo256 = KOffsetToNative + KCopyFunctions;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1006 const TInt KOffsetToOtherModes = KOffsetTo256 + KCopyFunctions;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1007 const TInt KOffsetTo90Functions = 1;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1008 const TInt KOffsetTo180Functions = 2;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1009
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1010 if(iSourceMode == DisplayMode())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1011 function = KOffsetToNative; //0
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1012 else if(iSourceMode == EColor256)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1013 function = KOffsetTo256; //4
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1014 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1015 function = KOffsetToOtherModes; //8
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1016
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1017 if(iStateFlags & EOrientation90)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1018 function += KOffsetTo90Functions; // + 1
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1019 if(iStateFlags & EOrientation180)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1020 function += KOffsetTo180Functions; //+ 2
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1021
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1022 iCopyFunction = iCFTable[function];
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1023
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1024 Wipe();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1025 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1026
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1027 inline void Rotate(TRect& aRect)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1028 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1029 const TInt dx = aRect.iBr.iX - aRect.iTl.iX;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1030 const TInt dy = aRect.iBr.iY - aRect.iTl.iY;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1031
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1032 aRect.iBr.iX = aRect.iTl.iX + dy;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1033 aRect.iBr.iY = aRect.iTl.iY + dx;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1034
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1035 const TInt tmp = aRect.iTl.iX;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1036 aRect.iTl.iX = aRect.iTl.iY;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1037 aRect.iTl.iY = tmp;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1038 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1039
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1040 /*
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1041 int bar = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1042 */
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1043
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1044 TBool CDsa::AddUpdateRect(const TUint8* aBits, const TRect& aUpdateRect, const TRect& aRect)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1045 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1046
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1047 if(iStateFlags & EOrientationChanged)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1048 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1049 iStateFlags &= ~EOrientationFlags;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1050 iStateFlags |= iNewFlags;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1051 SetCopyFunction();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1052 iStateFlags &= ~EOrientationChanged;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1053 EpocSdlEnv::WaitDeviceChange();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1054 return EFalse; //skip this frame as data is may be changed
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1055 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1056
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1057 if(iTargetAddr == NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1058 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1059 iTargetAddr = LockHwSurface();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1060 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1061
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1062 TUint8* target = iTargetAddr;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1063 if(target == NULL)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1064 return EFalse;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1065
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1066
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1067 TRect targetRect = TRect(TPoint(0, 0), SwSize());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1068
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1069 TRect sourceRect = aRect;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1070 TRect updateRect = aUpdateRect;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1071
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1072 // TPoint move(0, 0);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1073
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1074
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1075 if(iStateFlags & EOrientation90)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1076 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1077 Rotate(sourceRect);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1078 Rotate(updateRect);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1079 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1080
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1081 if(iSourceMode != DisplayMode() || targetRect != sourceRect || targetRect != updateRect || ((iStateFlags & EOrientationFlags) != 0))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1082 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1083 sourceRect.Intersection(targetRect); //so source always smaller or equal than target
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1084 //updateRect.Intersection(targetRect);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1085 ClipCopy(target, aBits, updateRect, sourceRect);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1086 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1087 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1088 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1089 const TInt byteCount = aRect.Width() * aRect.Height() * iSourceBpp; //this could be stored
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1090 Mem::Copy(target, aBits, byteCount);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1091 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1092
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1093 return ETrue;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1094 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1095
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1096
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1097 void CDsa::UpdateSwSurface()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1098 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1099 iTargetAddr = NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1100 UnlockHwSurface(); //could be faster if does not use AO, but only check status before redraw, then no context switch needed
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1101 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1102
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1103
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1104
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1105
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1106 void CDsa::DoStop()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1107 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1108 if(IsDsaAvailable())
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1109 iStateFlags |= ESdlThreadExplicitStop;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1110 Stop();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1111 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1112
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1113
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1114 void CDsa::Stop()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1115 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1116 iStateFlags &= ~ERunning;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1117 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1118
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1119 void CDsa::Start()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1120 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1121 iStateFlags |= ERunning;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1122
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1123 iStateFlags &= ~ESdlThreadExplicitStop;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1124
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1125 if(iStateFlags & ESdlThreadSuspend)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1126 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1127 EpocSdlEnv::Resume();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1128 iStateFlags &= ~ ESdlThreadSuspend;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1129 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1130 EpocSdlEnv::ObserverEvent(MSDLObserver::EEventWindowReserved);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1131 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1132
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1133
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1134 TBool CDsa::Blitter(CFbsBitmap& aBmp)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1135 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1136 return iBlitter && iBlitter->BitBlt(Gc(), aBmp, HwRect(), SwSize());
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1137 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1138
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1139 void CDsa::SetBlitter(MBlitter* aBlitter)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1140 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1141 iBlitter = aBlitter;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1142 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1143
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1144
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1145 TPoint CDsa::WindowCoordinates(const TPoint& aPoint) const
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1146 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1147 TPoint pos = aPoint - iScreenRect.iTl;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1148 const TSize asz = iScreenRect.Size();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1149 if(iStateFlags & EOrientation180)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1150 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1151 pos.iX = asz.iWidth - pos.iX;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1152 pos.iY = asz.iHeight - pos.iY;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1153 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1154 if(iStateFlags & EOrientation90)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1155 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1156 pos.iX = aPoint.iY;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1157 pos.iY = aPoint.iX;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1158 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1159 pos.iX <<= 16;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1160 pos.iY <<= 16;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1161 pos.iX /= asz.iWidth;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1162 pos.iY /= asz.iHeight;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1163 pos.iX *= iSwSize.iWidth;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1164 pos.iY *= iSwSize.iHeight;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1165 pos.iX >>= 16;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1166 pos.iY >>= 16;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1167 return pos;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1168 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1169
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1170 void CDsa::SetTargetRect()
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1171 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1172 iTargetRect = iScreenRect;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1173 if(iStateFlags & EResizeRequest && EpocSdlEnv::Flags(CSDL::EAllowImageResizeKeepRatio))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1174 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1175 const TSize asz = iScreenRect.Size();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1176 const TSize sz = iSwSize;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1177
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1178 TRect rect;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1179
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1180 const TInt dh = (sz.iHeight << 16) / sz.iWidth;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1181
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1182 if((asz.iWidth * dh ) >> 16 <= asz.iHeight)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1183 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1184 rect.SetRect(TPoint(0, 0), TSize(asz.iWidth, (asz.iWidth * dh) >> 16));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1185 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1186 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1187 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1188 const TInt dw = (sz.iWidth << 16) / sz.iHeight;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1189 rect.SetRect(TPoint(0, 0), TSize((asz.iHeight * dw) >> 16, asz.iHeight));
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1190 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1191 rect.Move((asz.iWidth - rect.Size().iWidth) >> 1, (asz.iHeight - rect.Size().iHeight) >> 1);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1192
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1193 iTargetRect = rect;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1194 iTargetRect.Move(iScreenRect.iTl);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1195
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1196 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1197 if(!(iStateFlags & EResizeRequest))
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1198 iSwSize = iScreenRect.Size();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1199
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1200 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1201
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1202
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1203 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1204
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1205 void CDsa::Copy256(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1206 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1207 TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1208 const TUint32* endt = target + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1209 const TUint8* source = aSource;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1210 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1211 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1212 *target++ = aDsa.iLut256[*source++];
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1213 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1214 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1215
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1216 void CDsa::Copy256Reversed(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1217 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1218 const TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1219 TUint32* endt = aTarget + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1220 const TUint8* source = aSource;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1221 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1222 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1223 *(--endt) = aDsa.iLut256[*source++];
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1224 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1225 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1226
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1227 void CDsa::Copy256Flip(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1228 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1229 TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1230 const TUint32* endt = target + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1231 const TUint8* column = aSource;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1232
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1233 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1234 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1235 *target++ = aDsa.iLut256[*column];
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1236 column += aLineLen;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1237 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1238 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1239
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1240 void CDsa::Copy256FlipReversed(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1241 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1242 const TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1243 TUint32* endt = aTarget + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1244 const TUint8* column = aSource;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1245
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1246 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1247 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1248 *(--endt) = aDsa.iLut256[*column];
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1249 column += aLineLen;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1250 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1251 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1252
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1253 void CDsa::CopyMem(const CDsa& /*aDsa*/, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1254 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1255 const TUint32* src = reinterpret_cast<const TUint32*>(aSource);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1256 Mem::Copy(aTarget, src, aBytes << 2);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1257 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1258
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1259 void CDsa::CopyMemFlip(const CDsa& /*aDsa*/, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1260 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1261 TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1262 const TUint32* endt = target + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1263 const TUint32* column = reinterpret_cast<const TUint32*>(aSource);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1264
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1265 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1266 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1267 *target++ = *column;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1268 column += aLineLen;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1269 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1270 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1271
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1272 void CDsa::CopyMemReversed(const CDsa& /*aDsa*/, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1273 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1274 const TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1275 TUint32* endt = aTarget + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1276 const TUint32* source = reinterpret_cast<const TUint32*>(aSource);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1277 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1278 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1279 *(--endt) = *source++;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1280 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1281 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1282
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1283
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1284 void CDsa::CopyMemFlipReversed(const CDsa& /*aDsa*/, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1285 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1286 const TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1287 TUint32* endt = aTarget + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1288 const TUint32* column = reinterpret_cast<const TUint32*>(aSource);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1289
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1290 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1291 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1292 *(--endt) = *column;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1293 column += aLineLen;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1294 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1295 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1296
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1297 /*
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1298
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1299 LOCAL_C TRgb rgb16MA(TInt aValue)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1300 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1301 return TRgb::Color16MA(aValue);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1302 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1303 */
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1304 NONSHARABLE_CLASS(MRgbCopy)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1305 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1306 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1307 virtual void Copy(TUint32* aTarget, const TUint8* aSource, TInt aBytes, TBool aReversed) = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1308 virtual void FlipCopy(TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen, TBool aReversed) = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1309 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1310
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1311 template <class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1312 NONSHARABLE_CLASS(TRgbCopy) : public MRgbCopy
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1313 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1314 public:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1315 TRgbCopy(TDisplayMode aMode);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1316 void* operator new(TUint aBytes, TAny* aMem);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1317 void Copy(TUint32* aTarget, const TUint8* aSource, TInt aBytes, TBool aReversed);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1318 void FlipCopy(TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen, TBool aReversed);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1319 static TUint32 Gray256(const TUint8& aPixel);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1320 static TUint32 Color256(const TUint8& aPixel);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1321 static TUint32 Color4K(const TUint16& aPixel);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1322 static TUint32 Color64K(const TUint16& aPixel);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1323 static TUint32 Color16M(const TUint32& aPixel);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1324 static TUint32 Color16MU(const TUint32& aPixel);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1325 static TUint32 Color16MA(const TUint32& aPixel);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1326 private:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1327 typedef TUint32 (*TRgbFunc) (const T& aValue);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1328 TRgbFunc iFunc;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1329 };
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1330
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1331
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1332 template <class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1333 void* TRgbCopy<T>::operator new(TUint /*aBytes*/, TAny* aMem)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1334 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1335 return aMem;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1336 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1337
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1338 template <class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1339 TRgbCopy<T>::TRgbCopy(TDisplayMode aMode)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1340 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1341 switch(aMode)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1342 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1343 case EGray256 : iFunc = (TRgbFunc) Gray256; break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1344 case EColor256 : iFunc = (TRgbFunc) Color256; break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1345 case EColor4K : iFunc = (TRgbFunc) Color4K; break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1346 case EColor64K : iFunc = (TRgbFunc) Color64K; break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1347 case EColor16M : iFunc = (TRgbFunc) Color16M; break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1348 case EColor16MU : iFunc = (TRgbFunc) Color16MU; break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1349 case EColor16MA : iFunc = (TRgbFunc) Color16MA; break;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1350 default:
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1351 PANIC(KErrNotSupported);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1352 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1353 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1354
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1355 template <class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1356 void TRgbCopy<T>::Copy(TUint32* aTarget, const TUint8* aSource, TInt aBytes, TBool aReversed)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1357 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1358 const T* source = reinterpret_cast<const T*>(aSource);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1359 TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1360 TUint32* endt = target + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1361
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1362 if(aReversed)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1363 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1364 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1365 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1366 const T value = *source++;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1367 *(--endt) = iFunc(value);//iFunc(value).Value();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1368 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1369 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1370 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1371 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1372 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1373 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1374 const T value = *source++;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1375 *target++ = iFunc(value);//iFunc(value).Value();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1376 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1377 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1378 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1379
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1380 template <class T>
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1381 void TRgbCopy<T>::FlipCopy(TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen, TBool aReversed)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1382 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1383 const T* column = reinterpret_cast<const T*>(aSource);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1384 TUint32* target = aTarget;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1385 TUint32* endt = target + aBytes;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1386
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1387 if(aReversed)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1388 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1389 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1390 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1391 *(--endt) = iFunc(*column);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1392 column += aLineLen;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1393 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1394 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1395 else
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1396 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1397 while(target < endt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1398 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1399 *target++ = iFunc(*column);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1400 column += aLineLen;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1401 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1402 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1403 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1404
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1405 template <class T> TUint32 TRgbCopy<T>::Gray256(const TUint8& aPixel)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1406 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1407 const TUint32 px = aPixel << 16 | aPixel << 8 | aPixel;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1408 return px;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1409 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1410
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1411 template <class T> TUint32 TRgbCopy<T>::Color256(const TUint8& aPixel)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1412 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1413 return TRgb::Color256(aPixel).Value();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1414 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1415
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1416 template <class T> TUint32 TRgbCopy<T>::Color4K(const TUint16& aPixel)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1417 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1418 TUint32 col = (aPixel & 0xF00) << 12;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1419 col |= (aPixel & 0xF00) << 8;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1420
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1421 col |= (aPixel & 0x0F0) << 8;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1422 col |= (aPixel & 0x0F0);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1423
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1424 col |= (aPixel & 0x00F) << 4;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1425 col |= (aPixel & 0x00F);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1426
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1427 return col;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1428 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1429
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1430 template <class T> TUint32 TRgbCopy<T>::Color64K(const TUint16& aPixel)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1431 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1432 TUint32 col = (aPixel & 0xF800)<< 8;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1433 col |= (aPixel & 0xE000) << 3;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1434
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1435 col |= (aPixel & 0x07E0) << 5;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1436 col |= (aPixel & 0xC0) >> 1;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1437
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1438 col |= (aPixel & 0x07E0) << 3;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1439 col |= (aPixel & 0x1C) >> 2;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1440
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1441 return col;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1442 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1443
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1444 template <class T> TUint32 TRgbCopy<T>::Color16M(const TUint32& aPixel)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1445 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1446 return TRgb::Color16M(aPixel).Value();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1447 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1448
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1449 template <class T> TUint32 TRgbCopy<T>::Color16MU(const TUint32& aPixel)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1450 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1451 return TRgb::Color16MU(aPixel).Value();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1452 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1453
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1454 template <class T> TUint32 TRgbCopy<T>::Color16MA(const TUint32& aPixel)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1455 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1456 return TRgb::Color16MA(aPixel).Value();
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1457 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1458
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1459 typedef TUint64 TStackMem;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1460
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1461 LOCAL_C MRgbCopy* GetCopy(TAny* mem, TDisplayMode aMode)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1462 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1463 if(aMode == EColor256 || aMode == EGray256)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1464 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1465 return new (mem) TRgbCopy<TUint8>(aMode);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1466 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1467 if(aMode == EColor4K || aMode == EColor64K)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1468 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1469 return new (mem) TRgbCopy<TUint16>(aMode);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1470 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1471 if(aMode == EColor16M || aMode == EColor16MU || aMode == EColor16MA)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1472 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1473 return new (mem) TRgbCopy<TUint32>(aMode);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1474 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1475 PANIC(KErrNotSupported);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1476 return NULL;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1477 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1478
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1479
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1480 void CDsa::CopySlowFlipReversed(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1481 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1482 TStackMem mem = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1483 GetCopy(&mem, aDsa.iSourceMode)->FlipCopy(aTarget, aSource, aBytes, aLineLen, ETrue);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1484 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1485
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1486 void CDsa::CopySlowFlip(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt aLineLen)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1487 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1488 TStackMem mem = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1489 GetCopy(&mem, aDsa.iSourceMode)->FlipCopy(aTarget, aSource, aBytes, aLineLen, EFalse);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1490 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1491
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1492 void CDsa::CopySlow(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1493 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1494 TStackMem mem = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1495 GetCopy(&mem, aDsa.iSourceMode)->Copy(aTarget, aSource, aBytes, EFalse);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1496 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1497
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1498 void CDsa::CopySlowReversed(const CDsa& aDsa, TUint32* aTarget, const TUint8* aSource, TInt aBytes, TInt)
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1499 {
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1500 TStackMem mem = 0;
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1501 GetCopy(&mem, aDsa.iSourceMode)->Copy(aTarget, aSource, aBytes, ETrue);
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1502 }
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1503
e85e65aec22f Added S60 port.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1504 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////7