sl@0
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "graphics/WSGRAPHICMSGBUF.H"
|
sl@0
|
17 |
#include "DrawSection.h"
|
sl@0
|
18 |
#include "CommandBuffer.h"
|
sl@0
|
19 |
#include "BitmapCache.h"
|
sl@0
|
20 |
#include "FontsCache.h"
|
sl@0
|
21 |
#include "DrawableCache.h"
|
sl@0
|
22 |
#include <graphics/wsgraphicscontext.h>
|
sl@0
|
23 |
#include <graphics/wsdrawablesourceprovider.h>
|
sl@0
|
24 |
#include <graphics/wsdrawresource.h>
|
sl@0
|
25 |
#include "../SERVER/bitgditomwsgraphicscontextmappings.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
const TInt KBufferSize = 1024;
|
sl@0
|
28 |
|
sl@0
|
29 |
EXPORT_C CCommandBuffer* CCommandBuffer::NewL()
|
sl@0
|
30 |
{
|
sl@0
|
31 |
CCommandBuffer* buffer = new (ELeave) CCommandBuffer;
|
sl@0
|
32 |
CleanupStack::PushL(buffer);
|
sl@0
|
33 |
buffer->ConstructL();
|
sl@0
|
34 |
CleanupStack::Pop(buffer);
|
sl@0
|
35 |
return buffer;
|
sl@0
|
36 |
}
|
sl@0
|
37 |
|
sl@0
|
38 |
CCommandBuffer::CCommandBuffer()
|
sl@0
|
39 |
{
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
EXPORT_C CCommandBuffer::~CCommandBuffer()
|
sl@0
|
43 |
{
|
sl@0
|
44 |
iDrawSections.ResetAndDestroy();
|
sl@0
|
45 |
iDrawSections.Close();
|
sl@0
|
46 |
iBufReadStream.Close();
|
sl@0
|
47 |
iClippingRegion.Close();
|
sl@0
|
48 |
iIntersectedRegion.Close();
|
sl@0
|
49 |
delete iRecordSegBuf;
|
sl@0
|
50 |
delete iBitmapCache;
|
sl@0
|
51 |
delete iFontCache;
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
void CCommandBuffer::ConstructL()
|
sl@0
|
55 |
{
|
sl@0
|
56 |
iBitmapCache = new (ELeave) CBitmapCache;
|
sl@0
|
57 |
iRecordSegBuf = CBufSeg::NewL(KBufferSize);
|
sl@0
|
58 |
iFontCache = new (ELeave) CFontsCache;
|
sl@0
|
59 |
}
|
sl@0
|
60 |
|
sl@0
|
61 |
/**
|
sl@0
|
62 |
Resets the entire commandbuffer.
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
void CCommandBuffer::Reset()
|
sl@0
|
65 |
{
|
sl@0
|
66 |
if(iRecordSegBuf)
|
sl@0
|
67 |
iRecordSegBuf->Reset();
|
sl@0
|
68 |
|
sl@0
|
69 |
iError = KErrNone;
|
sl@0
|
70 |
iOrigin = TPoint(0,0);
|
sl@0
|
71 |
iClippingRegion.Clear();
|
sl@0
|
72 |
iDrawSections.ResetAndDestroy();
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
/**
|
sl@0
|
76 |
Externalizes commandbuffer sections into a format which makes it possible to send over IPC.
|
sl@0
|
77 |
If ETrue is sent as a parameter to this method, the entire commandbuffer will be externalized,
|
sl@0
|
78 |
otherwise only sections which has not been externalized before will be externalized. Note that if only
|
sl@0
|
79 |
not externalized sections is asked for, the flag will be reset on that section so next call
|
sl@0
|
80 |
to ExternalizeLC will not externalize that section.
|
sl@0
|
81 |
|
sl@0
|
82 |
@param aMsgBuf A buffer used to externalize the commandbuffer to.
|
sl@0
|
83 |
@param aEntireBuffer If ETrue, the entire commandbuffer will be externalized, otherwise only sections which has not been externalized before.
|
sl@0
|
84 |
*/
|
sl@0
|
85 |
void CCommandBuffer::ExternalizeL(RWsGraphicMsgBuf& aMsgBuf, TBool aEntireBuffer)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
// Add drawsections to aMsgBuf
|
sl@0
|
88 |
const TInt sectionCount = iDrawSections.Count();
|
sl@0
|
89 |
for(TInt j = 0; j < sectionCount; j++)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
CDrawSection* section = iDrawSections[j];
|
sl@0
|
92 |
if(aEntireBuffer || !section->HasBeenExternalized())
|
sl@0
|
93 |
{
|
sl@0
|
94 |
section->ExternalizeL(aMsgBuf);
|
sl@0
|
95 |
section->SetHasBeenExternalized(ETrue);
|
sl@0
|
96 |
}
|
sl@0
|
97 |
}
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
/**
|
sl@0
|
101 |
Internalizes the entire commandbuffer from buffer containing information about all drawsections and drawcommands.
|
sl@0
|
102 |
|
sl@0
|
103 |
@param aBuf A buffer containing information about all drawsections and drawcommands.
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
EXPORT_C void CCommandBuffer::InternalizeL(const TDesC8& aBuf)
|
sl@0
|
106 |
{
|
sl@0
|
107 |
// Reset the commandbuffer
|
sl@0
|
108 |
iRecordSegBuf->Reset();
|
sl@0
|
109 |
InternalizeAppendL(aBuf);
|
sl@0
|
110 |
}
|
sl@0
|
111 |
|
sl@0
|
112 |
/**
|
sl@0
|
113 |
Internalizes and appends from a buffer containing information about some drawsections and drawcommands.
|
sl@0
|
114 |
|
sl@0
|
115 |
@param aBuf A buffer containing information about some drawsections and drawcommands.
|
sl@0
|
116 |
*/
|
sl@0
|
117 |
EXPORT_C void CCommandBuffer::InternalizeAppendL(const TDesC8& aBuf)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
// Reset the commandbuffer
|
sl@0
|
120 |
TWsGraphicMsgBufParser parser(aBuf);
|
sl@0
|
121 |
|
sl@0
|
122 |
// Load drawsections
|
sl@0
|
123 |
const TInt count = parser.Count();
|
sl@0
|
124 |
for(TInt i = 0; i < count; i++)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
CDrawSection* drawSection = CDrawSection::NewL();;
|
sl@0
|
127 |
CleanupStack::PushL(drawSection);
|
sl@0
|
128 |
User::LeaveIfError(drawSection->LoadL(parser, i));
|
sl@0
|
129 |
iDrawSections.AppendL(drawSection);
|
sl@0
|
130 |
CleanupStack::Pop(drawSection);
|
sl@0
|
131 |
}
|
sl@0
|
132 |
|
sl@0
|
133 |
// Tidy the iDrawSection array so completely blocked sections will be removed
|
sl@0
|
134 |
Tidy();
|
sl@0
|
135 |
}
|
sl@0
|
136 |
|
sl@0
|
137 |
/**
|
sl@0
|
138 |
@return the current active clipping region of the commandbuffer.
|
sl@0
|
139 |
*/
|
sl@0
|
140 |
EXPORT_C const TRegion& CCommandBuffer::ClippingRegion() const
|
sl@0
|
141 |
{
|
sl@0
|
142 |
return *iActiveMasterClippingRegion;
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
/**
|
sl@0
|
146 |
Prepares to record new drawcommands for a drawsection.
|
sl@0
|
147 |
This method is called from CRemoteGc::Activate().
|
sl@0
|
148 |
*/
|
sl@0
|
149 |
void CCommandBuffer::Prepare(const TRect& aDrawRect)
|
sl@0
|
150 |
{
|
sl@0
|
151 |
iDrawSectionRect = aDrawRect;
|
sl@0
|
152 |
iError = KErrNone;
|
sl@0
|
153 |
if(iRecordSegBuf)
|
sl@0
|
154 |
iRecordSegBuf->Delete(0, iRecordSegBuf->Size()); // Reset record buffer
|
sl@0
|
155 |
else
|
sl@0
|
156 |
TRAP(iError, iRecordSegBuf = CBufSeg::NewL(KBufferSize));
|
sl@0
|
157 |
}
|
sl@0
|
158 |
|
sl@0
|
159 |
/**
|
sl@0
|
160 |
Finishes the recording of drawcommands for a drawsection.
|
sl@0
|
161 |
This method is called from CRemoteGc::Deactivate().
|
sl@0
|
162 |
|
sl@0
|
163 |
@param aDrawRect The drawrect of the recorded drawcommands.
|
sl@0
|
164 |
@param aBoundingRect The boundingrect of the recorded drawcommands.
|
sl@0
|
165 |
*/
|
sl@0
|
166 |
TInt CCommandBuffer::Finish(const TRect& aDrawRect, const TRect& aBoundingRect, TBool aHasBitmapCommand)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
// If some error occured during the recording of this section, dont add the section
|
sl@0
|
169 |
if(!iError)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
CDrawSection* drawSection = NULL;
|
sl@0
|
172 |
TRAP(iError, drawSection = CDrawSection::NewL(aDrawRect, aBoundingRect, aHasBitmapCommand))
|
sl@0
|
173 |
if(iError)
|
sl@0
|
174 |
return iError;
|
sl@0
|
175 |
|
sl@0
|
176 |
// If boundingRect is empty clear the drawcommands added
|
sl@0
|
177 |
if(aBoundingRect.IsEmpty())
|
sl@0
|
178 |
iRecordSegBuf->Delete(0, iRecordSegBuf->Size());
|
sl@0
|
179 |
|
sl@0
|
180 |
iRecordSegBuf->Compress();
|
sl@0
|
181 |
drawSection->SetBuffer(iRecordSegBuf); //Takes ownership of the memory allocated by iRecordSegBuf
|
sl@0
|
182 |
iRecordSegBuf = NULL;
|
sl@0
|
183 |
if(CheckForDuplicate(*drawSection))
|
sl@0
|
184 |
{
|
sl@0
|
185 |
delete drawSection;
|
sl@0
|
186 |
return KErrAlreadyExists;
|
sl@0
|
187 |
}
|
sl@0
|
188 |
|
sl@0
|
189 |
iError = iDrawSections.Append(drawSection);
|
sl@0
|
190 |
if(iError)
|
sl@0
|
191 |
delete drawSection;
|
sl@0
|
192 |
else
|
sl@0
|
193 |
{
|
sl@0
|
194 |
Tidy();
|
sl@0
|
195 |
if(iDrawSections.Count() == 0 || AllSectionsExternalized())
|
sl@0
|
196 |
return KErrGeneral;
|
sl@0
|
197 |
}
|
sl@0
|
198 |
}
|
sl@0
|
199 |
|
sl@0
|
200 |
return iError;
|
sl@0
|
201 |
}
|
sl@0
|
202 |
|
sl@0
|
203 |
/**
|
sl@0
|
204 |
Remove drawsections that is completely blocked by another drawsection.
|
sl@0
|
205 |
*/
|
sl@0
|
206 |
void CCommandBuffer::Tidy()
|
sl@0
|
207 |
{
|
sl@0
|
208 |
RRegion region;
|
sl@0
|
209 |
TInt count = 0;
|
sl@0
|
210 |
for(TInt i = 0; i < (count = iDrawSections.Count()); i++)
|
sl@0
|
211 |
{
|
sl@0
|
212 |
TRect rect1 = iDrawSections[i]->DrawRect();
|
sl@0
|
213 |
region.Clear();
|
sl@0
|
214 |
region.AddRect(rect1);
|
sl@0
|
215 |
for(TInt j = i + 1; j < count; j++)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
TRect rect2 = iDrawSections[j]->DrawRect();
|
sl@0
|
218 |
region.SubRect(rect2);
|
sl@0
|
219 |
}
|
sl@0
|
220 |
|
sl@0
|
221 |
if(region.IsEmpty())
|
sl@0
|
222 |
{
|
sl@0
|
223 |
delete iDrawSections[i];
|
sl@0
|
224 |
iDrawSections.Remove(i--);
|
sl@0
|
225 |
}
|
sl@0
|
226 |
}
|
sl@0
|
227 |
region.Close();
|
sl@0
|
228 |
// coverity[extend_simple_error]
|
sl@0
|
229 |
}
|
sl@0
|
230 |
|
sl@0
|
231 |
/**
|
sl@0
|
232 |
@return ETrue if all sections in the commandbuffer have been externalized, otherwise EFalse.
|
sl@0
|
233 |
*/
|
sl@0
|
234 |
TBool CCommandBuffer::AllSectionsExternalized() const
|
sl@0
|
235 |
{
|
sl@0
|
236 |
const TInt count = iDrawSections.Count();
|
sl@0
|
237 |
for(TInt i = 0; i < count; i++)
|
sl@0
|
238 |
{
|
sl@0
|
239 |
if(!iDrawSections[i]->HasBeenExternalized())
|
sl@0
|
240 |
return EFalse;
|
sl@0
|
241 |
}
|
sl@0
|
242 |
return ETrue;
|
sl@0
|
243 |
}
|
sl@0
|
244 |
|
sl@0
|
245 |
/**
|
sl@0
|
246 |
Checks if there exists any duplicate of aDrawSection already in the iDrawSection array.
|
sl@0
|
247 |
|
sl@0
|
248 |
@param aDrawSection The drawsection to look for a duplicate of.
|
sl@0
|
249 |
@return ETrue if a duplicate was found, otherwise EFalse.
|
sl@0
|
250 |
*/
|
sl@0
|
251 |
TBool CCommandBuffer::CheckForDuplicate(const CDrawSection& aDrawSection) const
|
sl@0
|
252 |
{
|
sl@0
|
253 |
const TInt count = iDrawSections.Count();
|
sl@0
|
254 |
for(TInt i = 0; i < count; i++)
|
sl@0
|
255 |
{
|
sl@0
|
256 |
if(!iDrawSections[i]->IsIdentical(aDrawSection))
|
sl@0
|
257 |
continue;
|
sl@0
|
258 |
|
sl@0
|
259 |
// Check if there is some drawsection that overlaps the section we found identical,
|
sl@0
|
260 |
// if that is the case it is not a duplicate
|
sl@0
|
261 |
for(TInt j = i + 1; j < count; j++)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
TRect compareRect = iDrawSections[j]->DrawRect();
|
sl@0
|
264 |
if(aDrawSection.DrawRect().Intersects(compareRect))
|
sl@0
|
265 |
return EFalse; //Found a drawrect that overlapped, no duplicate exists then
|
sl@0
|
266 |
}
|
sl@0
|
267 |
|
sl@0
|
268 |
// Found duplicate
|
sl@0
|
269 |
return ETrue;
|
sl@0
|
270 |
}
|
sl@0
|
271 |
|
sl@0
|
272 |
return EFalse;
|
sl@0
|
273 |
}
|
sl@0
|
274 |
|
sl@0
|
275 |
/**
|
sl@0
|
276 |
Updates the clippingregion for a specific drawsection.
|
sl@0
|
277 |
|
sl@0
|
278 |
@param aDrawSectionIndex The index in iDrawSections of the drawsection to update the clippingregion for.
|
sl@0
|
279 |
*/
|
sl@0
|
280 |
void CCommandBuffer::UpdateClippingRegion(TInt aDrawSectionIndex)
|
sl@0
|
281 |
{
|
sl@0
|
282 |
__ASSERT_DEBUG(aDrawSectionIndex < iDrawSections.Count(), User::Invariant());
|
sl@0
|
283 |
|
sl@0
|
284 |
iDrawSectionClippingRegion.Clear();
|
sl@0
|
285 |
if (iMasterClippingRegion)
|
sl@0
|
286 |
{
|
sl@0
|
287 |
iDrawSectionClippingRegion.Copy(*iMasterClippingRegion);
|
sl@0
|
288 |
}
|
sl@0
|
289 |
else
|
sl@0
|
290 |
{
|
sl@0
|
291 |
TRect rect = iMasterClippingRect;
|
sl@0
|
292 |
rect.Move(iMasterOrigin);
|
sl@0
|
293 |
iDrawSectionClippingRegion.AddRect(rect);
|
sl@0
|
294 |
}
|
sl@0
|
295 |
|
sl@0
|
296 |
const TInt count = iDrawSections.Count();
|
sl@0
|
297 |
for(TInt i = aDrawSectionIndex + 1; i < count; ++i)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
TRect rect = iDrawSections[i]->DrawRect();
|
sl@0
|
300 |
rect.Move(iMasterOrigin);
|
sl@0
|
301 |
iDrawSectionClippingRegion.SubRect(rect);
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
if (iDrawSectionClippingRegion.CheckError())
|
sl@0
|
305 |
iActiveMasterClippingRegion = iMasterClippingRegion;
|
sl@0
|
306 |
else
|
sl@0
|
307 |
iActiveMasterClippingRegion = &iDrawSectionClippingRegion;
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
/**
|
sl@0
|
311 |
Writes data of a specific length to the recordbuffer.
|
sl@0
|
312 |
|
sl@0
|
313 |
@param aPtr The data to write.
|
sl@0
|
314 |
@param aLength The length of the data to write.
|
sl@0
|
315 |
*/
|
sl@0
|
316 |
void CCommandBuffer::Write(const TUint8* aPtr, TUint aLength)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
if(iError)
|
sl@0
|
319 |
return;
|
sl@0
|
320 |
|
sl@0
|
321 |
TRAP(iError, iRecordSegBuf->InsertL(iRecordSegBuf->Size(), aPtr, aLength))
|
sl@0
|
322 |
if(iError)
|
sl@0
|
323 |
return;
|
sl@0
|
324 |
}
|
sl@0
|
325 |
|
sl@0
|
326 |
/**
|
sl@0
|
327 |
Writes text to the recordbuffer.
|
sl@0
|
328 |
|
sl@0
|
329 |
@param aText The text to write to the recordbuffer.
|
sl@0
|
330 |
*/
|
sl@0
|
331 |
void CCommandBuffer::WriteText(const TDesC8 &aText)
|
sl@0
|
332 |
{
|
sl@0
|
333 |
if(iError)
|
sl@0
|
334 |
return;
|
sl@0
|
335 |
|
sl@0
|
336 |
// Append the total size of the text
|
sl@0
|
337 |
Write<TInt>(aText.Size());
|
sl@0
|
338 |
if(iError)
|
sl@0
|
339 |
return;
|
sl@0
|
340 |
|
sl@0
|
341 |
TRAP(iError, DoWriteTextL(aText));
|
sl@0
|
342 |
}
|
sl@0
|
343 |
|
sl@0
|
344 |
/**
|
sl@0
|
345 |
Writes text to the recordbuffer.
|
sl@0
|
346 |
|
sl@0
|
347 |
@param aText The text to write to the recordbuffer.
|
sl@0
|
348 |
*/
|
sl@0
|
349 |
void CCommandBuffer::WriteText(const TDesC16 &aText)
|
sl@0
|
350 |
{
|
sl@0
|
351 |
if(iError)
|
sl@0
|
352 |
return;
|
sl@0
|
353 |
|
sl@0
|
354 |
// Append the total size of the text
|
sl@0
|
355 |
Write<TInt>(aText.Size());
|
sl@0
|
356 |
if(iError)
|
sl@0
|
357 |
return;
|
sl@0
|
358 |
|
sl@0
|
359 |
TPtrC8 textPtr(reinterpret_cast<const TUint8*>(aText.Ptr()),aText.Size());
|
sl@0
|
360 |
TRAP(iError, DoWriteTextL(textPtr));
|
sl@0
|
361 |
}
|
sl@0
|
362 |
|
sl@0
|
363 |
/**
|
sl@0
|
364 |
Writes text to the recordbuffer.
|
sl@0
|
365 |
|
sl@0
|
366 |
@param aText The text to write to the recordbuffer.
|
sl@0
|
367 |
*/
|
sl@0
|
368 |
void CCommandBuffer::DoWriteTextL(const TDesC8 &aText)
|
sl@0
|
369 |
{
|
sl@0
|
370 |
iRecordSegBuf->InsertL(iRecordSegBuf->Size(), aText, aText.Size());
|
sl@0
|
371 |
}
|
sl@0
|
372 |
|
sl@0
|
373 |
/**
|
sl@0
|
374 |
Reads data with a specific length from iBufReadStream.
|
sl@0
|
375 |
|
sl@0
|
376 |
@param aPtr The read data is written to this paramenter.
|
sl@0
|
377 |
@param aLength The length of the data to be read.
|
sl@0
|
378 |
*/
|
sl@0
|
379 |
void CCommandBuffer::ReadL(TUint8* aPtr, TUint aLength)
|
sl@0
|
380 |
{
|
sl@0
|
381 |
iBufReadStream.ReadL(aPtr, aLength);
|
sl@0
|
382 |
}
|
sl@0
|
383 |
|
sl@0
|
384 |
/**
|
sl@0
|
385 |
Reads text from iBufReadStream.
|
sl@0
|
386 |
|
sl@0
|
387 |
@param aText The read text is put into this 8-bit buffer.
|
sl@0
|
388 |
*/
|
sl@0
|
389 |
void CCommandBuffer::ReadTextLC(TPtrC8& aText)
|
sl@0
|
390 |
{
|
sl@0
|
391 |
DoReadTextLC(aText,EFalse);
|
sl@0
|
392 |
}
|
sl@0
|
393 |
|
sl@0
|
394 |
/**
|
sl@0
|
395 |
Reads text from iBufReadStream.
|
sl@0
|
396 |
|
sl@0
|
397 |
@param aText The read text is put into this 16-bit buffer.
|
sl@0
|
398 |
*/
|
sl@0
|
399 |
void CCommandBuffer::ReadTextLC(TPtrC16& aText)
|
sl@0
|
400 |
{
|
sl@0
|
401 |
TPtrC8 text8;
|
sl@0
|
402 |
DoReadTextLC(text8,ETrue);
|
sl@0
|
403 |
aText.Set(reinterpret_cast<const TUint16*>(text8.Ptr()),text8.Size()/2);
|
sl@0
|
404 |
}
|
sl@0
|
405 |
|
sl@0
|
406 |
/**
|
sl@0
|
407 |
Reads text from iBufReadStream; used by ReadTextLC
|
sl@0
|
408 |
|
sl@0
|
409 |
@internalComponent
|
sl@0
|
410 |
*/
|
sl@0
|
411 |
void CCommandBuffer::DoReadTextLC(TPtrC8& aText,TBool a16Bit)
|
sl@0
|
412 |
{
|
sl@0
|
413 |
ASSERT(iBufRead);
|
sl@0
|
414 |
|
sl@0
|
415 |
TInt textSize;
|
sl@0
|
416 |
ReadL<TInt>(textSize); // Read the length of the text
|
sl@0
|
417 |
if(0 > textSize)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
User::Leave(KErrArgument);
|
sl@0
|
420 |
}
|
sl@0
|
421 |
|
sl@0
|
422 |
// attempt to do it inline
|
sl@0
|
423 |
const TInt pos = iBufReadStream.Source()->TellL(MStreamBuf::ERead).Offset();
|
sl@0
|
424 |
if(!a16Bit || !(pos & 1)) // check 16bit-aligned
|
sl@0
|
425 |
{
|
sl@0
|
426 |
const TPtrC8 remaining = iBufRead->Ptr(pos);
|
sl@0
|
427 |
if(remaining.Size() >= textSize) // can do inline!
|
sl@0
|
428 |
{
|
sl@0
|
429 |
CleanupStack::PushL((TAny*)NULL); // have to push something
|
sl@0
|
430 |
iBufReadStream.Source()->SeekL(MStreamBuf::ERead,textSize);
|
sl@0
|
431 |
aText.Set(remaining.Ptr(),textSize);
|
sl@0
|
432 |
return;
|
sl@0
|
433 |
}
|
sl@0
|
434 |
}
|
sl@0
|
435 |
|
sl@0
|
436 |
// have to copy into a continuous segment
|
sl@0
|
437 |
HBufC8* buf = HBufC8::NewLC(textSize);
|
sl@0
|
438 |
TPtr8 textPtr8(buf->Des());
|
sl@0
|
439 |
iBufReadStream.ReadL(textPtr8,textSize);
|
sl@0
|
440 |
aText.Set(*buf);
|
sl@0
|
441 |
}
|
sl@0
|
442 |
|
sl@0
|
443 |
/**
|
sl@0
|
444 |
Compares the commands in one buffer to those in another
|
sl@0
|
445 |
@param aBuffer The buffer to compare to
|
sl@0
|
446 |
@return ETrue if they are an exact match, EFalse otherwise
|
sl@0
|
447 |
*/
|
sl@0
|
448 |
EXPORT_C TBool CCommandBuffer::IsIdentical(const CCommandBuffer & aBuffer) const
|
sl@0
|
449 |
{
|
sl@0
|
450 |
for(TInt i = 0; i < iDrawSections.Count(); ++i)
|
sl@0
|
451 |
{
|
sl@0
|
452 |
if (!iDrawSections[i]->IsIdentical(*aBuffer.iDrawSections[i]))
|
sl@0
|
453 |
return EFalse;
|
sl@0
|
454 |
}
|
sl@0
|
455 |
return ETrue;
|
sl@0
|
456 |
}
|
sl@0
|
457 |
|
sl@0
|
458 |
/**
|
sl@0
|
459 |
@internalTechnology
|
sl@0
|
460 |
*/
|
sl@0
|
461 |
EXPORT_C TInt CCommandBuffer::Play(const TPoint& /*aPosition*/, const TRect& /*aDrawRect*/, const MWsGraphicResolver& /*aWsGraphicResolver*/, CBitmapContext& /*aContext*/) //Stub implementation to maintain compatibility with classic wserv
|
sl@0
|
462 |
{
|
sl@0
|
463 |
ASSERT(0);
|
sl@0
|
464 |
return KErrNotSupported;
|
sl@0
|
465 |
}
|
sl@0
|
466 |
|
sl@0
|
467 |
/**
|
sl@0
|
468 |
@internalTechnology
|
sl@0
|
469 |
*/
|
sl@0
|
470 |
EXPORT_C TInt CCommandBuffer::Play(const TPoint& /*aMasterOrigin*/, const TRegion* /*aMasterClippingRegion*/, const TRect& /*aMasterClippingRect*/, const MWsGraphicResolver& /*aWsGraphicResolver*/, CBitmapContext& /*aBitmapContext*/) //Stub implementation to maintain compatibility with WSERV2
|
sl@0
|
471 |
{
|
sl@0
|
472 |
ASSERT(0);
|
sl@0
|
473 |
return KErrNotSupported;
|
sl@0
|
474 |
}
|
sl@0
|
475 |
|
sl@0
|
476 |
/**
|
sl@0
|
477 |
Draws draw commands that are within a specific rect to a graphics context with a specific offset.
|
sl@0
|
478 |
|
sl@0
|
479 |
@post The draw commands have been executed on the provided graphics context
|
sl@0
|
480 |
|
sl@0
|
481 |
@param aOffset The offset applied on all drawing operations.
|
sl@0
|
482 |
@param aClippingRegion The region to which all draw commands are clipped
|
sl@0
|
483 |
@param aSourceRect Draws only draw commands that are within this rect relative to the original coordinate system, i.e. before Position is applied
|
sl@0
|
484 |
@param aWsGraphicResolver The resolver to be used for DrawGraphic() calls.
|
sl@0
|
485 |
@param aGraphicsContext The graphics context to draw to.
|
sl@0
|
486 |
@publishedPartner
|
sl@0
|
487 |
*/
|
sl@0
|
488 |
EXPORT_C TInt CCommandBuffer::Play(const TPoint& aOffset, const TRegion* aClippingRegion, const TRect& aSourceRect, const MWsGraphicResolver& aWsGraphicResolver, MWsGraphicsContext& aGraphicsContext)
|
sl@0
|
489 |
{
|
sl@0
|
490 |
iMasterOrigin = aOffset;
|
sl@0
|
491 |
iMasterClippingRegion = aClippingRegion;
|
sl@0
|
492 |
iMasterClippingRect = aSourceRect;
|
sl@0
|
493 |
|
sl@0
|
494 |
Reset(aGraphicsContext);
|
sl@0
|
495 |
TRAPD(err, {
|
sl@0
|
496 |
iDrawableCache = new(ELeave) CRenderStageDrawableCache(aGraphicsContext.ObjectInterface<MWsDrawableSourceProvider>());
|
sl@0
|
497 |
DoPlayL(aWsGraphicResolver, aGraphicsContext);
|
sl@0
|
498 |
});
|
sl@0
|
499 |
delete iDrawableCache;
|
sl@0
|
500 |
iDrawableCache = NULL;
|
sl@0
|
501 |
return err;
|
sl@0
|
502 |
}
|
sl@0
|
503 |
|
sl@0
|
504 |
/**
|
sl@0
|
505 |
Draws draw commands that are within a specific rect to a graphics context with a specific offset.
|
sl@0
|
506 |
|
sl@0
|
507 |
@post The draw commands have been executed on the provided graphics context
|
sl@0
|
508 |
|
sl@0
|
509 |
@param aOffset The offset applied on all drawing operations.
|
sl@0
|
510 |
@param aClippingRegion The region to which all draw commands are clipped
|
sl@0
|
511 |
@param aSourceRect Draws only draw commands that are within this rect relative to the original coordinate system, i.e. before Position is applied
|
sl@0
|
512 |
@param aWsSession The session used to create the graphics context (WindowsGc)
|
sl@0
|
513 |
@param aWindowGc The graphics context to draw to.
|
sl@0
|
514 |
@publishedPartner
|
sl@0
|
515 |
*/
|
sl@0
|
516 |
EXPORT_C TInt CCommandBuffer::Play(const TPoint& aOffset, const TRegion* aClippingRegion, const TRect& aSourceRect, RWsSession& aWsSession, CWindowGc& aWindowGc)
|
sl@0
|
517 |
{
|
sl@0
|
518 |
iMasterOrigin = aOffset;
|
sl@0
|
519 |
iMasterClippingRegion = aClippingRegion;
|
sl@0
|
520 |
iMasterClippingRect = aSourceRect;
|
sl@0
|
521 |
|
sl@0
|
522 |
Reset(aWindowGc);
|
sl@0
|
523 |
|
sl@0
|
524 |
//Create a null version of MWsGraphicResolver which will never be used in this instance of the call to Play
|
sl@0
|
525 |
MWsGraphicResolver* graphicResolver = NULL;
|
sl@0
|
526 |
|
sl@0
|
527 |
TRAPD(err, {
|
sl@0
|
528 |
iDrawableCache = new(ELeave) CWindowDrawableCache(aWsSession);
|
sl@0
|
529 |
DoPlayL(*graphicResolver, aWindowGc);
|
sl@0
|
530 |
});
|
sl@0
|
531 |
delete iDrawableCache;
|
sl@0
|
532 |
iDrawableCache = NULL;
|
sl@0
|
533 |
return err;
|
sl@0
|
534 |
}
|
sl@0
|
535 |
|
sl@0
|
536 |
/**
|
sl@0
|
537 |
Draws drawcommands that are within a specific rect.
|
sl@0
|
538 |
|
sl@0
|
539 |
@param aWsGraphicResolver Any DrawWsGraphic commands will use this to draw themselves
|
sl@0
|
540 |
@param aGraphicsContext The graphics context to draw to.
|
sl@0
|
541 |
*/
|
sl@0
|
542 |
template<typename ContextType> void CCommandBuffer::DoPlayL(const MWsGraphicResolver& aWsGraphicResolver, ContextType& aGraphicsContext)
|
sl@0
|
543 |
{
|
sl@0
|
544 |
const TInt sections = iDrawSections.Count();
|
sl@0
|
545 |
if(sections == 0)
|
sl@0
|
546 |
User::Leave(KErrEof);
|
sl@0
|
547 |
|
sl@0
|
548 |
iBitmapCache->BeginUpdate();
|
sl@0
|
549 |
iFontCache->BeginUpdate();
|
sl@0
|
550 |
for(TInt i = 0; i < sections; i++)
|
sl@0
|
551 |
{
|
sl@0
|
552 |
UpdateClippingRegion(i);
|
sl@0
|
553 |
DrawSectionL(*iDrawSections[i], aWsGraphicResolver, aGraphicsContext);
|
sl@0
|
554 |
}
|
sl@0
|
555 |
iFontCache->EndUpdate();
|
sl@0
|
556 |
iBitmapCache->EndUpdate();
|
sl@0
|
557 |
}
|
sl@0
|
558 |
|
sl@0
|
559 |
/**
|
sl@0
|
560 |
Draws a specific drawsection.
|
sl@0
|
561 |
|
sl@0
|
562 |
@param aDrawSection The drawsection to be drawn.
|
sl@0
|
563 |
@param aWsGraphicResolver Any DrawWsGraphic commands will use this to draw themselves
|
sl@0
|
564 |
@param aGraphicsContext The graphics context to draw to.
|
sl@0
|
565 |
*/
|
sl@0
|
566 |
template<typename ContextType> void CCommandBuffer::DrawSectionL(const CDrawSection& aDrawSection, const MWsGraphicResolver& aWsGraphicResolver, ContextType& aGraphicsContext)
|
sl@0
|
567 |
{
|
sl@0
|
568 |
iDrawSectionRect = aDrawSection.DrawRect();
|
sl@0
|
569 |
Reset(aGraphicsContext);
|
sl@0
|
570 |
|
sl@0
|
571 |
iBufRead = aDrawSection.Buffer();
|
sl@0
|
572 |
iBufReadStream.Open(*iBufRead, 0);
|
sl@0
|
573 |
|
sl@0
|
574 |
TDrawCode drawCode;
|
sl@0
|
575 |
while(ETrue)
|
sl@0
|
576 |
{
|
sl@0
|
577 |
TRAPD(err, ReadL<TDrawCode>(drawCode));
|
sl@0
|
578 |
if(err == KErrEof)
|
sl@0
|
579 |
return;
|
sl@0
|
580 |
else if(err)
|
sl@0
|
581 |
User::Leave(err);
|
sl@0
|
582 |
|
sl@0
|
583 |
switch(drawCode)
|
sl@0
|
584 |
{
|
sl@0
|
585 |
case ECommandClear:
|
sl@0
|
586 |
Clear(aGraphicsContext);
|
sl@0
|
587 |
break;
|
sl@0
|
588 |
case ECommandClearRect:
|
sl@0
|
589 |
ClearRectL(aGraphicsContext);
|
sl@0
|
590 |
break;
|
sl@0
|
591 |
case ECommandCopyRect:
|
sl@0
|
592 |
CopyRectL(aGraphicsContext);
|
sl@0
|
593 |
break;
|
sl@0
|
594 |
case ECommandBitBlt1:
|
sl@0
|
595 |
BitBlt1L(aGraphicsContext);
|
sl@0
|
596 |
break;
|
sl@0
|
597 |
case ECommandBitBlt2:
|
sl@0
|
598 |
BitBlt2L(aGraphicsContext);
|
sl@0
|
599 |
break;
|
sl@0
|
600 |
case ECommandBitBltMasked:
|
sl@0
|
601 |
BitBltMaskedL(aGraphicsContext);
|
sl@0
|
602 |
break;
|
sl@0
|
603 |
case ECommandSetFaded:
|
sl@0
|
604 |
User::Leave(KErrNotSupported); //this op code is deprecated, should never be generated
|
sl@0
|
605 |
break;
|
sl@0
|
606 |
case ECommandSetFadingParameters:
|
sl@0
|
607 |
User::Leave(KErrNotSupported); //this op code is deprecated, should never be generated
|
sl@0
|
608 |
break;
|
sl@0
|
609 |
case ECommandAlphaBlendBitmaps:
|
sl@0
|
610 |
AlphaBlendBitmapsL(aGraphicsContext);
|
sl@0
|
611 |
break;
|
sl@0
|
612 |
case ECommandSetOrigin:
|
sl@0
|
613 |
SetOriginL(aGraphicsContext);
|
sl@0
|
614 |
break;
|
sl@0
|
615 |
case ECommandSetDrawMode:
|
sl@0
|
616 |
SetDrawModeL(aGraphicsContext);
|
sl@0
|
617 |
break;
|
sl@0
|
618 |
case ECommandSetClippingRect:
|
sl@0
|
619 |
SetClippingRectL(aGraphicsContext);
|
sl@0
|
620 |
break;
|
sl@0
|
621 |
case ECommandCancelClippingRect:
|
sl@0
|
622 |
CancelClippingRect(aGraphicsContext);
|
sl@0
|
623 |
break;
|
sl@0
|
624 |
case ECommandReset:
|
sl@0
|
625 |
Reset(aGraphicsContext);
|
sl@0
|
626 |
break;
|
sl@0
|
627 |
case ECommandUseFont:
|
sl@0
|
628 |
UseFontL(aGraphicsContext);
|
sl@0
|
629 |
break;
|
sl@0
|
630 |
case ECommandDiscardFont:
|
sl@0
|
631 |
DiscardFont(aGraphicsContext);
|
sl@0
|
632 |
break;
|
sl@0
|
633 |
case ECommandSetUnderlineStyle:
|
sl@0
|
634 |
SetUnderlineStyleL(aGraphicsContext);
|
sl@0
|
635 |
break;
|
sl@0
|
636 |
case ECommandSetStrikethroughStyle:
|
sl@0
|
637 |
SetStrikethroughStyleL(aGraphicsContext);
|
sl@0
|
638 |
break;
|
sl@0
|
639 |
case ECommandSetWordJustification:
|
sl@0
|
640 |
SetWordJustificationL(aGraphicsContext);
|
sl@0
|
641 |
break;
|
sl@0
|
642 |
case ECommandSetCharJustification:
|
sl@0
|
643 |
SetCharJustificationL(aGraphicsContext);
|
sl@0
|
644 |
break;
|
sl@0
|
645 |
case ECommandSetPenColor:
|
sl@0
|
646 |
SetPenColorL(aGraphicsContext);
|
sl@0
|
647 |
break;
|
sl@0
|
648 |
case ECommandSetPenStyle:
|
sl@0
|
649 |
SetPenStyleL(aGraphicsContext);
|
sl@0
|
650 |
break;
|
sl@0
|
651 |
case ECommandSetPenSize:
|
sl@0
|
652 |
SetPenSizeL(aGraphicsContext);
|
sl@0
|
653 |
break;
|
sl@0
|
654 |
case ECommandSetBrushColor:
|
sl@0
|
655 |
SetBrushColorL(aGraphicsContext);
|
sl@0
|
656 |
break;
|
sl@0
|
657 |
case ECommandSetBrushStyle:
|
sl@0
|
658 |
SetBrushStyleL(aGraphicsContext);
|
sl@0
|
659 |
break;
|
sl@0
|
660 |
case ECommandSetBrushOrigin:
|
sl@0
|
661 |
SetBrushOriginL(aGraphicsContext);
|
sl@0
|
662 |
break;
|
sl@0
|
663 |
case ECommandUseBrushPattern:
|
sl@0
|
664 |
UseBrushPatternL(aGraphicsContext);
|
sl@0
|
665 |
break;
|
sl@0
|
666 |
case ECommandDiscardBrushPattern:
|
sl@0
|
667 |
DiscardBrushPattern(aGraphicsContext);
|
sl@0
|
668 |
break;
|
sl@0
|
669 |
case ECommandMoveTo:
|
sl@0
|
670 |
MoveToL(aGraphicsContext);
|
sl@0
|
671 |
break;
|
sl@0
|
672 |
case ECommandMoveBy:
|
sl@0
|
673 |
MoveByL(aGraphicsContext);
|
sl@0
|
674 |
break;
|
sl@0
|
675 |
case ECommandPlot:
|
sl@0
|
676 |
PlotL(aGraphicsContext);
|
sl@0
|
677 |
break;
|
sl@0
|
678 |
case ECommandDrawArc:
|
sl@0
|
679 |
DrawArcL(aGraphicsContext);
|
sl@0
|
680 |
break;
|
sl@0
|
681 |
case ECommandDrawLine:
|
sl@0
|
682 |
DrawLineL(aGraphicsContext);
|
sl@0
|
683 |
break;
|
sl@0
|
684 |
case ECommandDrawLineTo:
|
sl@0
|
685 |
DrawLineToL(aGraphicsContext);
|
sl@0
|
686 |
break;
|
sl@0
|
687 |
case ECommandDrawLineBy:
|
sl@0
|
688 |
DrawLineByL(aGraphicsContext);
|
sl@0
|
689 |
break;
|
sl@0
|
690 |
case ECommandDrawPolyLine:
|
sl@0
|
691 |
DrawPolyLineL(aGraphicsContext);
|
sl@0
|
692 |
break;
|
sl@0
|
693 |
case ECommandDrawPie:
|
sl@0
|
694 |
DrawPieL(aGraphicsContext);
|
sl@0
|
695 |
break;
|
sl@0
|
696 |
case ECommandDrawEllipse:
|
sl@0
|
697 |
DrawEllipseL(aGraphicsContext);
|
sl@0
|
698 |
break;
|
sl@0
|
699 |
case ECommandDrawRect:
|
sl@0
|
700 |
DrawRectL(aGraphicsContext);
|
sl@0
|
701 |
break;
|
sl@0
|
702 |
case ECommandDrawPolygon:
|
sl@0
|
703 |
DrawPolygonL(aGraphicsContext);
|
sl@0
|
704 |
break;
|
sl@0
|
705 |
case ECommandDrawRoundRect:
|
sl@0
|
706 |
DrawRoundRectL(aGraphicsContext);
|
sl@0
|
707 |
break;
|
sl@0
|
708 |
case ECommandDrawBitmap1:
|
sl@0
|
709 |
DrawBitmap1L(aGraphicsContext);
|
sl@0
|
710 |
break;
|
sl@0
|
711 |
case ECommandDrawBitmap2:
|
sl@0
|
712 |
DrawBitmap2L(aGraphicsContext);
|
sl@0
|
713 |
break;
|
sl@0
|
714 |
case ECommandDrawBitmap3:
|
sl@0
|
715 |
DrawBitmap3L(aGraphicsContext);
|
sl@0
|
716 |
break;
|
sl@0
|
717 |
case ECommandDrawBitmapMasked:
|
sl@0
|
718 |
DrawBitmapMaskedL(aGraphicsContext);
|
sl@0
|
719 |
break;
|
sl@0
|
720 |
case ECommandDrawText1:
|
sl@0
|
721 |
DrawText1L(aGraphicsContext);
|
sl@0
|
722 |
break;
|
sl@0
|
723 |
case ECommandDrawText2:
|
sl@0
|
724 |
DrawText2L(aGraphicsContext);
|
sl@0
|
725 |
break;
|
sl@0
|
726 |
case ECommandDrawText3:
|
sl@0
|
727 |
DrawText3L(aGraphicsContext);
|
sl@0
|
728 |
break;
|
sl@0
|
729 |
case ECommandDrawText4:
|
sl@0
|
730 |
DrawText4L(aGraphicsContext);
|
sl@0
|
731 |
break;
|
sl@0
|
732 |
case ECommandDrawText5:
|
sl@0
|
733 |
DrawText5L(aGraphicsContext);
|
sl@0
|
734 |
break;
|
sl@0
|
735 |
case ECommandMapColors:
|
sl@0
|
736 |
User::Leave(KErrNotSupported); //this op code is deprecated, should never be generated
|
sl@0
|
737 |
break;
|
sl@0
|
738 |
case ECommandSetClippingRegion:
|
sl@0
|
739 |
SetClippingRegionL(aGraphicsContext);
|
sl@0
|
740 |
break;
|
sl@0
|
741 |
case ECommandCancelClippingRegion:
|
sl@0
|
742 |
CancelClippingRegion(aGraphicsContext);
|
sl@0
|
743 |
break;
|
sl@0
|
744 |
case ECommandDrawTextVertical1:
|
sl@0
|
745 |
DrawTextVertical1L(aGraphicsContext);
|
sl@0
|
746 |
break;
|
sl@0
|
747 |
case ECommandDrawTextVertical2:
|
sl@0
|
748 |
DrawTextVertical2L(aGraphicsContext);
|
sl@0
|
749 |
break;
|
sl@0
|
750 |
case ECommandDrawTextVertical3:
|
sl@0
|
751 |
DrawTextVertical3L(aGraphicsContext);
|
sl@0
|
752 |
break;
|
sl@0
|
753 |
case ECommandDrawTextVertical4:
|
sl@0
|
754 |
DrawTextVertical4L(aGraphicsContext);
|
sl@0
|
755 |
break;
|
sl@0
|
756 |
case ECommandDrawWsGraphic1:
|
sl@0
|
757 |
DrawWsGraphic1L(aWsGraphicResolver);
|
sl@0
|
758 |
break;
|
sl@0
|
759 |
case ECommandDrawWsGraphic2:
|
sl@0
|
760 |
DrawWsGraphic2L(aWsGraphicResolver);
|
sl@0
|
761 |
break;
|
sl@0
|
762 |
case ECommandSetShadowColor:
|
sl@0
|
763 |
SetShadowColorL(aGraphicsContext);
|
sl@0
|
764 |
break;
|
sl@0
|
765 |
case ECommandDrawResourceToPos:
|
sl@0
|
766 |
DrawResourceToPosL(aGraphicsContext);
|
sl@0
|
767 |
break;
|
sl@0
|
768 |
case ECommandDrawResourceToRect:
|
sl@0
|
769 |
DrawResourceToRectL(aGraphicsContext);
|
sl@0
|
770 |
break;
|
sl@0
|
771 |
case ECommandDrawResourceFromRectToRect:
|
sl@0
|
772 |
DrawResourceFromRectToRectL(aGraphicsContext);
|
sl@0
|
773 |
break;
|
sl@0
|
774 |
case ECommandDrawResourceWithData:
|
sl@0
|
775 |
DrawResourceWithDataL(aGraphicsContext);
|
sl@0
|
776 |
break;
|
sl@0
|
777 |
default:
|
sl@0
|
778 |
User::LeaveIfError(KErrNotFound);
|
sl@0
|
779 |
break;
|
sl@0
|
780 |
}
|
sl@0
|
781 |
}
|
sl@0
|
782 |
}
|
sl@0
|
783 |
|
sl@0
|
784 |
template<typename ContextType> void CCommandBuffer::Clear(ContextType& aGraphicsContext) const
|
sl@0
|
785 |
{
|
sl@0
|
786 |
aGraphicsContext.Clear();
|
sl@0
|
787 |
}
|
sl@0
|
788 |
|
sl@0
|
789 |
template<typename ContextType> void CCommandBuffer::ClearRectL(ContextType& aGraphicsContext)
|
sl@0
|
790 |
{
|
sl@0
|
791 |
TRect rect;
|
sl@0
|
792 |
ReadL<TRect>(rect);
|
sl@0
|
793 |
|
sl@0
|
794 |
aGraphicsContext.Clear(rect);
|
sl@0
|
795 |
}
|
sl@0
|
796 |
|
sl@0
|
797 |
template<typename ContextType> void CCommandBuffer::CopyRectL(ContextType& aGraphicsContext)
|
sl@0
|
798 |
{
|
sl@0
|
799 |
TPoint point;
|
sl@0
|
800 |
TRect rect;
|
sl@0
|
801 |
|
sl@0
|
802 |
ReadL<TPoint>(point);
|
sl@0
|
803 |
ReadL<TRect>(rect);
|
sl@0
|
804 |
|
sl@0
|
805 |
aGraphicsContext.CopyRect(point, rect);
|
sl@0
|
806 |
}
|
sl@0
|
807 |
|
sl@0
|
808 |
template<typename ContextType> void CCommandBuffer::BitBlt1L(ContextType& aGraphicsContext)
|
sl@0
|
809 |
{
|
sl@0
|
810 |
TPoint point;
|
sl@0
|
811 |
TInt handle;
|
sl@0
|
812 |
|
sl@0
|
813 |
ReadL<TPoint>(point);
|
sl@0
|
814 |
ReadL<TInt>(handle);
|
sl@0
|
815 |
|
sl@0
|
816 |
if(!iBitmapCache->UseL(handle))
|
sl@0
|
817 |
DoBitBlt1L(aGraphicsContext, point, handle);
|
sl@0
|
818 |
}
|
sl@0
|
819 |
|
sl@0
|
820 |
void CCommandBuffer::DoBitBlt1L(CWindowGc& aWindowGc, TPoint aPoint, TInt aHandle)
|
sl@0
|
821 |
{
|
sl@0
|
822 |
aWindowGc.BitBlt(aPoint, iBitmapCache->Resolve(aHandle));
|
sl@0
|
823 |
}
|
sl@0
|
824 |
|
sl@0
|
825 |
void CCommandBuffer::DoBitBlt1L(MWsGraphicsContext& aGraphicsContext, TPoint aPoint, TInt aHandle)
|
sl@0
|
826 |
{
|
sl@0
|
827 |
aGraphicsContext.BitBlt(aPoint, *iBitmapCache->Resolve(aHandle));
|
sl@0
|
828 |
}
|
sl@0
|
829 |
|
sl@0
|
830 |
template<typename ContextType> void CCommandBuffer::BitBlt2L(ContextType& aGraphicsContext)
|
sl@0
|
831 |
{
|
sl@0
|
832 |
TPoint point;
|
sl@0
|
833 |
TRect sourceRect;
|
sl@0
|
834 |
TInt handle;
|
sl@0
|
835 |
|
sl@0
|
836 |
ReadL<TPoint>(point);
|
sl@0
|
837 |
ReadL<TInt>(handle);
|
sl@0
|
838 |
ReadL<TRect>(sourceRect);
|
sl@0
|
839 |
|
sl@0
|
840 |
if(!iBitmapCache->UseL(handle))
|
sl@0
|
841 |
DoBitBlt2L(aGraphicsContext, point, handle, sourceRect);
|
sl@0
|
842 |
}
|
sl@0
|
843 |
|
sl@0
|
844 |
void CCommandBuffer::DoBitBlt2L(CWindowGc& aWindowGc, TPoint aPoint, TInt aHandle, TRect aSourceRect)
|
sl@0
|
845 |
{
|
sl@0
|
846 |
aWindowGc.BitBlt(aPoint, iBitmapCache->Resolve(aHandle), aSourceRect);
|
sl@0
|
847 |
}
|
sl@0
|
848 |
|
sl@0
|
849 |
void CCommandBuffer::DoBitBlt2L(MWsGraphicsContext& aGraphicsContext, TPoint aPoint, TInt aHandle, TRect aSourceRect)
|
sl@0
|
850 |
{
|
sl@0
|
851 |
aGraphicsContext.BitBlt(aPoint, *iBitmapCache->Resolve(aHandle), aSourceRect);
|
sl@0
|
852 |
}
|
sl@0
|
853 |
|
sl@0
|
854 |
template<typename ContextType> void CCommandBuffer::BitBltMaskedL(ContextType& aGraphicsContext)
|
sl@0
|
855 |
{
|
sl@0
|
856 |
TPoint point;
|
sl@0
|
857 |
TInt bitmapHandle;
|
sl@0
|
858 |
TRect sourceRect;
|
sl@0
|
859 |
TInt maskHandle;
|
sl@0
|
860 |
TBool invertedMask;
|
sl@0
|
861 |
|
sl@0
|
862 |
ReadL<TPoint>(point);
|
sl@0
|
863 |
ReadL<TInt>(bitmapHandle);
|
sl@0
|
864 |
ReadL<TRect>(sourceRect);
|
sl@0
|
865 |
ReadL<TInt>(maskHandle);
|
sl@0
|
866 |
ReadL<TBool>(invertedMask);
|
sl@0
|
867 |
|
sl@0
|
868 |
if(!iBitmapCache->UseL(bitmapHandle) && !iBitmapCache->UseL(maskHandle))
|
sl@0
|
869 |
DoBitBltMaskedL(aGraphicsContext, point, bitmapHandle, sourceRect, maskHandle, invertedMask);
|
sl@0
|
870 |
}
|
sl@0
|
871 |
|
sl@0
|
872 |
void CCommandBuffer::DoBitBltMaskedL(CWindowGc& aWindowGc, TPoint aPoint, TInt aBitmapHandle, TRect aSourceRect, TInt aMaskHandle, TBool aInvertMask)
|
sl@0
|
873 |
{
|
sl@0
|
874 |
aWindowGc.BitBltMasked(aPoint, iBitmapCache->Resolve(aBitmapHandle), aSourceRect, iBitmapCache->Resolve(aMaskHandle), aInvertMask);
|
sl@0
|
875 |
}
|
sl@0
|
876 |
|
sl@0
|
877 |
void CCommandBuffer::DoBitBltMaskedL(MWsGraphicsContext& aGraphicsContext, TPoint aPoint, TInt aBitmapHandle, TRect aSourceRect, TInt aMaskHandle, TBool aInvertMask)
|
sl@0
|
878 |
{
|
sl@0
|
879 |
aGraphicsContext.BitBltMasked(aPoint, *iBitmapCache->Resolve(aBitmapHandle), aSourceRect, *iBitmapCache->Resolve(aMaskHandle), aInvertMask);
|
sl@0
|
880 |
}
|
sl@0
|
881 |
|
sl@0
|
882 |
template<typename ContextType> void CCommandBuffer::AlphaBlendBitmapsL(ContextType& aGraphicsContext)
|
sl@0
|
883 |
{
|
sl@0
|
884 |
TPoint destPoint;
|
sl@0
|
885 |
TInt srcHandle;
|
sl@0
|
886 |
TRect sourceRect;
|
sl@0
|
887 |
TInt alphaHandle;
|
sl@0
|
888 |
TPoint alphaPoint;
|
sl@0
|
889 |
|
sl@0
|
890 |
ReadL<TPoint>(destPoint);
|
sl@0
|
891 |
ReadL<TInt>(srcHandle);
|
sl@0
|
892 |
ReadL<TRect>(sourceRect);
|
sl@0
|
893 |
ReadL<TInt>(alphaHandle);
|
sl@0
|
894 |
ReadL<TPoint>(alphaPoint);
|
sl@0
|
895 |
|
sl@0
|
896 |
if(!iBitmapCache->UseL(srcHandle) && !iBitmapCache->UseL(alphaHandle))
|
sl@0
|
897 |
DoAlphaBlendBitmapsL(aGraphicsContext, destPoint, srcHandle, sourceRect, alphaHandle, alphaPoint);
|
sl@0
|
898 |
}
|
sl@0
|
899 |
|
sl@0
|
900 |
void CCommandBuffer::DoAlphaBlendBitmapsL(CWindowGc& aWindowGc, TPoint aDestPoint, TInt aSrcHandle, TRect aSourceRect, TInt aAlphaHandle, TPoint aAlphaPoint)
|
sl@0
|
901 |
{
|
sl@0
|
902 |
aWindowGc.AlphaBlendBitmaps(aDestPoint, iBitmapCache->Resolve(aSrcHandle), aSourceRect, iBitmapCache->Resolve(aAlphaHandle), aAlphaPoint);
|
sl@0
|
903 |
}
|
sl@0
|
904 |
|
sl@0
|
905 |
void CCommandBuffer::DoAlphaBlendBitmapsL(MWsGraphicsContext& aGraphicsContext, TPoint aDestPoint, TInt aSrcHandle, TRect aSourceRect, TInt aAlphaHandle, TPoint aAlphaPoint)
|
sl@0
|
906 |
{
|
sl@0
|
907 |
aGraphicsContext.BitBltMasked(aDestPoint, *iBitmapCache->Resolve(aSrcHandle), aSourceRect, *iBitmapCache->Resolve(aAlphaHandle), aAlphaPoint);
|
sl@0
|
908 |
}
|
sl@0
|
909 |
|
sl@0
|
910 |
template<typename ContextType> void CCommandBuffer::SetOriginL(ContextType& aGraphicsContext)
|
sl@0
|
911 |
{
|
sl@0
|
912 |
ReadL<TPoint>(iOrigin);
|
sl@0
|
913 |
aGraphicsContext.SetOrigin(iMasterOrigin + iOrigin);
|
sl@0
|
914 |
}
|
sl@0
|
915 |
|
sl@0
|
916 |
template<typename ContextType> void CCommandBuffer::SetDrawModeL(ContextType& aGraphicsContext)
|
sl@0
|
917 |
{
|
sl@0
|
918 |
CGraphicsContext::TDrawMode drawMode;
|
sl@0
|
919 |
ReadL<CGraphicsContext::TDrawMode>(drawMode);
|
sl@0
|
920 |
|
sl@0
|
921 |
DoSetDrawModeL(aGraphicsContext, drawMode);
|
sl@0
|
922 |
}
|
sl@0
|
923 |
|
sl@0
|
924 |
void CCommandBuffer::DoSetDrawModeL(CWindowGc& aWindowGc, CGraphicsContext::TDrawMode aDrawMode)
|
sl@0
|
925 |
{
|
sl@0
|
926 |
aWindowGc.SetDrawMode(aDrawMode);
|
sl@0
|
927 |
}
|
sl@0
|
928 |
|
sl@0
|
929 |
void CCommandBuffer::DoSetDrawModeL(MWsGraphicsContext& aGraphicsContext, CGraphicsContext::TDrawMode aDrawMode)
|
sl@0
|
930 |
{
|
sl@0
|
931 |
aGraphicsContext.SetDrawMode(BitGdiToMWsGraphicsContextMappings::LossyConvert(aDrawMode));
|
sl@0
|
932 |
}
|
sl@0
|
933 |
|
sl@0
|
934 |
template<typename ContextType> void CCommandBuffer::SetClippingRectL(ContextType& aGraphicsContext)
|
sl@0
|
935 |
{
|
sl@0
|
936 |
ReadL<TRect>(iClippingRect);
|
sl@0
|
937 |
iClippingRect.Intersection(iMasterClippingRect);
|
sl@0
|
938 |
iClippingRect.Intersection(iDrawSectionRect);
|
sl@0
|
939 |
|
sl@0
|
940 |
//Replacement for SetClippingRect functionality which MWsGraphicsContext does not support
|
sl@0
|
941 |
iIntersectedRegion.Clear();
|
sl@0
|
942 |
if(iActiveMasterClippingRegion->Count() > 0)
|
sl@0
|
943 |
iIntersectedRegion.Copy(*iActiveMasterClippingRegion);
|
sl@0
|
944 |
iIntersectedRegion.ClipRect(iClippingRect);
|
sl@0
|
945 |
aGraphicsContext.SetClippingRegion(iIntersectedRegion);
|
sl@0
|
946 |
}
|
sl@0
|
947 |
|
sl@0
|
948 |
template<typename ContextType> void CCommandBuffer::CancelClippingRect(ContextType& aGraphicsContext)
|
sl@0
|
949 |
{
|
sl@0
|
950 |
iClippingRect = iMasterClippingRect;
|
sl@0
|
951 |
iClippingRect.Intersection(iDrawSectionRect);
|
sl@0
|
952 |
|
sl@0
|
953 |
//Replacement for SetClippingRect functionality which MWsGraphicsContext does not support
|
sl@0
|
954 |
iIntersectedRegion.Clear();
|
sl@0
|
955 |
if(iActiveMasterClippingRegion && iActiveMasterClippingRegion->Count() > 0)
|
sl@0
|
956 |
iIntersectedRegion.Copy(*iActiveMasterClippingRegion);
|
sl@0
|
957 |
iIntersectedRegion.ClipRect(iClippingRect);
|
sl@0
|
958 |
aGraphicsContext.SetClippingRegion(iIntersectedRegion);
|
sl@0
|
959 |
}
|
sl@0
|
960 |
|
sl@0
|
961 |
void CCommandBuffer::Reset(CWindowGc& aWindowGc)
|
sl@0
|
962 |
{
|
sl@0
|
963 |
aWindowGc.Reset();
|
sl@0
|
964 |
|
sl@0
|
965 |
aWindowGc.SetOrigin(iMasterOrigin);
|
sl@0
|
966 |
if(iActiveMasterClippingRegion)
|
sl@0
|
967 |
aWindowGc.SetClippingRegion(*iActiveMasterClippingRegion);
|
sl@0
|
968 |
CancelClippingRect(aWindowGc);
|
sl@0
|
969 |
iOrigin = TPoint(0,0);
|
sl@0
|
970 |
iClippingRegion.Clear();
|
sl@0
|
971 |
iParsedClippingRegionIsSet = EFalse;
|
sl@0
|
972 |
}
|
sl@0
|
973 |
|
sl@0
|
974 |
void CCommandBuffer::Reset(MWsGraphicsContext& aGraphicsContext)
|
sl@0
|
975 |
{
|
sl@0
|
976 |
aGraphicsContext.Reset();
|
sl@0
|
977 |
|
sl@0
|
978 |
TRgb brushColor = KRgbWhite;
|
sl@0
|
979 |
brushColor.SetAlpha(0); //make transparent
|
sl@0
|
980 |
aGraphicsContext.SetBrushColor(brushColor);
|
sl@0
|
981 |
|
sl@0
|
982 |
aGraphicsContext.SetOrigin(iMasterOrigin);
|
sl@0
|
983 |
if(iActiveMasterClippingRegion)
|
sl@0
|
984 |
aGraphicsContext.SetClippingRegion(*iActiveMasterClippingRegion);
|
sl@0
|
985 |
CancelClippingRect(aGraphicsContext);
|
sl@0
|
986 |
iOrigin = TPoint(0,0);
|
sl@0
|
987 |
iClippingRegion.Clear();
|
sl@0
|
988 |
iParsedClippingRegionIsSet = EFalse;
|
sl@0
|
989 |
}
|
sl@0
|
990 |
|
sl@0
|
991 |
template<typename ContextType> void CCommandBuffer::UseFontL(ContextType& aGraphicsContext)
|
sl@0
|
992 |
{
|
sl@0
|
993 |
TInt fontHandle;
|
sl@0
|
994 |
ReadL<TInt>(fontHandle);
|
sl@0
|
995 |
if(iFontCache->UseL(fontHandle)) return;
|
sl@0
|
996 |
|
sl@0
|
997 |
DoUseFontL(aGraphicsContext, fontHandle);
|
sl@0
|
998 |
}
|
sl@0
|
999 |
|
sl@0
|
1000 |
void CCommandBuffer::DoUseFontL(CWindowGc& aWindowGc, TInt aFontHandle)
|
sl@0
|
1001 |
{
|
sl@0
|
1002 |
aWindowGc.UseFont(iFontCache->Resolve(aFontHandle));
|
sl@0
|
1003 |
}
|
sl@0
|
1004 |
|
sl@0
|
1005 |
void CCommandBuffer::DoUseFontL(MWsGraphicsContext& aGraphicsContext, TInt aFontHandle)
|
sl@0
|
1006 |
{
|
sl@0
|
1007 |
aGraphicsContext.SetFont(iFontCache->Resolve(aFontHandle));
|
sl@0
|
1008 |
}
|
sl@0
|
1009 |
|
sl@0
|
1010 |
void CCommandBuffer::DiscardFont(CWindowGc& aWindowGc) const
|
sl@0
|
1011 |
{
|
sl@0
|
1012 |
aWindowGc.DiscardFont();
|
sl@0
|
1013 |
}
|
sl@0
|
1014 |
|
sl@0
|
1015 |
void CCommandBuffer::DiscardFont(MWsGraphicsContext& aGraphicsContext) const
|
sl@0
|
1016 |
{
|
sl@0
|
1017 |
aGraphicsContext.ResetFont();
|
sl@0
|
1018 |
}
|
sl@0
|
1019 |
|
sl@0
|
1020 |
template<typename ContextType> void CCommandBuffer::SetUnderlineStyleL(ContextType& aGraphicsContext)
|
sl@0
|
1021 |
{
|
sl@0
|
1022 |
TFontUnderline underlineStyle;
|
sl@0
|
1023 |
ReadL<TFontUnderline>(underlineStyle);
|
sl@0
|
1024 |
|
sl@0
|
1025 |
DoSetUnderlineStyleL(aGraphicsContext, underlineStyle);
|
sl@0
|
1026 |
}
|
sl@0
|
1027 |
|
sl@0
|
1028 |
void CCommandBuffer::DoSetUnderlineStyleL(CWindowGc& aWindowGc, TFontUnderline aUnderlineStyle)
|
sl@0
|
1029 |
{
|
sl@0
|
1030 |
aWindowGc.SetUnderlineStyle(aUnderlineStyle);
|
sl@0
|
1031 |
}
|
sl@0
|
1032 |
|
sl@0
|
1033 |
void CCommandBuffer::DoSetUnderlineStyleL(MWsGraphicsContext& aGraphicsContext, TFontUnderline aUnderlineStyle)
|
sl@0
|
1034 |
{
|
sl@0
|
1035 |
aGraphicsContext.SetUnderlineStyle(BitGdiToMWsGraphicsContextMappings::Convert(aUnderlineStyle));
|
sl@0
|
1036 |
}
|
sl@0
|
1037 |
|
sl@0
|
1038 |
template<typename ContextType> void CCommandBuffer::SetStrikethroughStyleL(ContextType& aGraphicsContext)
|
sl@0
|
1039 |
{
|
sl@0
|
1040 |
TFontStrikethrough strikethroughStyle;
|
sl@0
|
1041 |
ReadL<TFontStrikethrough>(strikethroughStyle);
|
sl@0
|
1042 |
|
sl@0
|
1043 |
DoSetStrikethroughStyleL(aGraphicsContext, strikethroughStyle);
|
sl@0
|
1044 |
}
|
sl@0
|
1045 |
|
sl@0
|
1046 |
void CCommandBuffer::DoSetStrikethroughStyleL(CWindowGc& aWindowGc, TFontStrikethrough aStrikethroughStyle)
|
sl@0
|
1047 |
{
|
sl@0
|
1048 |
aWindowGc.SetStrikethroughStyle(aStrikethroughStyle);
|
sl@0
|
1049 |
}
|
sl@0
|
1050 |
|
sl@0
|
1051 |
void CCommandBuffer::DoSetStrikethroughStyleL(MWsGraphicsContext& aGraphicsContext, TFontStrikethrough aStrikethroughStyle)
|
sl@0
|
1052 |
{
|
sl@0
|
1053 |
aGraphicsContext.SetStrikethroughStyle(BitGdiToMWsGraphicsContextMappings::Convert(aStrikethroughStyle));
|
sl@0
|
1054 |
}
|
sl@0
|
1055 |
|
sl@0
|
1056 |
template<typename ContextType> void CCommandBuffer::SetWordJustificationL(ContextType& aGraphicsContext)
|
sl@0
|
1057 |
{
|
sl@0
|
1058 |
TInt excessWidth;
|
sl@0
|
1059 |
TInt numGaps;
|
sl@0
|
1060 |
|
sl@0
|
1061 |
ReadL<TInt>(excessWidth);
|
sl@0
|
1062 |
ReadL<TInt>(numGaps);
|
sl@0
|
1063 |
aGraphicsContext.SetWordJustification(excessWidth, numGaps);
|
sl@0
|
1064 |
}
|
sl@0
|
1065 |
|
sl@0
|
1066 |
template<typename ContextType> void CCommandBuffer::SetCharJustificationL(ContextType& aGraphicsContext)
|
sl@0
|
1067 |
{
|
sl@0
|
1068 |
TInt excessWidth;
|
sl@0
|
1069 |
TInt numChars;
|
sl@0
|
1070 |
|
sl@0
|
1071 |
ReadL<TInt>(excessWidth);
|
sl@0
|
1072 |
ReadL<TInt>(numChars);
|
sl@0
|
1073 |
aGraphicsContext.SetCharJustification(excessWidth, numChars);
|
sl@0
|
1074 |
}
|
sl@0
|
1075 |
|
sl@0
|
1076 |
template<typename ContextType> void CCommandBuffer::SetPenColorL(ContextType& aGraphicsContext)
|
sl@0
|
1077 |
{
|
sl@0
|
1078 |
TRgb color;
|
sl@0
|
1079 |
ReadL<TRgb>(color);
|
sl@0
|
1080 |
|
sl@0
|
1081 |
aGraphicsContext.SetPenColor(color);
|
sl@0
|
1082 |
}
|
sl@0
|
1083 |
|
sl@0
|
1084 |
template<typename ContextType> void CCommandBuffer::SetPenStyleL(ContextType& aGraphicsContext)
|
sl@0
|
1085 |
{
|
sl@0
|
1086 |
CGraphicsContext::TPenStyle penStyle;
|
sl@0
|
1087 |
ReadL<CGraphicsContext::TPenStyle>(penStyle);
|
sl@0
|
1088 |
|
sl@0
|
1089 |
DoSetPenStyleL(aGraphicsContext, penStyle);
|
sl@0
|
1090 |
}
|
sl@0
|
1091 |
|
sl@0
|
1092 |
void CCommandBuffer::DoSetPenStyleL(CWindowGc& aWindowGc, CGraphicsContext::TPenStyle aPenStyle)
|
sl@0
|
1093 |
{
|
sl@0
|
1094 |
aWindowGc.SetPenStyle(aPenStyle);
|
sl@0
|
1095 |
}
|
sl@0
|
1096 |
|
sl@0
|
1097 |
void CCommandBuffer::DoSetPenStyleL(MWsGraphicsContext& aGraphicsContext, CGraphicsContext::TPenStyle aPenStyle)
|
sl@0
|
1098 |
{
|
sl@0
|
1099 |
aGraphicsContext.SetPenStyle(BitGdiToMWsGraphicsContextMappings::Convert(aPenStyle));
|
sl@0
|
1100 |
}
|
sl@0
|
1101 |
|
sl@0
|
1102 |
template<typename ContextType> void CCommandBuffer::SetPenSizeL(ContextType& aGraphicsContext)
|
sl@0
|
1103 |
{
|
sl@0
|
1104 |
TSize size;
|
sl@0
|
1105 |
ReadL<TSize>(size);
|
sl@0
|
1106 |
|
sl@0
|
1107 |
DoSetPenSizeL(aGraphicsContext, size);
|
sl@0
|
1108 |
}
|
sl@0
|
1109 |
|
sl@0
|
1110 |
void CCommandBuffer::DoSetPenSizeL(CWindowGc& aWindowGc, TSize aSize)
|
sl@0
|
1111 |
{
|
sl@0
|
1112 |
aWindowGc.SetPenSize(aSize);
|
sl@0
|
1113 |
}
|
sl@0
|
1114 |
|
sl@0
|
1115 |
void CCommandBuffer::DoSetPenSizeL(MWsGraphicsContext& aGraphicsContext, TSize aSize)
|
sl@0
|
1116 |
{
|
sl@0
|
1117 |
aGraphicsContext.SetPenSize(aSize);
|
sl@0
|
1118 |
}
|
sl@0
|
1119 |
|
sl@0
|
1120 |
template<typename ContextType> void CCommandBuffer::SetBrushColorL(ContextType& aGraphicsContext)
|
sl@0
|
1121 |
{
|
sl@0
|
1122 |
TRgb color;
|
sl@0
|
1123 |
ReadL<TRgb>(color);
|
sl@0
|
1124 |
|
sl@0
|
1125 |
aGraphicsContext.SetBrushColor(color);
|
sl@0
|
1126 |
}
|
sl@0
|
1127 |
|
sl@0
|
1128 |
template<typename ContextType> void CCommandBuffer::SetBrushStyleL(ContextType& aGraphicsContext)
|
sl@0
|
1129 |
{
|
sl@0
|
1130 |
CGraphicsContext::TBrushStyle brushStyle;
|
sl@0
|
1131 |
ReadL<CGraphicsContext::TBrushStyle>(brushStyle);
|
sl@0
|
1132 |
|
sl@0
|
1133 |
DoSetBrushStyleL(aGraphicsContext, brushStyle);
|
sl@0
|
1134 |
}
|
sl@0
|
1135 |
|
sl@0
|
1136 |
void CCommandBuffer::DoSetBrushStyleL(CWindowGc& aWindowGc, CGraphicsContext::TBrushStyle aBrushStyle)
|
sl@0
|
1137 |
{
|
sl@0
|
1138 |
aWindowGc.SetBrushStyle(aBrushStyle);
|
sl@0
|
1139 |
}
|
sl@0
|
1140 |
|
sl@0
|
1141 |
void CCommandBuffer::DoSetBrushStyleL(MWsGraphicsContext& aGraphicsContext, CGraphicsContext::TBrushStyle aBrushStyle)
|
sl@0
|
1142 |
{
|
sl@0
|
1143 |
aGraphicsContext.SetBrushStyle(BitGdiToMWsGraphicsContextMappings::Convert(aBrushStyle));
|
sl@0
|
1144 |
}
|
sl@0
|
1145 |
|
sl@0
|
1146 |
template<typename ContextType> void CCommandBuffer::SetBrushOriginL(ContextType& aGraphicsContext)
|
sl@0
|
1147 |
{
|
sl@0
|
1148 |
TPoint point;
|
sl@0
|
1149 |
ReadL<TPoint>(point);
|
sl@0
|
1150 |
|
sl@0
|
1151 |
aGraphicsContext.SetBrushOrigin(point);
|
sl@0
|
1152 |
}
|
sl@0
|
1153 |
|
sl@0
|
1154 |
template<typename ContextType> void CCommandBuffer::UseBrushPatternL(ContextType& aGraphicsContext)
|
sl@0
|
1155 |
{
|
sl@0
|
1156 |
TInt deviceHandle;
|
sl@0
|
1157 |
ReadL<TInt>(deviceHandle);
|
sl@0
|
1158 |
|
sl@0
|
1159 |
if(iBitmapCache->UseL(deviceHandle)) return;
|
sl@0
|
1160 |
DoUseBrushPatternL(aGraphicsContext, deviceHandle);
|
sl@0
|
1161 |
}
|
sl@0
|
1162 |
|
sl@0
|
1163 |
void CCommandBuffer::DoUseBrushPatternL(CWindowGc& aWindowGc, TInt aDeviceHandle)
|
sl@0
|
1164 |
{
|
sl@0
|
1165 |
aWindowGc.UseBrushPattern(iBitmapCache->Resolve(aDeviceHandle));
|
sl@0
|
1166 |
}
|
sl@0
|
1167 |
|
sl@0
|
1168 |
void CCommandBuffer::DoUseBrushPatternL(MWsGraphicsContext& aGraphicsContext, TInt aDeviceHandle)
|
sl@0
|
1169 |
{
|
sl@0
|
1170 |
aGraphicsContext.SetBrushPattern(*iBitmapCache->Resolve(aDeviceHandle));
|
sl@0
|
1171 |
}
|
sl@0
|
1172 |
|
sl@0
|
1173 |
void CCommandBuffer::DiscardBrushPattern(CWindowGc& aWindowGc) const
|
sl@0
|
1174 |
{
|
sl@0
|
1175 |
aWindowGc.DiscardBrushPattern();
|
sl@0
|
1176 |
}
|
sl@0
|
1177 |
|
sl@0
|
1178 |
void CCommandBuffer::DiscardBrushPattern(MWsGraphicsContext& aGraphicsContext) const
|
sl@0
|
1179 |
{
|
sl@0
|
1180 |
aGraphicsContext.ResetBrushPattern();
|
sl@0
|
1181 |
}
|
sl@0
|
1182 |
|
sl@0
|
1183 |
template<typename ContextType> void CCommandBuffer::MoveToL(ContextType& aGraphicsContext)
|
sl@0
|
1184 |
{
|
sl@0
|
1185 |
TPoint point;
|
sl@0
|
1186 |
ReadL<TPoint>(point);
|
sl@0
|
1187 |
|
sl@0
|
1188 |
aGraphicsContext.MoveTo(point);
|
sl@0
|
1189 |
}
|
sl@0
|
1190 |
|
sl@0
|
1191 |
template<typename ContextType> void CCommandBuffer::MoveByL(ContextType& aGraphicsContext)
|
sl@0
|
1192 |
{
|
sl@0
|
1193 |
TPoint point;
|
sl@0
|
1194 |
ReadL<TPoint>(point);
|
sl@0
|
1195 |
|
sl@0
|
1196 |
aGraphicsContext.MoveBy(point);
|
sl@0
|
1197 |
}
|
sl@0
|
1198 |
|
sl@0
|
1199 |
template<typename ContextType> void CCommandBuffer::PlotL(ContextType& aGraphicsContext)
|
sl@0
|
1200 |
{
|
sl@0
|
1201 |
TPoint point;
|
sl@0
|
1202 |
ReadL<TPoint>(point);
|
sl@0
|
1203 |
|
sl@0
|
1204 |
aGraphicsContext.Plot(point);
|
sl@0
|
1205 |
}
|
sl@0
|
1206 |
|
sl@0
|
1207 |
template<typename ContextType> void CCommandBuffer::DrawArcL(ContextType& aGraphicsContext)
|
sl@0
|
1208 |
{
|
sl@0
|
1209 |
TRect rect;
|
sl@0
|
1210 |
TPoint start;
|
sl@0
|
1211 |
TPoint end;
|
sl@0
|
1212 |
ReadL<TRect>(rect);
|
sl@0
|
1213 |
ReadL<TPoint>(start);
|
sl@0
|
1214 |
ReadL<TPoint>(end);
|
sl@0
|
1215 |
|
sl@0
|
1216 |
aGraphicsContext.DrawArc(rect, start, end);
|
sl@0
|
1217 |
}
|
sl@0
|
1218 |
|
sl@0
|
1219 |
template<typename ContextType> void CCommandBuffer::DrawLineL(ContextType& aGraphicsContext)
|
sl@0
|
1220 |
{
|
sl@0
|
1221 |
TPoint point1;
|
sl@0
|
1222 |
TPoint point2;
|
sl@0
|
1223 |
ReadL<TPoint>(point1);
|
sl@0
|
1224 |
ReadL<TPoint>(point2);
|
sl@0
|
1225 |
|
sl@0
|
1226 |
aGraphicsContext.DrawLine(point1, point2);
|
sl@0
|
1227 |
}
|
sl@0
|
1228 |
|
sl@0
|
1229 |
template<typename ContextType> void CCommandBuffer::DrawLineToL(ContextType& aGraphicsContext)
|
sl@0
|
1230 |
{
|
sl@0
|
1231 |
TPoint point;
|
sl@0
|
1232 |
ReadL<TPoint>(point);
|
sl@0
|
1233 |
|
sl@0
|
1234 |
aGraphicsContext.DrawLineTo(point);
|
sl@0
|
1235 |
}
|
sl@0
|
1236 |
|
sl@0
|
1237 |
template<typename ContextType> void CCommandBuffer::DrawLineByL(ContextType& aGraphicsContext)
|
sl@0
|
1238 |
{
|
sl@0
|
1239 |
TPoint point;
|
sl@0
|
1240 |
ReadL<TPoint>(point);
|
sl@0
|
1241 |
|
sl@0
|
1242 |
aGraphicsContext.DrawLineBy(point);
|
sl@0
|
1243 |
}
|
sl@0
|
1244 |
|
sl@0
|
1245 |
void CCommandBuffer::DrawPolyLineL(CWindowGc& aWindowGc)
|
sl@0
|
1246 |
{
|
sl@0
|
1247 |
TInt nrOfPoints;
|
sl@0
|
1248 |
ReadL<TInt>(nrOfPoints);
|
sl@0
|
1249 |
|
sl@0
|
1250 |
CArrayFix<TPoint>* pointList = new (ELeave) CArrayFixFlat<TPoint>(5);
|
sl@0
|
1251 |
CleanupStack::PushL(pointList);
|
sl@0
|
1252 |
for(TInt i = 0; i < nrOfPoints; i++)
|
sl@0
|
1253 |
{
|
sl@0
|
1254 |
TPoint point;
|
sl@0
|
1255 |
ReadL<TPoint>(point);
|
sl@0
|
1256 |
pointList->AppendL(point);
|
sl@0
|
1257 |
}
|
sl@0
|
1258 |
|
sl@0
|
1259 |
aWindowGc.DrawPolyLine(pointList);
|
sl@0
|
1260 |
CleanupStack::PopAndDestroy(pointList);
|
sl@0
|
1261 |
}
|
sl@0
|
1262 |
|
sl@0
|
1263 |
void CCommandBuffer::DrawPolyLineL(MWsGraphicsContext& aGraphicsContext)
|
sl@0
|
1264 |
{
|
sl@0
|
1265 |
TInt nrOfPoints;
|
sl@0
|
1266 |
ReadL<TInt>(nrOfPoints);
|
sl@0
|
1267 |
|
sl@0
|
1268 |
TPoint *points=(TPoint *)(nrOfPoints+1);
|
sl@0
|
1269 |
TArrayWrapper<TPoint> pointList(points, nrOfPoints);
|
sl@0
|
1270 |
|
sl@0
|
1271 |
aGraphicsContext.DrawPolyLine(pointList);
|
sl@0
|
1272 |
}
|
sl@0
|
1273 |
|
sl@0
|
1274 |
template<typename ContextType> void CCommandBuffer::DrawPieL(ContextType& aGraphicsContext)
|
sl@0
|
1275 |
{
|
sl@0
|
1276 |
TRect rect;
|
sl@0
|
1277 |
TPoint start;
|
sl@0
|
1278 |
TPoint end;
|
sl@0
|
1279 |
ReadL<TRect>(rect);
|
sl@0
|
1280 |
ReadL<TPoint>(start);
|
sl@0
|
1281 |
ReadL<TPoint>(end);
|
sl@0
|
1282 |
|
sl@0
|
1283 |
aGraphicsContext.DrawPie(rect, start, end);
|
sl@0
|
1284 |
}
|
sl@0
|
1285 |
|
sl@0
|
1286 |
template<typename ContextType> void CCommandBuffer::DrawEllipseL(ContextType& aGraphicsContext)
|
sl@0
|
1287 |
{
|
sl@0
|
1288 |
TRect rect;
|
sl@0
|
1289 |
ReadL<TRect>(rect);
|
sl@0
|
1290 |
|
sl@0
|
1291 |
aGraphicsContext.DrawEllipse(rect);
|
sl@0
|
1292 |
}
|
sl@0
|
1293 |
|
sl@0
|
1294 |
template<typename ContextType> void CCommandBuffer::DrawRectL(ContextType& aGraphicsContext)
|
sl@0
|
1295 |
{
|
sl@0
|
1296 |
TRect rect;
|
sl@0
|
1297 |
ReadL<TRect>(rect);
|
sl@0
|
1298 |
|
sl@0
|
1299 |
aGraphicsContext.DrawRect(rect);
|
sl@0
|
1300 |
}
|
sl@0
|
1301 |
|
sl@0
|
1302 |
template<typename ContextType> void CCommandBuffer::DrawRoundRectL(ContextType& aGraphicsContext)
|
sl@0
|
1303 |
{
|
sl@0
|
1304 |
TRect rect;
|
sl@0
|
1305 |
TSize ellipse;
|
sl@0
|
1306 |
ReadL<TRect>(rect);
|
sl@0
|
1307 |
ReadL<TSize>(ellipse);
|
sl@0
|
1308 |
|
sl@0
|
1309 |
aGraphicsContext.DrawRoundRect(rect, ellipse);
|
sl@0
|
1310 |
}
|
sl@0
|
1311 |
|
sl@0
|
1312 |
void CCommandBuffer::DrawPolygonL(CWindowGc& aWindowGc)
|
sl@0
|
1313 |
{
|
sl@0
|
1314 |
TInt nrOfPoints;
|
sl@0
|
1315 |
ReadL<TInt>(nrOfPoints);
|
sl@0
|
1316 |
|
sl@0
|
1317 |
CArrayFix<TPoint>* pointList = new (ELeave) CArrayFixFlat<TPoint>(5);
|
sl@0
|
1318 |
CleanupStack::PushL(pointList);
|
sl@0
|
1319 |
for(TInt i = 0; i < nrOfPoints; i++)
|
sl@0
|
1320 |
{
|
sl@0
|
1321 |
TPoint point;
|
sl@0
|
1322 |
ReadL<TPoint>(point);
|
sl@0
|
1323 |
pointList->AppendL(point);
|
sl@0
|
1324 |
}
|
sl@0
|
1325 |
|
sl@0
|
1326 |
CGraphicsContext::TFillRule fillRule;
|
sl@0
|
1327 |
ReadL<CGraphicsContext::TFillRule>(fillRule);
|
sl@0
|
1328 |
aWindowGc.DrawPolygon(pointList, fillRule);
|
sl@0
|
1329 |
CleanupStack::PopAndDestroy(pointList);
|
sl@0
|
1330 |
}
|
sl@0
|
1331 |
|
sl@0
|
1332 |
void CCommandBuffer::DrawPolygonL(MWsGraphicsContext& aGraphicsContext)
|
sl@0
|
1333 |
{
|
sl@0
|
1334 |
TInt nrOfPoints;
|
sl@0
|
1335 |
ReadL<TInt>(nrOfPoints);
|
sl@0
|
1336 |
|
sl@0
|
1337 |
TPoint *points=(TPoint *)(nrOfPoints+1);
|
sl@0
|
1338 |
TArrayWrapper<TPoint> pointList(points, nrOfPoints);
|
sl@0
|
1339 |
|
sl@0
|
1340 |
CGraphicsContext::TFillRule fillRule;
|
sl@0
|
1341 |
ReadL<CGraphicsContext::TFillRule>(fillRule);
|
sl@0
|
1342 |
aGraphicsContext.DrawPolygon(pointList, BitGdiToMWsGraphicsContextMappings::Convert(fillRule));
|
sl@0
|
1343 |
}
|
sl@0
|
1344 |
|
sl@0
|
1345 |
void CCommandBuffer::DrawBitmap1L(CWindowGc& aWindowGc)
|
sl@0
|
1346 |
{
|
sl@0
|
1347 |
TPoint topLeft;
|
sl@0
|
1348 |
TInt bitmapHandle;
|
sl@0
|
1349 |
|
sl@0
|
1350 |
ReadL<TPoint>(topLeft);
|
sl@0
|
1351 |
ReadL<TInt>(bitmapHandle);
|
sl@0
|
1352 |
|
sl@0
|
1353 |
if(!iBitmapCache->UseL(bitmapHandle))
|
sl@0
|
1354 |
aWindowGc.DrawBitmap(topLeft, iBitmapCache->Resolve(bitmapHandle));
|
sl@0
|
1355 |
}
|
sl@0
|
1356 |
|
sl@0
|
1357 |
void CCommandBuffer::DrawBitmap1L(MWsGraphicsContext& /*aGraphicsContext*/)
|
sl@0
|
1358 |
{
|
sl@0
|
1359 |
User::Leave(KErrNotSupported); //this op code is deprecated, should never be generated
|
sl@0
|
1360 |
}
|
sl@0
|
1361 |
|
sl@0
|
1362 |
template<typename ContextType> void CCommandBuffer::DrawBitmap2L(ContextType& aGraphicsContext)
|
sl@0
|
1363 |
{
|
sl@0
|
1364 |
TRect destRect;
|
sl@0
|
1365 |
TInt bitmapHandle;
|
sl@0
|
1366 |
|
sl@0
|
1367 |
ReadL<TRect>(destRect);
|
sl@0
|
1368 |
ReadL<TInt>(bitmapHandle);
|
sl@0
|
1369 |
|
sl@0
|
1370 |
if(!iBitmapCache->UseL(bitmapHandle))
|
sl@0
|
1371 |
DoDrawBitmap2L(aGraphicsContext, destRect, bitmapHandle);
|
sl@0
|
1372 |
}
|
sl@0
|
1373 |
|
sl@0
|
1374 |
void CCommandBuffer::DoDrawBitmap2L(CWindowGc& aWindowGc, TRect aDestRect, TInt aBitmapHandle)
|
sl@0
|
1375 |
{
|
sl@0
|
1376 |
aWindowGc.DrawBitmap(aDestRect, iBitmapCache->Resolve(aBitmapHandle));
|
sl@0
|
1377 |
}
|
sl@0
|
1378 |
|
sl@0
|
1379 |
void CCommandBuffer::DoDrawBitmap2L(MWsGraphicsContext& aGraphicsContext, TRect aDestRect, TInt aBitmapHandle)
|
sl@0
|
1380 |
{
|
sl@0
|
1381 |
aGraphicsContext.DrawBitmap(aDestRect, *iBitmapCache->Resolve(aBitmapHandle));
|
sl@0
|
1382 |
}
|
sl@0
|
1383 |
|
sl@0
|
1384 |
template<typename ContextType> void CCommandBuffer::DrawBitmap3L(ContextType& aGraphicsContext)
|
sl@0
|
1385 |
{
|
sl@0
|
1386 |
TRect destRect;
|
sl@0
|
1387 |
TInt bitmapHandle;
|
sl@0
|
1388 |
TRect sourceRect;
|
sl@0
|
1389 |
|
sl@0
|
1390 |
ReadL<TRect>(destRect);
|
sl@0
|
1391 |
ReadL<TInt>(bitmapHandle);
|
sl@0
|
1392 |
ReadL<TRect>(sourceRect);
|
sl@0
|
1393 |
|
sl@0
|
1394 |
if(!iBitmapCache->UseL(bitmapHandle))
|
sl@0
|
1395 |
DoDrawBitmap3L(aGraphicsContext, destRect, bitmapHandle, sourceRect);
|
sl@0
|
1396 |
}
|
sl@0
|
1397 |
|
sl@0
|
1398 |
void CCommandBuffer::DoDrawBitmap3L(CWindowGc& aWindowGc, TRect aDestRect, TInt aBitmapHandle, TRect aSourceRect)
|
sl@0
|
1399 |
{
|
sl@0
|
1400 |
aWindowGc.DrawBitmap(aDestRect, iBitmapCache->Resolve(aBitmapHandle), aSourceRect);
|
sl@0
|
1401 |
}
|
sl@0
|
1402 |
|
sl@0
|
1403 |
void CCommandBuffer::DoDrawBitmap3L(MWsGraphicsContext& aGraphicsContext, TRect aDestRect, TInt aBitmapHandle, TRect aSourceRect)
|
sl@0
|
1404 |
{
|
sl@0
|
1405 |
aGraphicsContext.DrawBitmap(aDestRect, *iBitmapCache->Resolve(aBitmapHandle), aSourceRect);
|
sl@0
|
1406 |
}
|
sl@0
|
1407 |
|
sl@0
|
1408 |
template<typename ContextType> void CCommandBuffer::DrawBitmapMaskedL(ContextType& aGraphicsContext)
|
sl@0
|
1409 |
{
|
sl@0
|
1410 |
TRect destRect;
|
sl@0
|
1411 |
TInt bitmapHandle;
|
sl@0
|
1412 |
TRect sourceRect;
|
sl@0
|
1413 |
TInt maskHandle;
|
sl@0
|
1414 |
TBool invertedMask;
|
sl@0
|
1415 |
|
sl@0
|
1416 |
ReadL<TRect>(destRect);
|
sl@0
|
1417 |
ReadL<TInt>(bitmapHandle);
|
sl@0
|
1418 |
ReadL<TRect>(sourceRect);
|
sl@0
|
1419 |
ReadL<TInt>(maskHandle);
|
sl@0
|
1420 |
ReadL<TBool>(invertedMask);
|
sl@0
|
1421 |
|
sl@0
|
1422 |
if(!iBitmapCache->UseL(bitmapHandle) && !iBitmapCache->UseL(maskHandle))
|
sl@0
|
1423 |
DoDrawBitmapMaskedL(aGraphicsContext, destRect, bitmapHandle, sourceRect, maskHandle, invertedMask);
|
sl@0
|
1424 |
}
|
sl@0
|
1425 |
|
sl@0
|
1426 |
void CCommandBuffer::DoDrawBitmapMaskedL(CWindowGc& aWindowGc, TRect aDestRect, TInt aBitmapHandle, TRect aSourceRect, TInt aMaskHandle, TBool aInvertedMask)
|
sl@0
|
1427 |
{
|
sl@0
|
1428 |
aWindowGc.DrawBitmapMasked(aDestRect, iBitmapCache->Resolve(aBitmapHandle), aSourceRect, iBitmapCache->Resolve(aMaskHandle), aInvertedMask);
|
sl@0
|
1429 |
}
|
sl@0
|
1430 |
|
sl@0
|
1431 |
void CCommandBuffer::DoDrawBitmapMaskedL(MWsGraphicsContext& aGraphicsContext, TRect aDestRect, TInt aBitmapHandle, TRect aSourceRect, TInt aMaskHandle, TBool aInvertedMask)
|
sl@0
|
1432 |
{
|
sl@0
|
1433 |
aGraphicsContext.DrawBitmapMasked(aDestRect, *iBitmapCache->Resolve(aBitmapHandle), aSourceRect, *iBitmapCache->Resolve(aMaskHandle), aInvertedMask);
|
sl@0
|
1434 |
}
|
sl@0
|
1435 |
|
sl@0
|
1436 |
template<typename ContextType> void CCommandBuffer::DrawText1L(ContextType& aGraphicsContext)
|
sl@0
|
1437 |
{
|
sl@0
|
1438 |
TPtrC16 text;
|
sl@0
|
1439 |
TPoint point;
|
sl@0
|
1440 |
|
sl@0
|
1441 |
ReadTextLC(text);
|
sl@0
|
1442 |
ReadL<TPoint>(point);
|
sl@0
|
1443 |
|
sl@0
|
1444 |
DoDrawText1L(aGraphicsContext, text, point);
|
sl@0
|
1445 |
CleanupStack::PopAndDestroy(); // ReadTextLC
|
sl@0
|
1446 |
}
|
sl@0
|
1447 |
|
sl@0
|
1448 |
void CCommandBuffer::DoDrawText1L(CWindowGc& aWindowGc, TPtrC16 aText, TPoint aPoint)
|
sl@0
|
1449 |
{
|
sl@0
|
1450 |
aWindowGc.DrawText(aText, aPoint);
|
sl@0
|
1451 |
}
|
sl@0
|
1452 |
|
sl@0
|
1453 |
void CCommandBuffer::DoDrawText1L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TPoint aPoint)
|
sl@0
|
1454 |
{
|
sl@0
|
1455 |
aGraphicsContext.DrawText(aText, /*TTextParameters*/ NULL, aPoint);
|
sl@0
|
1456 |
}
|
sl@0
|
1457 |
|
sl@0
|
1458 |
template<typename ContextType> void CCommandBuffer::DrawText2L(ContextType& aGraphicsContext)
|
sl@0
|
1459 |
{
|
sl@0
|
1460 |
TPtrC16 text;
|
sl@0
|
1461 |
TRect box;
|
sl@0
|
1462 |
TInt baselineOffset;
|
sl@0
|
1463 |
CGraphicsContext::TTextAlign horiz;
|
sl@0
|
1464 |
TInt leftMargin;
|
sl@0
|
1465 |
|
sl@0
|
1466 |
ReadTextLC(text);
|
sl@0
|
1467 |
ReadL<TRect>(box);
|
sl@0
|
1468 |
ReadL<TInt>(baselineOffset);
|
sl@0
|
1469 |
ReadL<CGraphicsContext::TTextAlign>(horiz);
|
sl@0
|
1470 |
ReadL<TInt>(leftMargin);
|
sl@0
|
1471 |
|
sl@0
|
1472 |
DoDrawText2L(aGraphicsContext, text, box, baselineOffset, horiz, leftMargin);
|
sl@0
|
1473 |
CleanupStack::PopAndDestroy(); // ReadTextLC
|
sl@0
|
1474 |
}
|
sl@0
|
1475 |
|
sl@0
|
1476 |
void CCommandBuffer::DoDrawText2L(CWindowGc& aWindowGc, TPtrC16 aText, TRect aBox, TInt aBaselineOffset, CGraphicsContext::TTextAlign aHoriz, TInt aLeftMargin)
|
sl@0
|
1477 |
{
|
sl@0
|
1478 |
aWindowGc.DrawText(aText, aBox, aBaselineOffset, aHoriz, aLeftMargin);
|
sl@0
|
1479 |
}
|
sl@0
|
1480 |
|
sl@0
|
1481 |
void CCommandBuffer::DoDrawText2L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TRect aBox, TInt aBaselineOffset, CGraphicsContext::TTextAlign aHoriz, TInt aLeftMargin)
|
sl@0
|
1482 |
{
|
sl@0
|
1483 |
aGraphicsContext.DrawText(aText, /*TTextParameters*/ NULL, aBox, aBaselineOffset, BitGdiToMWsGraphicsContextMappings::Convert(aHoriz), aLeftMargin);
|
sl@0
|
1484 |
}
|
sl@0
|
1485 |
|
sl@0
|
1486 |
template<typename ContextType> void CCommandBuffer::DrawText3L(ContextType& aGraphicsContext)
|
sl@0
|
1487 |
{
|
sl@0
|
1488 |
TPtrC16 text;
|
sl@0
|
1489 |
TPoint point;
|
sl@0
|
1490 |
CGraphicsContext::TDrawTextParam param;
|
sl@0
|
1491 |
|
sl@0
|
1492 |
ReadTextLC(text);
|
sl@0
|
1493 |
ReadL<TPoint>(point);
|
sl@0
|
1494 |
//This is now ignored in the implmentation in CGraphicsContext and hence will ignore it here.
|
sl@0
|
1495 |
ReadL<CGraphicsContext::TDrawTextParam>(param);
|
sl@0
|
1496 |
|
sl@0
|
1497 |
DoDrawText3L(aGraphicsContext, text, point);
|
sl@0
|
1498 |
CleanupStack::PopAndDestroy(); //ReadTextLC
|
sl@0
|
1499 |
}
|
sl@0
|
1500 |
|
sl@0
|
1501 |
void CCommandBuffer::DoDrawText3L(CWindowGc& aWindowGc, TPtrC16 aText, TPoint aPoint)
|
sl@0
|
1502 |
{
|
sl@0
|
1503 |
aWindowGc.DrawText(aText, aPoint);
|
sl@0
|
1504 |
}
|
sl@0
|
1505 |
|
sl@0
|
1506 |
void CCommandBuffer::DoDrawText3L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TPoint aPoint)
|
sl@0
|
1507 |
{
|
sl@0
|
1508 |
aGraphicsContext.DrawText(aText, /*TTextParameters*/ NULL, aPoint);
|
sl@0
|
1509 |
}
|
sl@0
|
1510 |
|
sl@0
|
1511 |
template<typename ContextType> void CCommandBuffer::DrawText4L(ContextType& aGraphicsContext)
|
sl@0
|
1512 |
{
|
sl@0
|
1513 |
TPtrC16 text;
|
sl@0
|
1514 |
CGraphicsContext::TTextParameters param;
|
sl@0
|
1515 |
TPoint point;
|
sl@0
|
1516 |
|
sl@0
|
1517 |
ReadTextLC(text);
|
sl@0
|
1518 |
ReadL<CGraphicsContext::TTextParameters>(param);
|
sl@0
|
1519 |
ReadL<TPoint>(point);
|
sl@0
|
1520 |
|
sl@0
|
1521 |
DoDrawText4L(aGraphicsContext, text, param, point);
|
sl@0
|
1522 |
CleanupStack::PopAndDestroy(); // ReadTextLC
|
sl@0
|
1523 |
}
|
sl@0
|
1524 |
|
sl@0
|
1525 |
void CCommandBuffer::DoDrawText4L(CWindowGc& aWindowGc, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TPoint aPoint)
|
sl@0
|
1526 |
{
|
sl@0
|
1527 |
aWindowGc.DrawText(aText, &aParam, aPoint);
|
sl@0
|
1528 |
}
|
sl@0
|
1529 |
|
sl@0
|
1530 |
void CCommandBuffer::DoDrawText4L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TPoint aPoint)
|
sl@0
|
1531 |
{
|
sl@0
|
1532 |
aGraphicsContext.DrawText(aText, BitGdiToMWsGraphicsContextMappings::Convert(&aParam), aPoint);
|
sl@0
|
1533 |
}
|
sl@0
|
1534 |
|
sl@0
|
1535 |
template<typename ContextType> void CCommandBuffer::DrawText5L(ContextType& aGraphicsContext)
|
sl@0
|
1536 |
{
|
sl@0
|
1537 |
TPtrC16 text;
|
sl@0
|
1538 |
CGraphicsContext::TTextParameters param;
|
sl@0
|
1539 |
TRect box;
|
sl@0
|
1540 |
TInt baselineOffset;
|
sl@0
|
1541 |
CGraphicsContext::TTextAlign horiz;
|
sl@0
|
1542 |
TInt leftMargin;
|
sl@0
|
1543 |
|
sl@0
|
1544 |
ReadTextLC(text);
|
sl@0
|
1545 |
ReadL<CGraphicsContext::TTextParameters>(param);
|
sl@0
|
1546 |
ReadL<TRect>(box);
|
sl@0
|
1547 |
ReadL<TInt>(baselineOffset);
|
sl@0
|
1548 |
ReadL<CGraphicsContext::TTextAlign>(horiz);
|
sl@0
|
1549 |
ReadL<TInt>(leftMargin);
|
sl@0
|
1550 |
|
sl@0
|
1551 |
DoDrawText5L(aGraphicsContext, text, param, box, baselineOffset, horiz, leftMargin);
|
sl@0
|
1552 |
CleanupStack::PopAndDestroy(); // ReadTextLC
|
sl@0
|
1553 |
}
|
sl@0
|
1554 |
|
sl@0
|
1555 |
void CCommandBuffer::DoDrawText5L(CWindowGc& aWindowGc, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TRect aBox, TInt aBaselineOffset, CGraphicsContext::TTextAlign aHoriz, TInt aLeftMargin)
|
sl@0
|
1556 |
{
|
sl@0
|
1557 |
aWindowGc.DrawText(aText, &aParam, aBox, aBaselineOffset, aHoriz, aLeftMargin);
|
sl@0
|
1558 |
}
|
sl@0
|
1559 |
|
sl@0
|
1560 |
void CCommandBuffer::DoDrawText5L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TRect aBox, TInt aBaselineOffset, CGraphicsContext::TTextAlign aHoriz, TInt aLeftMargin)
|
sl@0
|
1561 |
{
|
sl@0
|
1562 |
aGraphicsContext.DrawText(aText, BitGdiToMWsGraphicsContextMappings::Convert(&aParam), aBox, aBaselineOffset, BitGdiToMWsGraphicsContextMappings::Convert(aHoriz), aLeftMargin);
|
sl@0
|
1563 |
}
|
sl@0
|
1564 |
|
sl@0
|
1565 |
template<typename ContextType> void CCommandBuffer::SetClippingRegionL(ContextType& aGraphicsContext)
|
sl@0
|
1566 |
{
|
sl@0
|
1567 |
TInt nrOfRects;
|
sl@0
|
1568 |
ReadL<TInt>(nrOfRects);
|
sl@0
|
1569 |
|
sl@0
|
1570 |
TRect rect;
|
sl@0
|
1571 |
iClippingRegion.Clear();
|
sl@0
|
1572 |
for(TInt i = 0; i < nrOfRects; i++)
|
sl@0
|
1573 |
{
|
sl@0
|
1574 |
ReadL<TRect>(rect);
|
sl@0
|
1575 |
// rect.Move(iMasterOrigin);
|
sl@0
|
1576 |
iClippingRegion.AddRect(rect);
|
sl@0
|
1577 |
}
|
sl@0
|
1578 |
|
sl@0
|
1579 |
iParsedClippingRegionIsSet = ETrue;
|
sl@0
|
1580 |
if(iActiveMasterClippingRegion)
|
sl@0
|
1581 |
iClippingRegion.Intersect(*iActiveMasterClippingRegion);
|
sl@0
|
1582 |
|
sl@0
|
1583 |
if(!iClippingRect.IsEmpty())
|
sl@0
|
1584 |
{
|
sl@0
|
1585 |
iClippingRegion.ClipRect(iClippingRect);
|
sl@0
|
1586 |
}
|
sl@0
|
1587 |
|
sl@0
|
1588 |
aGraphicsContext.SetClippingRegion(iClippingRegion);
|
sl@0
|
1589 |
}
|
sl@0
|
1590 |
|
sl@0
|
1591 |
template<typename ContextType> void CCommandBuffer::CancelClippingRegion(ContextType& aGraphicsContext)
|
sl@0
|
1592 |
{
|
sl@0
|
1593 |
iClippingRegion.Clear();
|
sl@0
|
1594 |
iParsedClippingRegionIsSet = EFalse;
|
sl@0
|
1595 |
if(iActiveMasterClippingRegion)
|
sl@0
|
1596 |
aGraphicsContext.SetClippingRegion(*iActiveMasterClippingRegion);
|
sl@0
|
1597 |
else
|
sl@0
|
1598 |
DoCancelClippingRegion(aGraphicsContext);
|
sl@0
|
1599 |
}
|
sl@0
|
1600 |
|
sl@0
|
1601 |
void CCommandBuffer::DoCancelClippingRegion(CWindowGc& aWindowGc)
|
sl@0
|
1602 |
{
|
sl@0
|
1603 |
aWindowGc.CancelClippingRegion();
|
sl@0
|
1604 |
}
|
sl@0
|
1605 |
|
sl@0
|
1606 |
void CCommandBuffer::DoCancelClippingRegion(MWsGraphicsContext& aGraphicsContext)
|
sl@0
|
1607 |
{
|
sl@0
|
1608 |
aGraphicsContext.ResetClippingRegion();
|
sl@0
|
1609 |
}
|
sl@0
|
1610 |
|
sl@0
|
1611 |
template<typename ContextType> void CCommandBuffer::DrawTextVertical1L(ContextType& aGraphicsContext)
|
sl@0
|
1612 |
{
|
sl@0
|
1613 |
TPtrC16 text;
|
sl@0
|
1614 |
TPoint point;
|
sl@0
|
1615 |
TBool up;
|
sl@0
|
1616 |
|
sl@0
|
1617 |
ReadTextLC(text);
|
sl@0
|
1618 |
ReadL<TPoint>(point);
|
sl@0
|
1619 |
ReadL<TBool>(up);
|
sl@0
|
1620 |
|
sl@0
|
1621 |
DoDrawTextVertical1L(aGraphicsContext, text, point, up);
|
sl@0
|
1622 |
CleanupStack::PopAndDestroy(); // ReadTextLC
|
sl@0
|
1623 |
}
|
sl@0
|
1624 |
|
sl@0
|
1625 |
void CCommandBuffer::DoDrawTextVertical1L(CWindowGc& aWindowGc, TPtrC16 aText, TPoint aPoint, TBool aUp)
|
sl@0
|
1626 |
{
|
sl@0
|
1627 |
aWindowGc.DrawTextVertical(aText, aPoint, aUp);
|
sl@0
|
1628 |
}
|
sl@0
|
1629 |
|
sl@0
|
1630 |
void CCommandBuffer::DoDrawTextVertical1L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TPoint aPoint, TBool aUp)
|
sl@0
|
1631 |
{
|
sl@0
|
1632 |
aGraphicsContext.DrawTextVertical(aText, /*TTextParameters*/ NULL, aPoint, aUp);
|
sl@0
|
1633 |
}
|
sl@0
|
1634 |
|
sl@0
|
1635 |
template<typename ContextType> void CCommandBuffer::DrawTextVertical2L(ContextType& aGraphicsContext)
|
sl@0
|
1636 |
{
|
sl@0
|
1637 |
TPtrC16 text;
|
sl@0
|
1638 |
TRect box;
|
sl@0
|
1639 |
TInt baselineOffset;
|
sl@0
|
1640 |
TBool up;
|
sl@0
|
1641 |
CGraphicsContext::TTextAlign vertical;
|
sl@0
|
1642 |
TInt margin;
|
sl@0
|
1643 |
|
sl@0
|
1644 |
ReadTextLC(text);
|
sl@0
|
1645 |
ReadL<TRect>(box);
|
sl@0
|
1646 |
ReadL<TInt>(baselineOffset);
|
sl@0
|
1647 |
ReadL<TBool>(up);
|
sl@0
|
1648 |
ReadL<CGraphicsContext::TTextAlign>(vertical);
|
sl@0
|
1649 |
ReadL<TInt>(margin);
|
sl@0
|
1650 |
|
sl@0
|
1651 |
DoDrawTextVertical2L(aGraphicsContext, text, box, baselineOffset, up, vertical, margin);
|
sl@0
|
1652 |
CleanupStack::PopAndDestroy(); //ReadTextLC
|
sl@0
|
1653 |
}
|
sl@0
|
1654 |
|
sl@0
|
1655 |
void CCommandBuffer::DoDrawTextVertical2L(CWindowGc& aWindowGc, TPtrC16 aText, TRect aBox, TInt aBaselineOffset, TBool aUp, CGraphicsContext::TTextAlign aVertical, TInt aMargin)
|
sl@0
|
1656 |
{
|
sl@0
|
1657 |
aWindowGc.DrawTextVertical(aText, aBox, aBaselineOffset, aUp, aVertical, aMargin);
|
sl@0
|
1658 |
}
|
sl@0
|
1659 |
|
sl@0
|
1660 |
void CCommandBuffer::DoDrawTextVertical2L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TRect aBox, TInt aBaselineOffset, TBool aUp, CGraphicsContext::TTextAlign aVertical, TInt aMargin)
|
sl@0
|
1661 |
{
|
sl@0
|
1662 |
aGraphicsContext.DrawTextVertical(aText, /*TTextParameters*/ NULL, aBox, aBaselineOffset, aUp, BitGdiToMWsGraphicsContextMappings::Convert(aVertical), aMargin);
|
sl@0
|
1663 |
}
|
sl@0
|
1664 |
|
sl@0
|
1665 |
template<typename ContextType> void CCommandBuffer::DrawTextVertical3L(ContextType& aGraphicsContext)
|
sl@0
|
1666 |
{
|
sl@0
|
1667 |
TPtrC16 text;
|
sl@0
|
1668 |
CGraphicsContext::TTextParameters param;
|
sl@0
|
1669 |
TPoint point;
|
sl@0
|
1670 |
TBool up;
|
sl@0
|
1671 |
|
sl@0
|
1672 |
ReadTextLC(text);
|
sl@0
|
1673 |
ReadL<CGraphicsContext::TTextParameters>(param);
|
sl@0
|
1674 |
ReadL<TPoint>(point);
|
sl@0
|
1675 |
ReadL<TBool>(up);
|
sl@0
|
1676 |
|
sl@0
|
1677 |
DoDrawTextVertical3L(aGraphicsContext, text, param, point, up);
|
sl@0
|
1678 |
CleanupStack::PopAndDestroy(); // ReadTextLC
|
sl@0
|
1679 |
}
|
sl@0
|
1680 |
|
sl@0
|
1681 |
void CCommandBuffer::DoDrawTextVertical3L(CWindowGc& aWindowGc, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TPoint aPoint, TBool aUp)
|
sl@0
|
1682 |
{
|
sl@0
|
1683 |
aWindowGc.DrawTextVertical(aText, &aParam, aPoint, aUp);
|
sl@0
|
1684 |
}
|
sl@0
|
1685 |
|
sl@0
|
1686 |
void CCommandBuffer::DoDrawTextVertical3L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TPoint aPoint, TBool aUp)
|
sl@0
|
1687 |
{
|
sl@0
|
1688 |
aGraphicsContext.DrawTextVertical(aText, BitGdiToMWsGraphicsContextMappings::Convert(&aParam), aPoint, aUp);
|
sl@0
|
1689 |
}
|
sl@0
|
1690 |
|
sl@0
|
1691 |
template<typename ContextType> void CCommandBuffer::DrawTextVertical4L(ContextType& aGraphicsContext)
|
sl@0
|
1692 |
{
|
sl@0
|
1693 |
TPtrC16 text;
|
sl@0
|
1694 |
CGraphicsContext::TTextParameters param;
|
sl@0
|
1695 |
TRect box;
|
sl@0
|
1696 |
TInt baselineOffset;
|
sl@0
|
1697 |
TBool up;
|
sl@0
|
1698 |
CGraphicsContext::TTextAlign vertical;
|
sl@0
|
1699 |
TInt margin;
|
sl@0
|
1700 |
|
sl@0
|
1701 |
ReadTextLC(text);
|
sl@0
|
1702 |
ReadL<CGraphicsContext::TTextParameters>(param);
|
sl@0
|
1703 |
ReadL<TRect>(box);
|
sl@0
|
1704 |
ReadL<TInt>(baselineOffset);
|
sl@0
|
1705 |
ReadL<TBool>(up);
|
sl@0
|
1706 |
ReadL<CGraphicsContext::TTextAlign>(vertical);
|
sl@0
|
1707 |
ReadL<TInt>(margin);
|
sl@0
|
1708 |
|
sl@0
|
1709 |
DoDrawTextVertical4L(aGraphicsContext, text, param, box, baselineOffset, up, vertical, margin);
|
sl@0
|
1710 |
CleanupStack::PopAndDestroy(); //ReadTextLC
|
sl@0
|
1711 |
}
|
sl@0
|
1712 |
|
sl@0
|
1713 |
void CCommandBuffer::DoDrawTextVertical4L(CWindowGc& aWindowGc, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TRect aBox, TInt aBaselineOffset, TBool aUp, CGraphicsContext::TTextAlign aVertical, TInt aMargin)
|
sl@0
|
1714 |
{
|
sl@0
|
1715 |
aWindowGc.DrawTextVertical(aText, &aParam, aBox, aBaselineOffset, aUp, aVertical, aMargin);
|
sl@0
|
1716 |
}
|
sl@0
|
1717 |
|
sl@0
|
1718 |
void CCommandBuffer::DoDrawTextVertical4L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TRect aBox, TInt aBaselineOffset, TBool aUp, CGraphicsContext::TTextAlign aVertical, TInt aMargin)
|
sl@0
|
1719 |
{
|
sl@0
|
1720 |
aGraphicsContext.DrawTextVertical(aText, BitGdiToMWsGraphicsContextMappings::Convert(&aParam), aBox, aBaselineOffset, aUp, BitGdiToMWsGraphicsContextMappings::Convert(aVertical), aMargin);
|
sl@0
|
1721 |
}
|
sl@0
|
1722 |
|
sl@0
|
1723 |
void CCommandBuffer::DrawWsGraphic1L(const MWsGraphicResolver& aWsGraphicResolver)
|
sl@0
|
1724 |
{
|
sl@0
|
1725 |
TInt id;
|
sl@0
|
1726 |
TBool isUid;
|
sl@0
|
1727 |
TRect rect;
|
sl@0
|
1728 |
|
sl@0
|
1729 |
ReadL<TInt>(id);
|
sl@0
|
1730 |
ReadL<TBool>(isUid);
|
sl@0
|
1731 |
ReadL<TRect>(rect);
|
sl@0
|
1732 |
|
sl@0
|
1733 |
aWsGraphicResolver.DrawWsGraphic(id,isUid,rect,KNullDesC8());
|
sl@0
|
1734 |
}
|
sl@0
|
1735 |
|
sl@0
|
1736 |
void CCommandBuffer::DrawWsGraphic2L(const MWsGraphicResolver& aWsGraphicResolver)
|
sl@0
|
1737 |
{
|
sl@0
|
1738 |
TInt id;
|
sl@0
|
1739 |
TBool isUid;
|
sl@0
|
1740 |
TRect rect;
|
sl@0
|
1741 |
|
sl@0
|
1742 |
ReadL<TInt>(id);
|
sl@0
|
1743 |
ReadL<TBool>(isUid);
|
sl@0
|
1744 |
ReadL<TRect>(rect);
|
sl@0
|
1745 |
TPtrC8 text8;
|
sl@0
|
1746 |
ReadTextLC(text8);
|
sl@0
|
1747 |
|
sl@0
|
1748 |
aWsGraphicResolver.DrawWsGraphic(id,isUid,rect,text8);
|
sl@0
|
1749 |
CleanupStack::PopAndDestroy(); //ReadTextLC
|
sl@0
|
1750 |
}
|
sl@0
|
1751 |
|
sl@0
|
1752 |
template<typename ContextType> void CCommandBuffer::SetShadowColorL(ContextType& aGraphicsContext)
|
sl@0
|
1753 |
{
|
sl@0
|
1754 |
TRgb shadowColor;
|
sl@0
|
1755 |
ReadL<TRgb>(shadowColor);
|
sl@0
|
1756 |
|
sl@0
|
1757 |
DoSetShadowColorL(aGraphicsContext, shadowColor);
|
sl@0
|
1758 |
}
|
sl@0
|
1759 |
|
sl@0
|
1760 |
void CCommandBuffer::DoSetShadowColorL(CWindowGc& aWindowGc, TRgb aShadowColor)
|
sl@0
|
1761 |
{
|
sl@0
|
1762 |
aWindowGc.SetShadowColor(aShadowColor);
|
sl@0
|
1763 |
}
|
sl@0
|
1764 |
|
sl@0
|
1765 |
void CCommandBuffer::DoSetShadowColorL(MWsGraphicsContext& aGraphicsContext, TRgb aShadowColor)
|
sl@0
|
1766 |
{
|
sl@0
|
1767 |
aGraphicsContext.SetTextShadowColor(aShadowColor);
|
sl@0
|
1768 |
}
|
sl@0
|
1769 |
|
sl@0
|
1770 |
/**
|
sl@0
|
1771 |
Helper function to draw resource at specified position. The function extracts all required parameter from the stream.
|
sl@0
|
1772 |
*/
|
sl@0
|
1773 |
template<typename ContextType> void CCommandBuffer::DrawResourceToPosL(ContextType& aGraphicsContext)
|
sl@0
|
1774 |
{
|
sl@0
|
1775 |
TSgDrawableId drawableId;
|
sl@0
|
1776 |
TInt screenNumber;
|
sl@0
|
1777 |
TPoint pos;
|
sl@0
|
1778 |
CWindowGc::TGraphicsRotation rotation;
|
sl@0
|
1779 |
ReadL<TSgDrawableId>(drawableId);
|
sl@0
|
1780 |
ReadL<TInt>(screenNumber);
|
sl@0
|
1781 |
ReadL<TPoint>(pos);
|
sl@0
|
1782 |
ReadL<CWindowGc::TGraphicsRotation>(rotation);
|
sl@0
|
1783 |
if (iDrawableCache->UseL(drawableId, screenNumber) == KErrNone)
|
sl@0
|
1784 |
{
|
sl@0
|
1785 |
DoDrawResourceToPos(aGraphicsContext, iDrawableCache->Resolve(drawableId, screenNumber), pos, rotation);
|
sl@0
|
1786 |
}
|
sl@0
|
1787 |
}
|
sl@0
|
1788 |
|
sl@0
|
1789 |
void CCommandBuffer::DoDrawResourceToPos(CWindowGc& aGraphicsContext, const TAny* aDrawableSource, const TPoint& aPos, CWindowGc::TGraphicsRotation aRotation)
|
sl@0
|
1790 |
{
|
sl@0
|
1791 |
MWsDrawResource* drawResource = static_cast<MWsDrawResource*>(aGraphicsContext.Interface(KMWsDrawResourceInterfaceUid));
|
sl@0
|
1792 |
if(drawResource)
|
sl@0
|
1793 |
{
|
sl@0
|
1794 |
drawResource->DrawResource(aPos, *static_cast<const RWsDrawableSource*>(aDrawableSource), aRotation);
|
sl@0
|
1795 |
}
|
sl@0
|
1796 |
}
|
sl@0
|
1797 |
|
sl@0
|
1798 |
void CCommandBuffer::DoDrawResourceToPos(MWsGraphicsContext& aGraphicsContext, const TAny* aDrawableSource, const TPoint& aPos, CWindowGc::TGraphicsRotation aRotation)
|
sl@0
|
1799 |
{
|
sl@0
|
1800 |
MWsDrawableSourceProvider* drawResource = aGraphicsContext.ObjectInterface<MWsDrawableSourceProvider>();
|
sl@0
|
1801 |
if (drawResource)
|
sl@0
|
1802 |
{
|
sl@0
|
1803 |
drawResource->DrawResource(aDrawableSource, aPos, aRotation);
|
sl@0
|
1804 |
}
|
sl@0
|
1805 |
}
|
sl@0
|
1806 |
|
sl@0
|
1807 |
/**
|
sl@0
|
1808 |
Helper function to draw resource into specified rectangle. The function extracts all required parameter from the stream.
|
sl@0
|
1809 |
*/
|
sl@0
|
1810 |
template<typename ContextType> void CCommandBuffer::DrawResourceToRectL(ContextType& aGraphicsContext)
|
sl@0
|
1811 |
{
|
sl@0
|
1812 |
TSgDrawableId drawableId;
|
sl@0
|
1813 |
TInt screenNumber;
|
sl@0
|
1814 |
TRect rect;
|
sl@0
|
1815 |
CWindowGc::TGraphicsRotation rotation;
|
sl@0
|
1816 |
ReadL<TSgDrawableId>(drawableId);
|
sl@0
|
1817 |
ReadL<TInt>(screenNumber);
|
sl@0
|
1818 |
ReadL<TRect>(rect);
|
sl@0
|
1819 |
ReadL<CWindowGc::TGraphicsRotation>(rotation);
|
sl@0
|
1820 |
|
sl@0
|
1821 |
if (iDrawableCache->UseL(drawableId, screenNumber) == KErrNone)
|
sl@0
|
1822 |
{
|
sl@0
|
1823 |
DoDrawResourceToRect(aGraphicsContext, iDrawableCache->Resolve(drawableId, screenNumber), rect, rotation);
|
sl@0
|
1824 |
}
|
sl@0
|
1825 |
}
|
sl@0
|
1826 |
|
sl@0
|
1827 |
void CCommandBuffer::DoDrawResourceToRect(CWindowGc& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRect, CWindowGc::TGraphicsRotation aRotation)
|
sl@0
|
1828 |
{
|
sl@0
|
1829 |
MWsDrawResource* drawResource = static_cast<MWsDrawResource*>(aGraphicsContext.Interface(KMWsDrawResourceInterfaceUid));
|
sl@0
|
1830 |
if(drawResource)
|
sl@0
|
1831 |
{
|
sl@0
|
1832 |
drawResource->DrawResource(aRect, *static_cast<const RWsDrawableSource*>(aDrawableSource), aRotation);
|
sl@0
|
1833 |
}
|
sl@0
|
1834 |
}
|
sl@0
|
1835 |
|
sl@0
|
1836 |
void CCommandBuffer::DoDrawResourceToRect(MWsGraphicsContext& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRect, CWindowGc::TGraphicsRotation aRotation)
|
sl@0
|
1837 |
{
|
sl@0
|
1838 |
MWsDrawableSourceProvider* drawResource = aGraphicsContext.ObjectInterface<MWsDrawableSourceProvider>();
|
sl@0
|
1839 |
if (drawResource)
|
sl@0
|
1840 |
{
|
sl@0
|
1841 |
drawResource->DrawResource(aDrawableSource, aRect, aRotation);
|
sl@0
|
1842 |
}
|
sl@0
|
1843 |
}
|
sl@0
|
1844 |
|
sl@0
|
1845 |
/**
|
sl@0
|
1846 |
Helper function to draw resource into specified rectangle from specified rectangle of the drawable. The function extracts all required parameter from the stream.
|
sl@0
|
1847 |
*/
|
sl@0
|
1848 |
template<typename ContextType> void CCommandBuffer::DrawResourceFromRectToRectL(ContextType& aGraphicsContext)
|
sl@0
|
1849 |
{
|
sl@0
|
1850 |
TSgDrawableId drawableId;
|
sl@0
|
1851 |
TInt screenNumber;
|
sl@0
|
1852 |
TRect rectDest;
|
sl@0
|
1853 |
TRect rectSrc;
|
sl@0
|
1854 |
CWindowGc::TGraphicsRotation rotation;
|
sl@0
|
1855 |
ReadL<TSgDrawableId>(drawableId);
|
sl@0
|
1856 |
ReadL<TInt>(screenNumber);
|
sl@0
|
1857 |
ReadL<TRect>(rectDest);
|
sl@0
|
1858 |
ReadL<TRect>(rectSrc);
|
sl@0
|
1859 |
ReadL<CWindowGc::TGraphicsRotation>(rotation);
|
sl@0
|
1860 |
|
sl@0
|
1861 |
if (iDrawableCache->UseL(drawableId, screenNumber) == KErrNone)
|
sl@0
|
1862 |
{
|
sl@0
|
1863 |
DoDrawResourceFromRectToRect(aGraphicsContext, iDrawableCache->Resolve(drawableId, screenNumber), rectDest, rectSrc, rotation);
|
sl@0
|
1864 |
}
|
sl@0
|
1865 |
}
|
sl@0
|
1866 |
|
sl@0
|
1867 |
void CCommandBuffer::DoDrawResourceFromRectToRect(CWindowGc& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRectDest, const TRect& aRectSrc, CWindowGc::TGraphicsRotation aRotation)
|
sl@0
|
1868 |
{
|
sl@0
|
1869 |
MWsDrawResource* drawResource = static_cast<MWsDrawResource*>(aGraphicsContext.Interface(KMWsDrawResourceInterfaceUid));
|
sl@0
|
1870 |
if(drawResource)
|
sl@0
|
1871 |
{
|
sl@0
|
1872 |
drawResource->DrawResource(aRectDest, *static_cast<const RWsDrawableSource*>(aDrawableSource), aRectSrc, aRotation);
|
sl@0
|
1873 |
}
|
sl@0
|
1874 |
}
|
sl@0
|
1875 |
|
sl@0
|
1876 |
void CCommandBuffer::DoDrawResourceFromRectToRect(MWsGraphicsContext& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRectDest, const TRect& aRectSrc, CWindowGc::TGraphicsRotation aRotation)
|
sl@0
|
1877 |
{
|
sl@0
|
1878 |
MWsDrawableSourceProvider* drawResource = aGraphicsContext.ObjectInterface<MWsDrawableSourceProvider>();
|
sl@0
|
1879 |
if (drawResource)
|
sl@0
|
1880 |
{
|
sl@0
|
1881 |
drawResource->DrawResource(aDrawableSource, aRectDest, aRectSrc, aRotation);
|
sl@0
|
1882 |
}
|
sl@0
|
1883 |
}
|
sl@0
|
1884 |
|
sl@0
|
1885 |
template<typename ContextType> void CCommandBuffer::DrawResourceWithDataL(ContextType& aGraphicsContext)
|
sl@0
|
1886 |
{
|
sl@0
|
1887 |
TSgDrawableId drawableId;
|
sl@0
|
1888 |
TInt screenNumber;
|
sl@0
|
1889 |
TRect rect;
|
sl@0
|
1890 |
TPtrC8 data;
|
sl@0
|
1891 |
ReadL<TSgDrawableId>(drawableId);
|
sl@0
|
1892 |
ReadL<TInt>(screenNumber);
|
sl@0
|
1893 |
ReadL<TRect>(rect);
|
sl@0
|
1894 |
ReadTextLC(data);
|
sl@0
|
1895 |
|
sl@0
|
1896 |
if (iDrawableCache->UseL(drawableId, screenNumber) == KErrNone)
|
sl@0
|
1897 |
{
|
sl@0
|
1898 |
DoDrawResourceWithData(aGraphicsContext, iDrawableCache->Resolve(drawableId, screenNumber), rect, data);
|
sl@0
|
1899 |
}
|
sl@0
|
1900 |
|
sl@0
|
1901 |
CleanupStack::PopAndDestroy(); //ReadTextLC
|
sl@0
|
1902 |
}
|
sl@0
|
1903 |
|
sl@0
|
1904 |
void CCommandBuffer::DoDrawResourceWithData(CWindowGc& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRect, const TDesC8& aParam)
|
sl@0
|
1905 |
{
|
sl@0
|
1906 |
MWsDrawResource* drawResource = static_cast<MWsDrawResource*>(aGraphicsContext.Interface(KMWsDrawResourceInterfaceUid));
|
sl@0
|
1907 |
if(drawResource)
|
sl@0
|
1908 |
{
|
sl@0
|
1909 |
drawResource->DrawResource(aRect, *static_cast<const RWsDrawableSource*>(aDrawableSource), aParam);
|
sl@0
|
1910 |
}
|
sl@0
|
1911 |
}
|
sl@0
|
1912 |
|
sl@0
|
1913 |
void CCommandBuffer::DoDrawResourceWithData(MWsGraphicsContext& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRect, const TDesC8& aParam)
|
sl@0
|
1914 |
{
|
sl@0
|
1915 |
MWsDrawableSourceProvider* drawResource = aGraphicsContext.ObjectInterface<MWsDrawableSourceProvider>();
|
sl@0
|
1916 |
if (drawResource)
|
sl@0
|
1917 |
{
|
sl@0
|
1918 |
drawResource->DrawResource(aDrawableSource, aRect, aParam);
|
sl@0
|
1919 |
}
|
sl@0
|
1920 |
}
|