|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CPseodoVGRendererImpl source file |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "PseodoVGRendererImpl.h" |
|
19 #include "PseudoVGSurfaceImpl.h" |
|
20 #include <f32file.h> |
|
21 #include <s32mem.h> |
|
22 #include <VG/vgu.h> |
|
23 const TUint CPseodoVGRendererImpl::ENCODEDDATALENGTH = 1024; |
|
24 const TUint CPseodoVGRendererImpl::ENCODEDDATAGRANULARITY = 64; |
|
25 const TUint CPseodoVGRendererImpl::KMAJOR_VERSION = 1; |
|
26 const TUint CPseodoVGRendererImpl::KMINOR_VERSION = 0; |
|
27 const TUint CPseodoVGRendererImpl::KBUILD_VERSION = 1; |
|
28 |
|
29 EXPORT_C MVGRendererImpl* CreateVGRendererImplL() |
|
30 { |
|
31 return CPseodoVGRendererImpl::NewL(); |
|
32 } |
|
33 |
|
34 CPseodoVGRendererImpl::CPseodoVGRendererImpl() |
|
35 { |
|
36 iPaintHandleCount = 0; |
|
37 iPathHandleCount = 0; |
|
38 iEncodedData = 0; |
|
39 iHandle = 1; |
|
40 iCommonHeaderLength = 0; |
|
41 iCommonHeader = 0; |
|
42 iVgErrorCode = VG_NO_ERROR; |
|
43 } |
|
44 |
|
45 CPseodoVGRendererImpl::~CPseodoVGRendererImpl() |
|
46 { |
|
47 delete iEncodedData; |
|
48 } |
|
49 |
|
50 CPseodoVGRendererImpl* CPseodoVGRendererImpl::NewLC() |
|
51 { |
|
52 CPseodoVGRendererImpl* self = new (ELeave)CPseodoVGRendererImpl(); |
|
53 CleanupStack::PushL(self); |
|
54 self->ConstructL(); |
|
55 return self; |
|
56 } |
|
57 |
|
58 CPseodoVGRendererImpl* CPseodoVGRendererImpl::NewL() |
|
59 { |
|
60 CPseodoVGRendererImpl* self=CPseodoVGRendererImpl::NewLC(); |
|
61 CleanupStack::Pop(); |
|
62 return self; |
|
63 } |
|
64 |
|
65 inline void CPseodoVGRendererImpl::ConstructL() |
|
66 { |
|
67 iEncodedData = HBufC8::NewL(CPseodoVGRendererImpl::ENCODEDDATALENGTH); |
|
68 WriteHeader(); |
|
69 } |
|
70 |
|
71 TVersion CPseodoVGRendererImpl::GetVersion() const |
|
72 { |
|
73 return TVersion(KMAJOR_VERSION, KMINOR_VERSION, KBUILD_VERSION); |
|
74 } |
|
75 |
|
76 const TDesC CPseodoVGRendererImpl::GetName() const |
|
77 { |
|
78 _LIT(KPseudoVGRenderer, "TLVVGRenderer"); |
|
79 return KPseudoVGRenderer; |
|
80 } |
|
81 |
|
82 void CPseodoVGRendererImpl::WriteHeader() |
|
83 { |
|
84 TUint8 EmptyHeader[KIconHeaderLength]; |
|
85 if(iCommonHeader) |
|
86 { |
|
87 EncodeData(iCommonHeader, KIconHeaderLength); |
|
88 } |
|
89 else |
|
90 { |
|
91 EncodeData(EmptyHeader, KIconHeaderLength); |
|
92 } |
|
93 |
|
94 const TInt8 * KNVGFileIdentifier = (const TInt8*)"nvg"; |
|
95 |
|
96 EncodeData(KNVGFileIdentifier, 3); |
|
97 EncodeInt8(KNVGFileVersion); |
|
98 EncodeInt16(KNVGHeaderSize); |
|
99 EncodeInt16(KNVGReserved1); |
|
100 |
|
101 // Rest of the headers are not used in TLV format |
|
102 const TInt8 KUnusedHeaderLength = 0x2C; |
|
103 |
|
104 for (TInt i = 0; i < KUnusedHeaderLength; ++i) |
|
105 { |
|
106 EncodeInt8(0); |
|
107 } |
|
108 } |
|
109 |
|
110 void CPseodoVGRendererImpl::vgClear(TInt x, TInt y, TInt width, TInt height) |
|
111 { |
|
112 EncodeInt8(EvgClear); |
|
113 EncodeReal32(x); |
|
114 EncodeReal32(y); |
|
115 EncodeReal32(width); |
|
116 EncodeReal32(height); |
|
117 #ifdef VGRENDERER_LOG |
|
118 iLog.WriteFormat(_L("vgClear")); |
|
119 #endif |
|
120 } |
|
121 |
|
122 void CPseodoVGRendererImpl::vgSeti(TInt type, TInt value) |
|
123 { |
|
124 EncodeInt8(EvgSeti); |
|
125 EncodeInt16(type); |
|
126 EncodeInt16(value); |
|
127 #ifdef VGRENDERER_LOG |
|
128 LogvgSeti((VGParamType)type,value,0); |
|
129 #endif |
|
130 } |
|
131 TInt CPseodoVGRendererImpl::vgGeti(TInt type) |
|
132 { |
|
133 |
|
134 #ifdef VGRENDERER_LOG |
|
135 iLog.WriteFormat(_L("vgGeti")); |
|
136 #endif |
|
137 switch( type ) |
|
138 { |
|
139 case VG_IMAGE_MODE: |
|
140 return (VGint)VG_DRAW_IMAGE_MULTIPLY; |
|
141 case VG_BLEND_MODE: |
|
142 return (VGint)VG_BLEND_SRC_OVER; |
|
143 case VG_FILTER_CHANNEL_MASK: |
|
144 return (VGint)0; |
|
145 default: |
|
146 return 0; |
|
147 } |
|
148 } |
|
149 |
|
150 void CPseodoVGRendererImpl::vgSetf (TInt type, TReal32 value) |
|
151 { |
|
152 EncodeInt8(EvgSetf); |
|
153 EncodeInt16(type); |
|
154 EncodeReal32(value); |
|
155 #ifdef VGRENDERER_LOG |
|
156 LogvgSetf((VGParamType)type,value,0); |
|
157 #endif |
|
158 } |
|
159 |
|
160 void CPseodoVGRendererImpl::vgSetfv(TInt type, TInt count, const TReal32 * values) |
|
161 { |
|
162 EncodeInt8(EvgSetfv); |
|
163 EncodeInt16(type); |
|
164 EncodeInt16(count); |
|
165 EncodeData(values, count * sizeof(TReal32)); |
|
166 #ifdef VGRENDERER_LOG |
|
167 iLog.WriteFormat(_L("vgSetfv")); |
|
168 #endif |
|
169 } |
|
170 void CPseodoVGRendererImpl::vgSetiv(TInt type, TInt count, const TInt * values) |
|
171 { |
|
172 EncodeInt8(EvgSetiv); |
|
173 EncodeInt16(type); |
|
174 EncodeInt16(count); |
|
175 EncodeData(values, count * sizeof(TInt)); |
|
176 #ifdef VGRENDERER_LOG |
|
177 iLog.WriteFormat(_L("vgSetiv")); |
|
178 #endif |
|
179 } |
|
180 void CPseodoVGRendererImpl::vgSetParameteri(TUint handle, TInt paramType, TInt value) |
|
181 { |
|
182 EncodeInt8(EvgSetParameteri); |
|
183 EncodeInt32(handle); |
|
184 EncodeInt16(paramType); |
|
185 EncodeInt16(value); |
|
186 #ifdef VGRENDERER_LOG |
|
187 LogvgSetParameteri(handle,paramType,value,0,handle); |
|
188 #endif |
|
189 } |
|
190 |
|
191 void CPseodoVGRendererImpl::vgSetParameterf(TUint handle,TInt paramType,TReal32 value) |
|
192 { |
|
193 EncodeInt8(EvgSetParameterf); |
|
194 EncodeInt32(handle); |
|
195 EncodeInt16(paramType); |
|
196 EncodeReal32(value); |
|
197 #ifdef VGRENDERER_LOG |
|
198 iLog.WriteFormat(_L("vgSetParameterf")); |
|
199 #endif |
|
200 } |
|
201 |
|
202 void CPseodoVGRendererImpl::vgSetParameterfv(TUint handle,TInt paramType,TInt count, const TReal32 * values) |
|
203 { |
|
204 EncodeInt8(EvgSetParameterfv); |
|
205 EncodeInt32(handle); |
|
206 EncodeInt16(paramType); |
|
207 EncodeInt32(count); |
|
208 EncodeData(values, count * sizeof(TReal32)); |
|
209 #ifdef VGRENDERER_LOG |
|
210 iLog.WriteFormat(_L("vgSetParameterfv")); |
|
211 #endif |
|
212 } |
|
213 |
|
214 void CPseodoVGRendererImpl::vgSetColor(TUint paint, TUint rgba) |
|
215 { |
|
216 EncodeInt8(EvgSetColor); |
|
217 EncodeInt32(paint); |
|
218 EncodeInt32(rgba); |
|
219 #ifdef VGRENDERER_LOG |
|
220 iLog.WriteFormat(_L("vgSetColor")); |
|
221 #endif |
|
222 } |
|
223 |
|
224 void CPseodoVGRendererImpl::vgSetPaint(TUint paint, TUint paintModes) |
|
225 { |
|
226 EncodeInt8(EvgSetPaint); |
|
227 EncodeInt32(paint); |
|
228 EncodeInt8(paintModes); |
|
229 #ifdef VGRENDERER_LOG |
|
230 LogvgSetPaint(paint,paintModes,0,paint); |
|
231 #endif |
|
232 } |
|
233 |
|
234 TUint CPseodoVGRendererImpl::vgCreatePaint() |
|
235 { |
|
236 if(iVgErrorCode != VG_NO_ERROR) |
|
237 return VG_INVALID_HANDLE; |
|
238 |
|
239 iHandle++; |
|
240 EncodeInt8(EvgCreatePaint); |
|
241 EncodeInt32(iHandle); |
|
242 #ifdef VGRENDERER_LOG |
|
243 iLog.WriteFormat(_L("vgCreatePaint")); |
|
244 #endif |
|
245 return iHandle; |
|
246 } |
|
247 |
|
248 TUint CPseodoVGRendererImpl::vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias, |
|
249 TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities) |
|
250 { |
|
251 if(iVgErrorCode != VG_NO_ERROR) |
|
252 return VG_INVALID_HANDLE; |
|
253 |
|
254 |
|
255 iHandle++; |
|
256 EncodeInt8(EvgCreatePath); |
|
257 EncodeInt32(pathFormat); |
|
258 EncodeInt8(datatype); |
|
259 EncodeReal32(scale); |
|
260 EncodeReal32(bias); |
|
261 EncodeInt32(segmentCapacityHint); |
|
262 EncodeInt32(coordCapacityHint); |
|
263 EncodeInt32(capabilities); |
|
264 EncodeInt32(iHandle); |
|
265 #ifdef VGRENDERER_LOG |
|
266 iLog.WriteFormat(_L("vgCreatePath")); |
|
267 #endif |
|
268 return iHandle; |
|
269 } |
|
270 |
|
271 void CPseodoVGRendererImpl::vgLoadMatrix(const TReal32 * m) |
|
272 { |
|
273 EncodeInt8(EvgLoadMatrix); |
|
274 EncodeData(m, 9 * sizeof(TReal32)); |
|
275 #ifdef VGRENDERER_LOG |
|
276 iLog.WriteFormat(_L("vgLoadMatrix")); |
|
277 #endif |
|
278 } |
|
279 |
|
280 void CPseodoVGRendererImpl::vgMultMatrix(const TReal32 * m) |
|
281 { |
|
282 EncodeInt8(EvgMultMatrix); |
|
283 EncodeData(m, 9 * sizeof(TReal32)); |
|
284 #ifdef VGRENDERER_LOG |
|
285 iLog.WriteFormat(_L("vgMultMatrix")); |
|
286 #endif |
|
287 } |
|
288 |
|
289 void CPseodoVGRendererImpl::vgLoadIdentity() |
|
290 { |
|
291 EncodeInt8(EvgLoadIdentity); |
|
292 #ifdef VGRENDERER_LOG |
|
293 iLog.WriteFormat(_L("vgLoadIdentity")); |
|
294 #endif |
|
295 } |
|
296 |
|
297 void CPseodoVGRendererImpl::vgScale(TReal32 sx, TReal32 sy) |
|
298 { |
|
299 EncodeInt8(EvgScale); |
|
300 EncodeReal32(sx); |
|
301 EncodeReal32(sy); |
|
302 #ifdef VGRENDERER_LOG |
|
303 iLog.WriteFormat(_L("vgScale")); |
|
304 #endif |
|
305 } |
|
306 |
|
307 void CPseodoVGRendererImpl::vgTranslate(TReal32 tx, TReal32 ty) |
|
308 { |
|
309 EncodeInt8(EvgTranslate); |
|
310 EncodeReal32(tx); |
|
311 EncodeReal32(ty); |
|
312 #ifdef VGRENDERER_LOG |
|
313 iLog.WriteFormat(_L("vgTranslate")); |
|
314 #endif |
|
315 } |
|
316 |
|
317 void CPseodoVGRendererImpl::vgRotate(TReal32 angle) |
|
318 { |
|
319 EncodeInt8(EvgRotate); |
|
320 EncodeReal32(angle); |
|
321 #ifdef VGRENDERER_LOG |
|
322 iLog.WriteFormat(_L("vgRotate")); |
|
323 #endif |
|
324 } |
|
325 |
|
326 void CPseodoVGRendererImpl::vgReadPixels(void * /*data*/, TInt /*dataStride*/, TInt /*dataFormat*/, TInt /*sx*/, TInt /*sy*/, TInt /*width*/, TInt /*height*/) |
|
327 { |
|
328 //TODO |
|
329 return; |
|
330 } |
|
331 |
|
332 void CPseodoVGRendererImpl::vgWritePixels(const void * /*data*/, TInt /*dataStride*/, TInt /*dataFormat*/, |
|
333 TInt /*dx*/, TInt /*dy*/, TInt /*width*/, TInt /*height*/) |
|
334 { |
|
335 //TODO |
|
336 return; |
|
337 } |
|
338 |
|
339 void CPseodoVGRendererImpl::vgAppendPathData(TUint path,TInt numSegments, |
|
340 const TUint8 * pathSegments, |
|
341 const void * pathData) |
|
342 { |
|
343 EncodeInt8(EvgAppendPathData); |
|
344 EncodeInt32(path); |
|
345 EncodeInt16(numSegments); |
|
346 EncodeData(pathSegments, numSegments); |
|
347 |
|
348 TInt coordinateCount = 0; |
|
349 for (TInt i = 0; i < numSegments; ++i) |
|
350 { |
|
351 switch (pathSegments[i]) |
|
352 { |
|
353 case VG_HLINE_TO: |
|
354 case VG_VLINE_TO: |
|
355 coordinateCount += 1; |
|
356 break; |
|
357 case VG_MOVE_TO: |
|
358 case VG_LINE_TO: |
|
359 case VG_SQUAD_TO: |
|
360 coordinateCount += 2; |
|
361 break; |
|
362 case VG_QUAD_TO: |
|
363 case VG_SCUBIC_TO: |
|
364 coordinateCount += 4; |
|
365 break; |
|
366 case VG_SCCWARC_TO: |
|
367 case VG_SCWARC_TO: |
|
368 case VG_LCCWARC_TO: |
|
369 case VG_LCWARC_TO: |
|
370 coordinateCount += 5; |
|
371 break; |
|
372 case VG_CUBIC_TO: |
|
373 coordinateCount += 6; |
|
374 break; |
|
375 default: |
|
376 break; |
|
377 } |
|
378 } |
|
379 EncodeInt16(coordinateCount); |
|
380 EncodeData(pathData, coordinateCount * GetPathCoordianteSize(path)); |
|
381 #ifdef VGRENDERER_LOG |
|
382 iLog.WriteFormat(_L("vgAppendPathData")); |
|
383 #endif |
|
384 } |
|
385 |
|
386 void CPseodoVGRendererImpl::vgDrawPath(TUint path, TUint capabilities) |
|
387 |
|
388 { |
|
389 EncodeInt8(EvgDrawPath); |
|
390 EncodeInt32(path); |
|
391 EncodeInt16(capabilities); |
|
392 |
|
393 #ifdef VGRENDERER_LOG |
|
394 LogvgDrawPath(path,0); |
|
395 #endif |
|
396 |
|
397 } |
|
398 |
|
399 void CPseodoVGRendererImpl::vgClearPath(TUint path, TUint capabilities) |
|
400 { |
|
401 EncodeInt8(EvgClearPath); |
|
402 EncodeInt32(path); |
|
403 EncodeInt16(capabilities); |
|
404 } |
|
405 |
|
406 TInt CPseodoVGRendererImpl::vguRect(TUint path, |
|
407 TReal32 x, TReal32 y, |
|
408 TReal32 width, TReal32 height) |
|
409 { |
|
410 EncodeInt8(EvguRect); |
|
411 EncodeInt32(path); |
|
412 EncodeReal32(x); |
|
413 EncodeReal32(y); |
|
414 EncodeReal32(width); |
|
415 EncodeReal32(height); |
|
416 #ifdef VGRENDERER_LOG |
|
417 iLog.WriteFormat(_L("vguRect")); |
|
418 #endif |
|
419 return KErrNone; |
|
420 } |
|
421 |
|
422 TInt CPseodoVGRendererImpl::vguEllipse(TUint path, |
|
423 TReal32 cx, TReal32 cy, |
|
424 TReal32 width, TReal32 height) |
|
425 { |
|
426 EncodeInt8(EvguEllipse); |
|
427 EncodeInt32(path); |
|
428 EncodeReal32(cx); |
|
429 EncodeReal32(cy); |
|
430 EncodeReal32(width); |
|
431 EncodeReal32(height); |
|
432 #ifdef VGRENDERER_LOG |
|
433 iLog.WriteFormat(_L("vguEllipse")); |
|
434 #endif |
|
435 return KErrNone; |
|
436 } |
|
437 |
|
438 TInt CPseodoVGRendererImpl::vguRoundRect(TUint path, TReal32 x, TReal32 y, |
|
439 TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight) |
|
440 { |
|
441 EncodeInt8(EvguRoundRect); |
|
442 EncodeInt32(path); |
|
443 EncodeReal32(x); |
|
444 EncodeReal32(y); |
|
445 EncodeReal32(width); |
|
446 EncodeReal32(height); |
|
447 EncodeReal32(arcWidth); |
|
448 EncodeReal32(arcHeight); |
|
449 #ifdef VGRENDERER_LOG |
|
450 iLog.WriteFormat(_L("vguRoundRect")); |
|
451 #endif |
|
452 return KErrNone; |
|
453 } |
|
454 |
|
455 TInt CPseodoVGRendererImpl::vguLine(TUint path,TReal32 x0, TReal32 y0,TReal32 x1, TReal32 y1) |
|
456 { |
|
457 EncodeInt8(EvguLine); |
|
458 EncodeInt32(path); |
|
459 EncodeReal32(x0); |
|
460 EncodeReal32(y0); |
|
461 EncodeReal32(x1); |
|
462 EncodeReal32(y1); |
|
463 #ifdef VGRENDERER_LOG |
|
464 iLog.WriteFormat(_L("vguLine")); |
|
465 #endif |
|
466 return KErrNone; |
|
467 } |
|
468 |
|
469 TUint CPseodoVGRendererImpl::vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality) |
|
470 { |
|
471 if(iVgErrorCode != VG_NO_ERROR) |
|
472 return VG_INVALID_HANDLE; |
|
473 |
|
474 iHandle++; |
|
475 EncodeInt8(EvgCreateImage); |
|
476 EncodeInt32(format); |
|
477 EncodeInt32(width); |
|
478 EncodeInt32(height); |
|
479 EncodeInt8(allowedQuality); |
|
480 EncodeInt32(iHandle); |
|
481 #ifdef VGRENDERER_LOG |
|
482 iLog.WriteFormat(_L("vgcreateimage")); |
|
483 #endif |
|
484 return iHandle; |
|
485 } |
|
486 |
|
487 void CPseodoVGRendererImpl::vgGetPixels(TUint /*dst*/, TInt /*dx*/, TInt /*dy*/, TInt /*sx*/, TInt /*sy*/, TInt /*width*/, TInt /*height*/) |
|
488 { |
|
489 //TODO: not used in SVGEngine |
|
490 } |
|
491 |
|
492 void CPseodoVGRendererImpl::vgDrawImage(TUint image) |
|
493 { |
|
494 EncodeInt8(EvgDrawImage); |
|
495 EncodeInt32(image); |
|
496 #ifdef VGRENDERER_LOG |
|
497 iLog.WriteFormat(_L("vgdrawimage")); |
|
498 #endif |
|
499 } |
|
500 |
|
501 void CPseodoVGRendererImpl::vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height) |
|
502 { |
|
503 EncodeInt8(EvgClearImage); |
|
504 EncodeInt32(image); |
|
505 EncodeInt32(x); |
|
506 EncodeInt32(y); |
|
507 EncodeInt32(width); |
|
508 EncodeInt32(height); |
|
509 #ifdef VGRENDERER_LOG |
|
510 iLog.WriteFormat(_L("vgclearimage")); |
|
511 #endif |
|
512 } |
|
513 |
|
514 void CPseodoVGRendererImpl::vgImageSubData(TUint image, const void * data, TInt dataStride, |
|
515 TInt dataFormat, TInt x, TInt y, TInt width, TInt height) |
|
516 { |
|
517 EncodeInt8(EvgImageSubData); |
|
518 EncodeInt32(image); |
|
519 EncodeInt32(dataStride); |
|
520 EncodeInt32(dataFormat); |
|
521 EncodeInt32(x); |
|
522 EncodeInt32(y); |
|
523 EncodeInt32(width); |
|
524 EncodeInt32(height); |
|
525 |
|
526 // append the actual data |
|
527 struct |
|
528 { |
|
529 |
|
530 VGImageFormat format; |
|
531 VGuint depth; |
|
532 VGuint bytePerPixels; |
|
533 VGuint redBits; |
|
534 VGuint greenBits; |
|
535 VGuint blueBits; |
|
536 VGuint alphaBits; |
|
537 } const static vgiSurfaceFormatDesc[] = |
|
538 |
|
539 { |
|
540 { VG_sRGBX_8888, 32, 32/8, 8, 8, 8, 0 }, |
|
541 { VG_sRGBA_8888, 32, 32/8, 8, 8, 8, 8 }, |
|
542 { VG_sRGBA_8888_PRE, 32, 32/8, 8, 8, 8, 8 }, |
|
543 { VG_sRGB_565, 16, 16/8, 5, 6, 5, 0 }, |
|
544 { VG_sRGBA_5551, 16, 16/8, 5, 5, 5, 1 }, |
|
545 { VG_sRGBA_4444, 16, 16/8, 4, 4, 4, 4 }, |
|
546 { VG_sL_8, 8, 8/8, 8, 0, 0, 0 }, |
|
547 { VG_lRGBX_8888, 32, 32/8, 8, 8, 8, 0 }, |
|
548 { VG_lRGBA_8888, 32, 32/8, 8, 8, 8, 8 }, |
|
549 { VG_lRGBA_8888_PRE, 32, 32/8, 8, 8, 8, 8 }, |
|
550 { VG_lL_8, 8, 8/8, 8, 0, 0, 0 }, |
|
551 { VG_A_8, 8, 8/8, 0, 0, 0, 8 }, |
|
552 { VG_BW_1, 8, 8/8, 8, 0, 0, 0 }, |
|
553 |
|
554 { VG_sXRGB_8888, 32, 32/8, 8, 8, 8, 0 }, |
|
555 { VG_sARGB_8888, 32, 32/8, 8, 8, 8, 8 }, |
|
556 { VG_sARGB_8888_PRE, 32, 32/8, 8, 8, 8, 8 }, |
|
557 { VG_sARGB_1555, 16, 16/8, 5, 5, 5, 1 }, |
|
558 { VG_sARGB_4444, 16, 16/8, 4, 4, 4, 4 }, |
|
559 { VG_lXRGB_8888, 32, 32/8, 8, 8, 8, 0 }, |
|
560 { VG_lARGB_8888, 32, 32/8, 8, 8, 8, 8 }, |
|
561 { VG_lARGB_8888_PRE, 32, 32/8, 8, 8, 8, 8 }, |
|
562 |
|
563 { VG_sBGRX_8888, 32, 32/8, 8, 8, 8, 0 }, |
|
564 { VG_sBGRA_8888, 32, 32/8, 8, 8, 8, 8 }, |
|
565 { VG_sBGRA_8888_PRE, 32, 32/8, 8, 8, 8, 8 }, |
|
566 { VG_sBGR_565, 16, 16/8, 5, 6, 5, 0 }, |
|
567 { VG_sBGRA_5551, 16, 16/8, 5, 5, 5, 1 }, |
|
568 { VG_sBGRA_4444, 16, 16/8, 4, 4, 4, 4 }, |
|
569 { VG_lBGRX_8888, 32, 32/8, 8, 8, 8, 0 }, |
|
570 { VG_lBGRA_8888, 32, 32/8, 8, 8, 8, 8 }, |
|
571 { VG_lBGRA_8888_PRE, 32, 32/8, 8, 8, 8, 8 }, |
|
572 |
|
573 { VG_sXBGR_8888, 32, 32/8, 8, 8, 8, 0 }, |
|
574 { VG_sABGR_8888, 32, 32/8, 8, 8, 8, 8 }, |
|
575 { VG_sABGR_8888_PRE, 32, 32/8, 8, 8, 8, 8 }, |
|
576 { VG_sABGR_1555, 16, 16/8, 5, 5, 5, 1 }, |
|
577 |
|
578 { VG_sABGR_4444, 16, 16/8, 4, 4, 4, 4 }, |
|
579 { VG_lXBGR_8888, 32, 32/8, 8, 8, 8, 0 }, |
|
580 { VG_lABGR_8888, 32, 32/8, 8, 8, 8, 8 }, |
|
581 { VG_lABGR_8888_PRE, 32, 32/8, 8, 8, 8, 8 } |
|
582 }; |
|
583 |
|
584 TInt bytePerPixels = 0; |
|
585 |
|
586 for (TInt i = 0; i < sizeof(vgiSurfaceFormatDesc)/sizeof(vgiSurfaceFormatDesc[0]); ++i) |
|
587 { |
|
588 if (dataFormat == vgiSurfaceFormatDesc[i].format) |
|
589 { |
|
590 bytePerPixels = vgiSurfaceFormatDesc[i].bytePerPixels; |
|
591 break; |
|
592 } |
|
593 } |
|
594 |
|
595 TUint dataLength; |
|
596 |
|
597 if (dataStride < 0) |
|
598 { |
|
599 dataLength = -dataStride * height; |
|
600 } |
|
601 else |
|
602 { |
|
603 dataLength = dataStride * height; |
|
604 } |
|
605 |
|
606 TInt M = width * bytePerPixels; |
|
607 TInt imageSize = M * height; |
|
608 |
|
609 if (imageSize > dataLength) |
|
610 { |
|
611 dataLength = imageSize; |
|
612 } |
|
613 |
|
614 if (dataLength == 0) |
|
615 { |
|
616 EncodeInt32(0); |
|
617 return; |
|
618 } |
|
619 |
|
620 TUint8 * dstData = new TUint8[dataLength]; |
|
621 if (dstData) |
|
622 { |
|
623 Mem::FillZ(dstData, dataLength); |
|
624 TUint8 * dstDataPtr; |
|
625 TUint8 * srcDataPtr = (TUint8 *)data; |
|
626 EncodeInt32(dataLength); |
|
627 if (dataStride < 0) |
|
628 { |
|
629 dstDataPtr = dstData + ( height - 1 ) * (-dataStride); |
|
630 } |
|
631 else |
|
632 { |
|
633 dstDataPtr = dstData; |
|
634 } |
|
635 |
|
636 do |
|
637 { |
|
638 Mem::Copy(dstDataPtr, srcDataPtr, M ); |
|
639 srcDataPtr += dataStride; |
|
640 dstDataPtr += dataStride; |
|
641 } while( --height ); |
|
642 |
|
643 |
|
644 EncodeData(dstData, dataLength); |
|
645 delete [] dstData; |
|
646 #ifdef VGRENDERER_LOG |
|
647 iLog.WriteFormat(_L("vgimagesubdata")); |
|
648 #endif |
|
649 } |
|
650 else |
|
651 { |
|
652 |
|
653 #ifdef VGRENDERER_LOG |
|
654 iLog.WriteFormat(_L("Allocating memory in vgImageSubData failed")); |
|
655 #endif |
|
656 |
|
657 EncodeInt32(0); |
|
658 } |
|
659 } |
|
660 |
|
661 void CPseodoVGRendererImpl::vgMask(TUint /*mask*/, TInt /*operation*/, TInt /*x*/, TInt /*y*/, TInt /*width*/, TInt /*height*/) |
|
662 { |
|
663 //TODO: not used in SVGEngine |
|
664 } |
|
665 |
|
666 void CPseodoVGRendererImpl::ToggleReset() |
|
667 { |
|
668 } |
|
669 |
|
670 void CPseodoVGRendererImpl::vgDestroyImage(TUint aHandle) |
|
671 { |
|
672 EncodeInt8(EvgDestroyImage); |
|
673 EncodeInt32(aHandle); |
|
674 #ifdef VGRENDERER_LOG |
|
675 iLog.WriteFormat(_L("vgdestroyimage")); |
|
676 #endif |
|
677 } |
|
678 |
|
679 void CPseodoVGRendererImpl::vgDestroyPaint(TUint /*aHandle*/) |
|
680 { |
|
681 //TODO |
|
682 } |
|
683 |
|
684 void CPseodoVGRendererImpl::vgDestroyPath(TUint /*aHandle*/) |
|
685 { |
|
686 //TODO |
|
687 } |
|
688 |
|
689 void CPseodoVGRendererImpl::vgFlush() |
|
690 { |
|
691 //TODO |
|
692 } |
|
693 |
|
694 TInt CPseodoVGRendererImpl::vgGetError() |
|
695 { |
|
696 return iVgErrorCode; |
|
697 } |
|
698 |
|
699 MVGSurfaceImpl* CPseodoVGRendererImpl::CreateVGSurfaceL(TInt /*aOption*/) |
|
700 { |
|
701 return CPseudoVGSurfaceImpl::NewL(this); |
|
702 } |
|
703 |
|
704 TUint8 CPseodoVGRendererImpl::GetPathCoordianteSize(TUint8 /*aHandle*/) |
|
705 { |
|
706 return sizeof(TReal32); |
|
707 } |
|
708 |
|
709 inline TInt CPseodoVGRendererImpl::EncodeInt8(TUint8 aVal) |
|
710 { |
|
711 return EncodeData(&aVal, sizeof(aVal)); |
|
712 } |
|
713 |
|
714 inline TInt CPseodoVGRendererImpl::EncodeInt16(TUint16 aVal) |
|
715 { |
|
716 return EncodeData(&aVal, sizeof(aVal)); |
|
717 } |
|
718 |
|
719 inline TInt CPseodoVGRendererImpl::EncodeInt32(TUint32 aVal) |
|
720 { |
|
721 return EncodeData(&aVal, sizeof(aVal)); |
|
722 } |
|
723 |
|
724 inline TInt CPseodoVGRendererImpl::EncodeReal32(TReal32 aVal) |
|
725 { |
|
726 return EncodeData(&aVal, sizeof(aVal)); |
|
727 } |
|
728 |
|
729 inline TInt CPseodoVGRendererImpl::EncodeReal64(TReal64 aVal) |
|
730 { |
|
731 return EncodeData(&aVal, sizeof(aVal)); |
|
732 } |
|
733 |
|
734 TInt CPseodoVGRendererImpl::EncodeData(const TAny *aData, TUint aLength) |
|
735 { |
|
736 |
|
737 if(iVgErrorCode==VG_NO_ERROR) |
|
738 { |
|
739 TInt result = KErrNone; |
|
740 TPtr8 lPtr( iEncodedData->Des() ); |
|
741 TInt encodedDataLength = lPtr.Length() + aLength; |
|
742 TInt encodedDataMaxLength = lPtr.MaxLength(); |
|
743 |
|
744 if (encodedDataLength >= encodedDataMaxLength) |
|
745 { |
|
746 if ((result = ExpandEncodedData(encodedDataLength)) == KErrNone) |
|
747 { |
|
748 TPtr8 lPtr1( iEncodedData->Des() ); |
|
749 lPtr1.Append((TUint8*)(aData), aLength); |
|
750 } |
|
751 } |
|
752 else |
|
753 { |
|
754 lPtr.Append((TUint8*)(aData), aLength); |
|
755 } |
|
756 |
|
757 return result; |
|
758 } |
|
759 else |
|
760 { |
|
761 return iVgErrorCode; |
|
762 } |
|
763 } |
|
764 |
|
765 TInt CPseodoVGRendererImpl::ExpandEncodedData(TUint aNewLength) |
|
766 { |
|
767 TInt result = KErrNone; |
|
768 TPtr8 lPtr( iEncodedData->Des() ); |
|
769 TInt encodedDataMaxLength = lPtr.MaxLength(); |
|
770 TUint granularities = ((aNewLength - encodedDataMaxLength) / CPseodoVGRendererImpl::ENCODEDDATAGRANULARITY) + 1; |
|
771 HBufC8 * tmpBuf = HBufC8::New(encodedDataMaxLength + granularities * CPseodoVGRendererImpl::ENCODEDDATAGRANULARITY); |
|
772 |
|
773 if (tmpBuf == 0) |
|
774 { |
|
775 result = KErrNoMemory; |
|
776 iVgErrorCode = VG_OUT_OF_MEMORY_ERROR; |
|
777 } |
|
778 |
|
779 else |
|
780 { |
|
781 TPtr8 tmpBufPtr (tmpBuf->Des()); |
|
782 tmpBufPtr.Copy(*iEncodedData); |
|
783 |
|
784 delete iEncodedData; |
|
785 iEncodedData = tmpBuf; |
|
786 } |
|
787 |
|
788 return result; |
|
789 } |
|
790 |
|
791 |
|
792 void CPseodoVGRendererImpl::EmptyEncodedData() |
|
793 { |
|
794 iVgErrorCode = VG_NO_ERROR; |
|
795 if(iEncodedData->Length() > CPseodoVGRendererImpl::ENCODEDDATALENGTH) |
|
796 { |
|
797 delete iEncodedData; |
|
798 iEncodedData = HBufC8::New(CPseodoVGRendererImpl::ENCODEDDATALENGTH); |
|
799 if(!iEncodedData) |
|
800 { |
|
801 iVgErrorCode = VG_OUT_OF_MEMORY_ERROR; |
|
802 return; |
|
803 } |
|
804 } |
|
805 TPtr8 lPtr( iEncodedData->Des() ); |
|
806 lPtr.Zero(); |
|
807 WriteHeader(); |
|
808 |
|
809 #ifdef VGRENDERER_LOG |
|
810 iLog.WriteFormat(_L("InitializeSurface-EmptyEncodedData and WriteheaderData")); |
|
811 #endif |
|
812 } |
|
813 |
|
814 TInt CPseodoVGRendererImpl::AddCommand(TInt aType, TUint8 * aValue, TInt aLength) |
|
815 { |
|
816 TInt ret = 0; |
|
817 ret = EncodeInt8(aType); |
|
818 if (aValue && aLength > 0) |
|
819 { |
|
820 ret |= EncodeData(aValue, aLength); |
|
821 } |
|
822 |
|
823 return ret; |
|
824 } |
|
825 |
|
826 void CPseodoVGRendererImpl::SetCommonHeader(const TDesC8& aHeader) |
|
827 { |
|
828 iCommonHeader = aHeader.Ptr(); |
|
829 iCommonHeaderLength = aHeader.Length(); |
|
830 TPtr8 lPtr( iEncodedData->Des() ); |
|
831 |
|
832 if (iCommonHeaderLength != 0) |
|
833 { |
|
834 lPtr.Replace(0, iCommonHeaderLength, aHeader); |
|
835 } |
|
836 } |
|
837 |
|
838 void CPseodoVGRendererImpl::SetMaskFlag(TBool aVal) |
|
839 { |
|
840 TPtr8 lPtr( iEncodedData->Des() ); |
|
841 TNVGIconHeader iconheader(lPtr); |
|
842 iconheader.SetIsMask(aVal); |
|
843 } |
|
844 |
|
845 void CPseodoVGRendererImpl::DumpToLogFile() |
|
846 { |
|
847 #ifdef VGRENDERER_LOG |
|
848 TInt err = iLog.Connect(); |
|
849 TRAPD(logerror,iLog.CreateLog(_L("PseodoEncoder"),_L("PseodoEncoder.txt"),EFileLoggingModeOverwrite)); |
|
850 #endif |
|
851 } |
|
852 |
|
853 void CPseodoVGRendererImpl::CloseLogFile() |
|
854 { |
|
855 #ifdef VGRENDERER_LOG |
|
856 iLog.CloseLog(); |
|
857 iLog.Close(); |
|
858 #endif |
|
859 } |
|
860 |
|
861 |
|
862 |
|
863 #ifdef VGRENDERER_LOG |
|
864 void CPseodoVGRendererImpl::LogvgSetf(VGParamType type, VGfloat value,TInt cmdsize) |
|
865 { |
|
866 TBufC8<70> logbuf; |
|
867 TPtr8 logptr = logbuf.Des(); |
|
868 |
|
869 logptr.Append(_L("vgSetf(")); |
|
870 |
|
871 switch( type ) |
|
872 { |
|
873 case VG_STROKE_LINE_WIDTH: |
|
874 { |
|
875 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
876 } |
|
877 break; |
|
878 |
|
879 case VG_STROKE_MITER_LIMIT: |
|
880 { |
|
881 logptr.Append(_L("VG_STROKE_MITER_LIMIT")); |
|
882 } |
|
883 break; |
|
884 case VG_STROKE_DASH_PHASE: |
|
885 { |
|
886 logptr.Append(_L("VG_STROKE_DASH_PHASE")); |
|
887 } |
|
888 break; |
|
889 |
|
890 |
|
891 case VG_MATRIX_MODE: |
|
892 { |
|
893 logptr.Append(_L("VG_MATRIX_MODE")); |
|
894 } |
|
895 break; |
|
896 case VG_FILL_RULE: |
|
897 { |
|
898 logptr.Append(_L("VG_FILL_RULE")); |
|
899 } |
|
900 break; |
|
901 case VG_IMAGE_QUALITY: |
|
902 { |
|
903 logptr.Append(_L("VG_IMAGE_QUALITY")); |
|
904 } |
|
905 break; |
|
906 case VG_IMAGE_MODE: |
|
907 { |
|
908 logptr.Append(_L("VG_IMAGE_MODE")); |
|
909 } |
|
910 break; |
|
911 case VG_RENDERING_QUALITY: |
|
912 { |
|
913 logptr.Append(_L("VG_RENDERING_QUALITY")); |
|
914 } |
|
915 break; |
|
916 case VG_BLEND_MODE: |
|
917 { |
|
918 logptr.Append(_L("VG_BLEND_MODE")); |
|
919 } |
|
920 break; |
|
921 case VG_MASKING: |
|
922 { |
|
923 logptr.Append(_L("VG_MASKING")); |
|
924 } |
|
925 break; |
|
926 case VG_SCISSORING: |
|
927 { |
|
928 logptr.Append(_L("VG_SCISSORING")); |
|
929 } |
|
930 break; |
|
931 case VG_PIXEL_LAYOUT: |
|
932 { |
|
933 logptr.Append(_L("VG_PIXEL_LAYOUT")); |
|
934 } |
|
935 break; |
|
936 case VG_FILTER_FORMAT_LINEAR: |
|
937 { |
|
938 logptr.Append(_L("VG_FILTER_FORMAT_LINEAR")); |
|
939 } |
|
940 break; |
|
941 case VG_FILTER_FORMAT_PREMULTIPLIED: |
|
942 { |
|
943 logptr.Append(_L("VG_FILTER_FORMAT_PREMULTIPLIED")); |
|
944 } |
|
945 break; |
|
946 case VG_FILTER_CHANNEL_MASK: |
|
947 { |
|
948 logptr.Append(_L("VG_FILTER_CHANNEL_MASK")); |
|
949 } |
|
950 break; |
|
951 case VG_STROKE_CAP_STYLE: |
|
952 { |
|
953 logptr.Append(_L("VG_STROKE_CAP_STYLE")); |
|
954 } |
|
955 break; |
|
956 case VG_STROKE_JOIN_STYLE: |
|
957 { |
|
958 logptr.Append(_L("VG_STROKE_JOIN_STYLE")); |
|
959 } |
|
960 break; |
|
961 case VG_STROKE_DASH_PHASE_RESET: |
|
962 { |
|
963 logptr.Append(_L("VG_STROKE_DASH_PHASE_RESET")); |
|
964 } |
|
965 break; |
|
966 /* Implementation limits (read-only) */ |
|
967 case VG_SCREEN_LAYOUT: |
|
968 { |
|
969 logptr.Append(_L("VG_SCREEN_LAYOUT")); |
|
970 } |
|
971 break; |
|
972 case VG_MAX_SCISSOR_RECTS: |
|
973 { |
|
974 logptr.Append(_L("VG_MAX_SCISSOR_RECTS")); |
|
975 } |
|
976 break; |
|
977 case VG_MAX_DASH_COUNT: |
|
978 { |
|
979 logptr.Append(_L("VG_MAX_DASH_COUNT")); |
|
980 } |
|
981 break; |
|
982 case VG_MAX_KERNEL_SIZE: |
|
983 { |
|
984 logptr.Append(_L("VG_MAX_KERNEL_SIZE")); |
|
985 } |
|
986 break; |
|
987 case VG_MAX_SEPARABLE_KERNEL_SIZE: |
|
988 { |
|
989 logptr.Append(_L("VG_MAX_SEPARABLE_KERNEL_SIZE")); |
|
990 } |
|
991 break; |
|
992 case VG_MAX_COLOR_RAMP_STOPS: |
|
993 { |
|
994 logptr.Append(_L("VG_MAX_COLOR_RAMP_STOPS")); |
|
995 } |
|
996 break; |
|
997 case VG_MAX_IMAGE_WIDTH: |
|
998 { |
|
999 logptr.Append(_L("VG_MAX_IMAGE_WIDTH")); |
|
1000 } |
|
1001 break; |
|
1002 case VG_MAX_IMAGE_HEIGHT: |
|
1003 { |
|
1004 logptr.Append(_L("VG_MAX_IMAGE_HEIGHT")); |
|
1005 } |
|
1006 break; |
|
1007 case VG_MAX_IMAGE_PIXELS: |
|
1008 { |
|
1009 logptr.Append(_L("VG_MAX_IMAGE_PIXELS")); |
|
1010 } |
|
1011 break; |
|
1012 case VG_MAX_IMAGE_BYTES: |
|
1013 { |
|
1014 logptr.Append(_L("VG_MAX_IMAGE_BYTES")); |
|
1015 } |
|
1016 break; |
|
1017 case VG_MAX_FLOAT: |
|
1018 { |
|
1019 logptr.Append(_L("VG_MAX_FLOAT")); |
|
1020 } |
|
1021 break; |
|
1022 case VG_MAX_GAUSSIAN_STD_DEVIATION: |
|
1023 { |
|
1024 logptr.Append(_L("VG_MAX_GAUSSIAN_STD_DEVIATION")); |
|
1025 } |
|
1026 break; |
|
1027 |
|
1028 default: |
|
1029 { |
|
1030 logptr.Append(_L("INVALID PARAMTYPE")); |
|
1031 } |
|
1032 break; |
|
1033 }; |
|
1034 |
|
1035 logptr.Append(_L(",")); |
|
1036 logptr.AppendNum(value); |
|
1037 logptr.Append(_L("):size=")); |
|
1038 logptr.AppendNum(cmdsize); |
|
1039 iLog.WriteFormat(logbuf); |
|
1040 return; |
|
1041 } |
|
1042 |
|
1043 void CPseodoVGRendererImpl::LogvgSeti (VGParamType type, VGint value,TInt cmdsize) |
|
1044 { |
|
1045 TBufC8<70> logbuf; |
|
1046 TPtr8 logptr = logbuf.Des(); |
|
1047 logptr.Append(_L("vgSeti(")); |
|
1048 |
|
1049 switch( type ) |
|
1050 { |
|
1051 case VG_STROKE_LINE_WIDTH: |
|
1052 { |
|
1053 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1054 } |
|
1055 break; |
|
1056 case VG_STROKE_MITER_LIMIT: |
|
1057 { |
|
1058 logptr.Append(_L("VG_STROKE_MITER_LIMIT")); |
|
1059 } |
|
1060 break; |
|
1061 case VG_STROKE_DASH_PHASE: |
|
1062 { |
|
1063 logptr.Append(_L("VG_STROKE_DASH_PHASE")); |
|
1064 } |
|
1065 break; |
|
1066 |
|
1067 case VG_MATRIX_MODE: |
|
1068 { |
|
1069 logptr.Append(_L("VG_MATRIX_MODE")); |
|
1070 } |
|
1071 break; |
|
1072 case VG_FILL_RULE: |
|
1073 { |
|
1074 logptr.Append(_L("VG_FILL_RULE")); |
|
1075 } |
|
1076 break; |
|
1077 case VG_IMAGE_QUALITY: |
|
1078 { |
|
1079 logptr.Append(_L("VG_IMAGE_QUALITY")); |
|
1080 } |
|
1081 break; |
|
1082 case VG_IMAGE_MODE: |
|
1083 { |
|
1084 logptr.Append(_L("VG_IMAGE_MODE")); |
|
1085 } |
|
1086 break; |
|
1087 case VG_RENDERING_QUALITY: |
|
1088 { |
|
1089 logptr.Append(_L("VG_RENDERING_QUALITY")); |
|
1090 } |
|
1091 break; |
|
1092 case VG_BLEND_MODE: |
|
1093 { |
|
1094 logptr.Append(_L("VG_BLEND_MODE")); |
|
1095 } |
|
1096 break; |
|
1097 case VG_MASKING: |
|
1098 { |
|
1099 logptr.Append(_L("VG_MASKING")); |
|
1100 } |
|
1101 break; |
|
1102 case VG_SCISSORING: |
|
1103 { |
|
1104 logptr.Append(_L("VG_SCISSORING")); |
|
1105 } |
|
1106 break; |
|
1107 case VG_PIXEL_LAYOUT: |
|
1108 { |
|
1109 logptr.Append(_L("VG_PIXEL_LAYOUT")); |
|
1110 } |
|
1111 break; |
|
1112 case VG_FILTER_FORMAT_LINEAR: |
|
1113 { |
|
1114 logptr.Append(_L("VG_FILTER_FORMAT_LINEAR")); |
|
1115 } |
|
1116 break; |
|
1117 case VG_FILTER_FORMAT_PREMULTIPLIED: |
|
1118 { |
|
1119 logptr.Append(_L("VG_FILTER_FORMAT_PREMULTIPLIED")); |
|
1120 } |
|
1121 break; |
|
1122 case VG_FILTER_CHANNEL_MASK: |
|
1123 { |
|
1124 logptr.Append(_L("VG_FILTER_CHANNEL_MASK")); |
|
1125 } |
|
1126 break; |
|
1127 case VG_STROKE_CAP_STYLE: |
|
1128 { |
|
1129 logptr.Append(_L("VG_STROKE_CAP_STYLE")); |
|
1130 } |
|
1131 break; |
|
1132 case VG_STROKE_JOIN_STYLE: |
|
1133 { |
|
1134 logptr.Append(_L("VG_STROKE_JOIN_STYLE")); |
|
1135 } |
|
1136 break; |
|
1137 case VG_STROKE_DASH_PHASE_RESET: |
|
1138 { |
|
1139 logptr.Append(_L("VG_STROKE_DASH_PHASE_RESET")); |
|
1140 } |
|
1141 break; |
|
1142 /* Implementation limits (read-only) */ |
|
1143 case VG_SCREEN_LAYOUT: |
|
1144 { |
|
1145 logptr.Append(_L("VG_SCREEN_LAYOUT")); |
|
1146 } |
|
1147 break; |
|
1148 case VG_MAX_SCISSOR_RECTS: |
|
1149 { |
|
1150 logptr.Append(_L("VG_MAX_SCISSOR_RECTS")); |
|
1151 } |
|
1152 break; |
|
1153 case VG_MAX_DASH_COUNT: |
|
1154 { |
|
1155 logptr.Append(_L("VG_MAX_DASH_COUNT")); |
|
1156 } |
|
1157 break; |
|
1158 case VG_MAX_KERNEL_SIZE: |
|
1159 { |
|
1160 logptr.Append(_L("VG_MAX_KERNEL_SIZE")); |
|
1161 } |
|
1162 break; |
|
1163 case VG_MAX_SEPARABLE_KERNEL_SIZE: |
|
1164 { |
|
1165 logptr.Append(_L("VG_MAX_SEPARABLE_KERNEL_SIZE")); |
|
1166 } |
|
1167 break; |
|
1168 case VG_MAX_COLOR_RAMP_STOPS: |
|
1169 { |
|
1170 logptr.Append(_L("VG_MAX_COLOR_RAMP_STOPS")); |
|
1171 } |
|
1172 break; |
|
1173 case VG_MAX_IMAGE_WIDTH: |
|
1174 { |
|
1175 logptr.Append(_L("VG_MAX_IMAGE_WIDTH")); |
|
1176 } |
|
1177 break; |
|
1178 case VG_MAX_IMAGE_HEIGHT: |
|
1179 { |
|
1180 logptr.Append(_L("VG_MAX_IMAGE_HEIGHT")); |
|
1181 } |
|
1182 break; |
|
1183 case VG_MAX_IMAGE_PIXELS: |
|
1184 { |
|
1185 logptr.Append(_L("VG_MAX_IMAGE_PIXELS")); |
|
1186 } |
|
1187 break; |
|
1188 case VG_MAX_IMAGE_BYTES: |
|
1189 { |
|
1190 logptr.Append(_L("VG_MAX_IMAGE_BYTES")); |
|
1191 } |
|
1192 break; |
|
1193 case VG_MAX_FLOAT: |
|
1194 { |
|
1195 logptr.Append(_L("VG_MAX_FLOAT")); |
|
1196 } |
|
1197 break; |
|
1198 case VG_MAX_GAUSSIAN_STD_DEVIATION: |
|
1199 { |
|
1200 logptr.Append(_L("VG_MAX_GAUSSIAN_STD_DEVIATION")); |
|
1201 } |
|
1202 break; |
|
1203 |
|
1204 default: |
|
1205 { |
|
1206 logptr.Append(_L("INVALID PARAMTYPE")); |
|
1207 } |
|
1208 break; |
|
1209 }; |
|
1210 |
|
1211 logptr.Append(_L(",")); |
|
1212 switch(value) |
|
1213 { |
|
1214 case VG_RENDERING_QUALITY_NONANTIALIASED: |
|
1215 { |
|
1216 logptr.Append(_L("VG_RENDERING_QUALITY_NONANTIALIASED")); |
|
1217 } |
|
1218 break; |
|
1219 case VG_RENDERING_QUALITY_FASTER: |
|
1220 { |
|
1221 logptr.Append(_L("VG_RENDERING_QUALITY_FASTER")); |
|
1222 } |
|
1223 break; |
|
1224 case VG_RENDERING_QUALITY_BETTER: |
|
1225 { |
|
1226 logptr.Append(_L("VG_RENDERING_QUALITY_BETTER")); |
|
1227 } |
|
1228 break; |
|
1229 case VG_MATRIX_PATH_USER_TO_SURFACE: |
|
1230 { |
|
1231 logptr.Append(_L("VG_MATRIX_PATH_USER_TO_SURFACE")); |
|
1232 } |
|
1233 break; |
|
1234 case VG_MATRIX_IMAGE_USER_TO_SURFACE: |
|
1235 { |
|
1236 logptr.Append(_L("VG_MATRIX_IMAGE_USER_TO_SURFACE")); |
|
1237 } |
|
1238 break; |
|
1239 case VG_MATRIX_FILL_PAINT_TO_USER : |
|
1240 { |
|
1241 logptr.Append(_L("VG_MATRIX_FILL_PAINT_TO_USER")); |
|
1242 } |
|
1243 break; |
|
1244 case VG_MATRIX_STROKE_PAINT_TO_USER: |
|
1245 { |
|
1246 logptr.Append(_L("VG_MATRIX_STROKE_PAINT_TO_USER")); |
|
1247 } |
|
1248 break; |
|
1249 case VG_CAP_BUTT: |
|
1250 { |
|
1251 logptr.Append(_L("VG_CAP_BUTT")); |
|
1252 } |
|
1253 break; |
|
1254 case VG_CAP_ROUND: |
|
1255 { |
|
1256 logptr.Append(_L("VG_CAP_ROUND")); |
|
1257 } |
|
1258 break; |
|
1259 case VG_CAP_SQUARE: |
|
1260 { |
|
1261 logptr.Append(_L("VG_CAP_SQUARE")); |
|
1262 } |
|
1263 break; |
|
1264 case VG_BLEND_SRC: |
|
1265 { |
|
1266 logptr.Append(_L("VG_BLEND_SRC")); |
|
1267 } |
|
1268 break; |
|
1269 case VG_BLEND_SRC_OVER: |
|
1270 { |
|
1271 logptr.Append(_L("VG_BLEND_SRC_OVER")); |
|
1272 } |
|
1273 break; |
|
1274 case VG_BLEND_DST_OVER: |
|
1275 { |
|
1276 logptr.Append(_L("VG_BLEND_DST_OVER")); |
|
1277 } |
|
1278 break; |
|
1279 case VG_BLEND_SRC_IN: |
|
1280 { |
|
1281 logptr.Append(_L("VG_BLEND_SRC_IN")); |
|
1282 } |
|
1283 break; |
|
1284 case VG_BLEND_DST_IN: |
|
1285 { |
|
1286 logptr.Append(_L("VG_BLEND_DST_IN")); |
|
1287 } |
|
1288 break; |
|
1289 case VG_BLEND_MULTIPLY: |
|
1290 { |
|
1291 logptr.Append(_L("VG_BLEND_MULTIPLY")); |
|
1292 } |
|
1293 break; |
|
1294 case VG_BLEND_SCREEN: |
|
1295 { |
|
1296 logptr.Append(_L("VG_BLEND_SCREEN")); |
|
1297 } |
|
1298 break; |
|
1299 case VG_BLEND_DARKEN: |
|
1300 { |
|
1301 logptr.Append(_L("VG_BLEND_DARKEN")); |
|
1302 } |
|
1303 break; |
|
1304 case VG_BLEND_LIGHTEN: |
|
1305 { |
|
1306 logptr.Append(_L("VG_BLEND_LIGHTEN")); |
|
1307 } |
|
1308 break; |
|
1309 case VG_BLEND_ADDITIVE: |
|
1310 { |
|
1311 logptr.Append(_L("VG_BLEND_ADDITIVE")); |
|
1312 } |
|
1313 break; |
|
1314 case VG_IMAGE_QUALITY_NONANTIALIASED: |
|
1315 { |
|
1316 logptr.Append(_L("VG_IMAGE_QUALITY_NONANTIALIASED")); |
|
1317 } |
|
1318 break; |
|
1319 case VG_IMAGE_QUALITY_FASTER: |
|
1320 { |
|
1321 logptr.Append(_L("VG_IMAGE_QUALITY_FASTER")); |
|
1322 } |
|
1323 break; |
|
1324 case VG_IMAGE_QUALITY_BETTER: |
|
1325 { |
|
1326 logptr.Append(_L("VG_IMAGE_QUALITY_BETTER")); |
|
1327 } |
|
1328 break; |
|
1329 case VG_FALSE: |
|
1330 { |
|
1331 logptr.Append(_L("VG_FALSE")); |
|
1332 } |
|
1333 break; |
|
1334 case VG_RED: |
|
1335 { |
|
1336 logptr.Append(_L("VG_RED")); |
|
1337 } |
|
1338 break; |
|
1339 |
|
1340 case VG_DRAW_IMAGE_NORMAL: |
|
1341 { |
|
1342 logptr.Append(_L("VG_DRAW_IMAGE_NORMAL")); |
|
1343 } |
|
1344 break; |
|
1345 case VG_DRAW_IMAGE_MULTIPLY: |
|
1346 { |
|
1347 logptr.Append(_L("VG_DRAW_IMAGE_MULTIPLY")); |
|
1348 } |
|
1349 break; |
|
1350 case VG_DRAW_IMAGE_STENCIL: |
|
1351 { |
|
1352 logptr.Append(_L("VG_DRAW_IMAGE_STENCIL")); |
|
1353 } |
|
1354 break; |
|
1355 case VG_JOIN_MITER: |
|
1356 { |
|
1357 logptr.Append(_L("VG_DRAW_IMAGE_STENCIL")); |
|
1358 } |
|
1359 break; |
|
1360 case VG_JOIN_ROUND: |
|
1361 { |
|
1362 logptr.Append(_L("VG_DRAW_IMAGE_STENCIL")); |
|
1363 } |
|
1364 break; |
|
1365 case VG_JOIN_BEVEL: |
|
1366 { |
|
1367 logptr.Append(_L("VG_DRAW_IMAGE_STENCIL")); |
|
1368 } |
|
1369 break; |
|
1370 default: |
|
1371 { |
|
1372 logptr.AppendNum(value); |
|
1373 } |
|
1374 break; |
|
1375 }; |
|
1376 |
|
1377 logptr.Append(_L("):size=")); |
|
1378 logptr.AppendNum(cmdsize); |
|
1379 iLog.WriteFormat(logbuf); |
|
1380 return; |
|
1381 } |
|
1382 |
|
1383 void CPseodoVGRendererImpl::LogvgSetParameteri(VGHandle handle, VGint paramType, VGint value,TInt cmdsize,TInt Lpvalue) |
|
1384 { |
|
1385 TBufC8<90> logbuf; |
|
1386 TPtr8 logptr = logbuf.Des(); |
|
1387 logptr.Append(_L("vgsetparameteri(")); |
|
1388 logptr.AppendNum(handle); |
|
1389 logptr.Append(_L(",")); |
|
1390 |
|
1391 switch(paramType) |
|
1392 { |
|
1393 case VG_PAINT_TYPE: |
|
1394 { |
|
1395 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1396 } |
|
1397 break; |
|
1398 case VG_PAINT_COLOR: |
|
1399 { |
|
1400 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1401 } |
|
1402 break; |
|
1403 case VG_PAINT_COLOR_RAMP_SPREAD_MODE: |
|
1404 { |
|
1405 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1406 } |
|
1407 break; |
|
1408 case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: |
|
1409 { |
|
1410 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1411 } |
|
1412 break; |
|
1413 case VG_PAINT_COLOR_RAMP_STOPS: |
|
1414 { |
|
1415 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1416 } |
|
1417 break; |
|
1418 |
|
1419 /* Linear gradient paint parameters */ |
|
1420 case VG_PAINT_LINEAR_GRADIENT: |
|
1421 { |
|
1422 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1423 } |
|
1424 break; |
|
1425 /* Radial gradient paint parameters */ |
|
1426 case VG_PAINT_RADIAL_GRADIENT: |
|
1427 { |
|
1428 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1429 } |
|
1430 break; |
|
1431 /* Pattern paint parameters */ |
|
1432 case VG_PAINT_PATTERN_TILING_MODE: |
|
1433 { |
|
1434 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1435 } |
|
1436 break; |
|
1437 default: |
|
1438 { |
|
1439 logptr.AppendNum(paramType); |
|
1440 } |
|
1441 break; |
|
1442 }; |
|
1443 logptr.Append(_L(",")); |
|
1444 |
|
1445 switch(value) |
|
1446 { |
|
1447 case VG_PAINT_TYPE_COLOR: |
|
1448 { |
|
1449 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1450 } |
|
1451 break; |
|
1452 case VG_PAINT_TYPE_LINEAR_GRADIENT: |
|
1453 { |
|
1454 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1455 } |
|
1456 break; |
|
1457 case VG_PAINT_TYPE_RADIAL_GRADIENT: |
|
1458 { |
|
1459 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1460 } |
|
1461 break; |
|
1462 case VG_PAINT_TYPE_PATTERN: |
|
1463 { |
|
1464 logptr.Append(_L("VG_STROKE_LINE_WIDTH")); |
|
1465 } |
|
1466 break; |
|
1467 default: |
|
1468 { |
|
1469 logptr.AppendNum(value); |
|
1470 } |
|
1471 break; |
|
1472 }; |
|
1473 logptr.Append(_L("):size=")); |
|
1474 logptr.AppendNum(cmdsize); |
|
1475 logptr.Append(_L(":hnum=")); |
|
1476 logptr.AppendNum(Lpvalue); |
|
1477 iLog.WriteFormat(logbuf); |
|
1478 return; |
|
1479 } |
|
1480 |
|
1481 void CPseodoVGRendererImpl::LogvgSetPaint(VGPaint paint, VGbitfield paintModes,TInt cmdsize,TInt Lpvalue) |
|
1482 { |
|
1483 TBufC8<50> logbuf; |
|
1484 TPtr8 logptr = logbuf.Des(); |
|
1485 logptr.Append(_L("vgSetPaint(")); |
|
1486 logptr.AppendNum(paint); |
|
1487 logptr.Append(_L(",")); |
|
1488 |
|
1489 switch(paintModes) |
|
1490 { |
|
1491 case VG_STROKE_PATH: |
|
1492 { |
|
1493 logptr.Append(_L("VG_STROKE_PATH")); |
|
1494 } |
|
1495 break; |
|
1496 case VG_FILL_PATH: |
|
1497 { |
|
1498 logptr.Append(_L("VG_FILL_PATH")); |
|
1499 } |
|
1500 break; |
|
1501 default: |
|
1502 { |
|
1503 logptr.AppendNum(paintModes); |
|
1504 } |
|
1505 break; |
|
1506 }; |
|
1507 logptr.Append(_L("):size=")); |
|
1508 logptr.AppendNum(cmdsize); |
|
1509 logptr.Append(_L(":hnum=")); |
|
1510 logptr.AppendNum(Lpvalue); |
|
1511 iLog.WriteFormat(logbuf); |
|
1512 return; |
|
1513 } |
|
1514 |
|
1515 void CPseodoVGRendererImpl::LogvgDrawPath(VGbitfield paintModes,int cmdsize) |
|
1516 { |
|
1517 TBufC8<50> logbuf; |
|
1518 TPtr8 logptr = logbuf.Des(); |
|
1519 logptr.Append(_L("vgDrawPath(")); |
|
1520 switch(paintModes) |
|
1521 { |
|
1522 case VG_STROKE_PATH: |
|
1523 { |
|
1524 logptr.Append(_L("VG_STROKE_PATH")); |
|
1525 } |
|
1526 break; |
|
1527 case VG_FILL_PATH: |
|
1528 { |
|
1529 logptr.Append(_L("VG_FILL_PATH")); |
|
1530 } |
|
1531 break; |
|
1532 case 3: |
|
1533 { |
|
1534 logptr.Append(_L("FILL & STROKE")); |
|
1535 } |
|
1536 break; |
|
1537 default: |
|
1538 { |
|
1539 logptr.AppendNum(paintModes); |
|
1540 } |
|
1541 break; |
|
1542 }; |
|
1543 logptr.Append(_L("):size=")); |
|
1544 logptr.AppendNum(cmdsize); |
|
1545 iLog.WriteFormat(logbuf); |
|
1546 return; |
|
1547 } |
|
1548 #endif |
|
1549 |
|
1550 |