|
1 /* |
|
2 * Copyright (c) 2008 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: NVG Decoder source file |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "TLVRenderer.h" |
|
19 #include "MVGImageBinder.h" |
|
20 #include "NVGUtil.h" |
|
21 #include "NVGIconData.h" |
|
22 #include "NVGTLVIcon.h" |
|
23 #include "nvg.h" |
|
24 |
|
25 #ifdef NVG_DEBUG |
|
26 #include <time.h> |
|
27 #endif |
|
28 |
|
29 CTLVRenderer::CTLVRenderer(TInt aWidth, TInt aHeight) |
|
30 : iTargetWidth(aWidth), |
|
31 iTargetHeight(aHeight), |
|
32 iVGImageBinder(0), |
|
33 iPrepareToBindImage(0) |
|
34 |
|
35 { |
|
36 } |
|
37 |
|
38 CTLVRenderer * CTLVRenderer::NewL(const TDesC8& aBuf, TInt aWidth, TInt aHeight) |
|
39 { |
|
40 CTLVRenderer* self = CTLVRenderer::NewLC(aBuf,aWidth, aHeight); |
|
41 CleanupStack::Pop(self); |
|
42 return self; |
|
43 } |
|
44 CTLVRenderer * CTLVRenderer::NewLC(const TDesC8& aBuf, TInt aWidth, TInt aHeight) |
|
45 { |
|
46 CTLVRenderer* self = new (ELeave) CTLVRenderer(aWidth, aHeight); |
|
47 CleanupStack::PushL(self); |
|
48 self->ConstructL(aBuf); |
|
49 return self; |
|
50 } |
|
51 |
|
52 void CTLVRenderer::ConstructL(const TDesC8& aBuf) |
|
53 { |
|
54 vgapi[EvgSeti] = &DvgSetiL; |
|
55 vgapi[EvgSetf] = &DvgSetfL; |
|
56 vgapi[EvgSetParameteri] = &DvgSetParameteriL; |
|
57 vgapi[EvgSetParameterf] = &DvgSetParameterfL; |
|
58 vgapi[EvgSetParameterfv] = &DvgSetParameterfvL; |
|
59 vgapi[EvgSetColor] = &DvgSetColorL; |
|
60 vgapi[EvgSetPaint] = &DvgSetPaintL; |
|
61 vgapi[EvgLoadMatrix] = &DvgLoadMatrixL; |
|
62 vgapi[EvgMultMatrix] = &DvgMultMatrixL; |
|
63 vgapi[EvgLoadIdentity] = &DvgLoadIdentityL; |
|
64 vgapi[EvgScale] = &DvgScaleL; |
|
65 vgapi[EvgTranslate] = &DvgTranslateL; |
|
66 vgapi[EvgAppendPathData] = &DvgAppendPathDataL; |
|
67 vgapi[EvgDrawPath] = &DvgDrawPathL; |
|
68 vgapi[EvgClearPath] = &DvgClearPathL; |
|
69 vgapi[EvguRect] = &DvguRectL; |
|
70 vgapi[EvguEllipse] = &DvguEllipseL; |
|
71 vgapi[EvguRoundRect] = &DvguRoundRectL; |
|
72 vgapi[EvguLine] = &DvguLineL; |
|
73 vgapi[EvgCreatePaint] = &DvgCreatePaintL; |
|
74 vgapi[EvgSetiv] = &DvgSetivL; |
|
75 vgapi[EvgClear] = &DvgClearL; |
|
76 vgapi[EvgSetfv] = &DvgSetfvL; |
|
77 vgapi[EvgRotate] = &DvgRotateL; |
|
78 vgapi[EvgCreatePath] = &DvgCreatePathL; |
|
79 vgapi[EvgCreateImage] = &DvgCreateImageL; |
|
80 vgapi[EvgGetPixels] = &DvgGetPixelsL; |
|
81 vgapi[EvgDrawImage] = &DvgDrawImageL; |
|
82 vgapi[EvgClearImage] = &DvgClearImageL; |
|
83 vgapi[EvgImageSubData] = &DvgImageSubDataL; |
|
84 vgapi[EvgDestroyImage] = &DvgDestroyImageL; |
|
85 vgapi[EvgDestroyPaint] = &DvgDestroyPaintL; |
|
86 vgapi[EvgDestroyPath] = &DvgDestroyPathL; |
|
87 vgapi[EvgPrepareToBindImage]= &DvgPrepareToBindImageL; |
|
88 vgapi[EvgBindImage] = &DvgBindImageL; |
|
89 vgapi[EvgUnBindImage] = &DvgUnBindImageL; |
|
90 vgapi[EvgFlush] = &DvgFlushL; |
|
91 |
|
92 vgGetMatrix(iUserMatrix); |
|
93 |
|
94 iNVGIconData = CNVGIconData::NewL(aBuf); |
|
95 iDataLength = aBuf.Length(); |
|
96 |
|
97 iNVGIconData->BeginRead(); |
|
98 iNVGIconData->ReadL(iNvgHeader, sizeof(iNvgHeader)); |
|
99 |
|
100 INIT_HANDLECHECKER() |
|
101 } |
|
102 |
|
103 CTLVRenderer::~CTLVRenderer() |
|
104 { |
|
105 if (iPathHandle != VG_INVALID_HANDLE) |
|
106 { |
|
107 VGDESTROYPATH(iPathHandle); |
|
108 } |
|
109 |
|
110 TInt handleListCount = iTLVVGHandleList.Count(); |
|
111 |
|
112 if (handleListCount > 0) |
|
113 { |
|
114 vgSetPaint(VG_INVALID_HANDLE, VG_FILL_PATH); |
|
115 vgSetPaint(VG_INVALID_HANDLE, VG_STROKE_PATH); |
|
116 } |
|
117 |
|
118 for (TInt i = 0; i < handleListCount; i++) |
|
119 { |
|
120 if (iTLVVGHandleList[i].iVGHandle) |
|
121 { |
|
122 switch (iTLVVGHandleList[i].iHandleType) |
|
123 { |
|
124 case TLVVGHandlePair::EVGPATH: |
|
125 VGDESTROYPATH(iTLVVGHandleList[i].iVGHandle); |
|
126 break; |
|
127 case TLVVGHandlePair::EVGPAINT: |
|
128 VGDESTROYPAINT(iTLVVGHandleList[i].iVGHandle); |
|
129 break; |
|
130 case TLVVGHandlePair::EVGIMAGE: |
|
131 VGDESTROYIMAGE(iTLVVGHandleList[i].iVGHandle); |
|
132 break; |
|
133 } |
|
134 } |
|
135 } |
|
136 |
|
137 iTLVVGHandleList.Close(); |
|
138 if (iNVGIconData) |
|
139 { |
|
140 iNVGIconData->EndRead(); |
|
141 delete iNVGIconData; |
|
142 } |
|
143 ASSERT_HANDLE_COUNT() |
|
144 } |
|
145 |
|
146 void CTLVRenderer::DvgSetiL() |
|
147 { |
|
148 TUint16 type; |
|
149 TUint16 value; |
|
150 type = iNVGIconData->ReadInt16L(); |
|
151 value = iNVGIconData->ReadInt16L(); |
|
152 |
|
153 //if ((VGParamType)LargVGParam_value != VG_SCISSORING) |
|
154 { |
|
155 vgSeti((VGParamType)type, value); |
|
156 } |
|
157 |
|
158 NVG_DEBUGSTMT(LogvgSeti((VGParamType)type, value)); |
|
159 } |
|
160 |
|
161 void CTLVRenderer::DvgSetfL() |
|
162 { |
|
163 TUint16 type = iNVGIconData->ReadInt16L(); |
|
164 VGfloat value = iNVGIconData->ReadReal32L(); |
|
165 |
|
166 vgSetf((VGParamType)type, value); |
|
167 |
|
168 NVG_DEBUGSTMT(LogvgSetf((VGParamType)type, value)); |
|
169 } |
|
170 |
|
171 void CTLVRenderer::DvgSetParameteriL() |
|
172 { |
|
173 TUint handle; |
|
174 TUint16 type; |
|
175 TUint16 value; |
|
176 |
|
177 handle = iNVGIconData->ReadInt32L(); |
|
178 type = iNVGIconData->ReadInt16L(); |
|
179 value = iNVGIconData->ReadInt16L(); |
|
180 |
|
181 vgSetParameteri(GetHandleL(handle), type, value); |
|
182 |
|
183 NVG_DEBUGSTMT(LogvgSetParameteri(GetHandleL(handle), type, value, handle)); |
|
184 } |
|
185 |
|
186 void CTLVRenderer::DvgSetParameterfL() |
|
187 { |
|
188 TUint handle = iNVGIconData->ReadInt32L(); |
|
189 TUint16 type = iNVGIconData->ReadInt16L(); |
|
190 TUint32 value = iNVGIconData->ReadReal32L(); |
|
191 |
|
192 |
|
193 vgSetParameterf(GetHandleL(handle), type, value); |
|
194 |
|
195 NVG_DEBUGP4("vgSetParameterf(%d, %d, %d);\n", handle, type, value); |
|
196 } |
|
197 |
|
198 void CTLVRenderer::DvgSetParameterfvL() |
|
199 { |
|
200 TUint handle = iNVGIconData->ReadInt32L(); |
|
201 TUint16 type = iNVGIconData->ReadInt16L(); |
|
202 float * value; |
|
203 TUint32 count = iNVGIconData->ReadInt32L(); |
|
204 |
|
205 value = new (ELeave) float[count]; |
|
206 CleanupStack::PushL(TCleanupItem(CleanupArray, value)); |
|
207 |
|
208 for(int i=0; i<count; i++) |
|
209 { |
|
210 value[i] = iNVGIconData->ReadReal32L(); |
|
211 } |
|
212 |
|
213 vgSetParameterfv(GetHandleL(handle), type, count, value); |
|
214 |
|
215 NVG_DEBUGSTMT(LogvgSetParameterfv(GetHandle(handle), type, count, value)); |
|
216 CleanupStack::PopAndDestroy(); |
|
217 } |
|
218 |
|
219 void CTLVRenderer::DvgSetColorL() |
|
220 { |
|
221 |
|
222 TUint paintvalue = iNVGIconData->ReadInt32L(); |
|
223 TUint32 rgba = iNVGIconData->ReadInt32L(); |
|
224 |
|
225 vgSetColor(GetHandleL(paintvalue), rgba); |
|
226 |
|
227 NVG_DEBUGP6("vgSetColor(%d, ((%d << 24) | (%d << 16) | (%d << 8) | %d));\n", GetHandleL(paintvalue), (rgba & 0xFF000000) >> 24, (rgba & 0x00FF0000) >> 16, |
|
228 (rgba & 0x0000FF00) >> 8, (rgba & 0x000000FF)); |
|
229 } |
|
230 |
|
231 void CTLVRenderer::DvgSetPaintL() |
|
232 { |
|
233 TUint paintvalue = iNVGIconData->ReadInt32L(); |
|
234 TUint8 value = iNVGIconData->ReadInt8L(); |
|
235 |
|
236 vgSetPaint(GetHandleL(paintvalue), value); |
|
237 |
|
238 NVG_DEBUGSTMT(LogvgSetPaint(GetHandleL(paintvalue), value, paintvalue)); |
|
239 } |
|
240 |
|
241 TPoint CTLVRenderer::GetTranslatedPoint(VGfloat aTRMatrix[9], TPoint aPoint) |
|
242 { |
|
243 TPoint trPoint; |
|
244 |
|
245 trPoint.iX = aTRMatrix[0] * aPoint.iX + aTRMatrix[3] * aPoint.iY + aTRMatrix[6]; |
|
246 trPoint.iY = aTRMatrix[1] * aPoint.iX + aTRMatrix[4] * aPoint.iY + aTRMatrix[7]; |
|
247 |
|
248 return trPoint; |
|
249 } |
|
250 |
|
251 VGfloat CTLVRenderer::MinVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4 ) |
|
252 { |
|
253 VGfloat min = x1; |
|
254 |
|
255 if (min > x2) |
|
256 { |
|
257 min = x2; |
|
258 } |
|
259 if (min > x3) |
|
260 { |
|
261 min = x3; |
|
262 } |
|
263 if (min > x4) |
|
264 { |
|
265 min = x4; |
|
266 } |
|
267 |
|
268 return min; |
|
269 } |
|
270 |
|
271 VGfloat CTLVRenderer::MaxVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4 ) |
|
272 { |
|
273 VGfloat max = x1; |
|
274 |
|
275 if (max < x2) |
|
276 { |
|
277 max = x2; |
|
278 } |
|
279 if (max < x3) |
|
280 { |
|
281 max = x3; |
|
282 } |
|
283 if (max < x4) |
|
284 { |
|
285 max = x4; |
|
286 } |
|
287 |
|
288 return max; |
|
289 } |
|
290 |
|
291 void CTLVRenderer::DvgSetivL() |
|
292 { |
|
293 TUint16 type = iNVGIconData->ReadInt16L(); |
|
294 TUint16 count = iNVGIconData->ReadInt16L(); |
|
295 VGint * value; |
|
296 |
|
297 value = new (ELeave) VGint[count]; |
|
298 CleanupStack::PushL(TCleanupItem(CleanupArray, value)); |
|
299 |
|
300 for(int i = 0; i < count; i++) |
|
301 { |
|
302 value[i] = iNVGIconData->ReadInt32L(); |
|
303 } |
|
304 |
|
305 if (type == VG_SCISSOR_RECTS) |
|
306 { |
|
307 VGfloat * matrix = iUserMatrix; |
|
308 |
|
309 // calculate the rectangle with respect to the transformation applied |
|
310 for(int i = 0; i < count; i += 4) |
|
311 { |
|
312 TInt sx = i + 0; |
|
313 TInt sy = i + 1; |
|
314 TInt sw = i + 2; |
|
315 TInt sh = i + 3; |
|
316 |
|
317 TPoint leftBottom = GetTranslatedPoint(matrix, |
|
318 TPoint(value[sx], value[sy])); |
|
319 TPoint leftTop = GetTranslatedPoint(matrix, |
|
320 TPoint(value[sx], value[sy] + value[sh])); |
|
321 TPoint rightBottom = GetTranslatedPoint(matrix, |
|
322 TPoint(value[sx] + value[sw], value[sy])); |
|
323 TPoint rightTop = GetTranslatedPoint(matrix, |
|
324 TPoint(value[sx] + value[sw], value[sy] + value[sh])); |
|
325 |
|
326 |
|
327 VGfloat minX = leftBottom.iX; |
|
328 VGfloat minY = leftBottom.iY; |
|
329 VGfloat maxX = leftBottom.iX; |
|
330 VGfloat maxY = leftBottom.iY; |
|
331 |
|
332 minX = MinVal4(leftBottom.iX, leftTop.iX, rightBottom.iX, rightTop.iX); |
|
333 minY = MinVal4(leftBottom.iY, leftTop.iY, rightBottom.iY, rightTop.iY); |
|
334 |
|
335 maxX = MaxVal4(leftBottom.iX, leftTop.iX, rightBottom.iX, rightTop.iX); |
|
336 maxY = MaxVal4(leftBottom.iY, leftTop.iY, rightBottom.iY, rightTop.iY); |
|
337 |
|
338 VGfloat newW = maxX - minX; |
|
339 VGfloat newH = maxY - minY; |
|
340 |
|
341 value[sx] = minX; |
|
342 value[sy] = minY; |
|
343 value[sw] = newW; |
|
344 value[sh] = newH; |
|
345 |
|
346 /* |
|
347 if (newW > iTargetWidth) |
|
348 { |
|
349 newW = iTargetWidth; |
|
350 } |
|
351 if (newH > iTargetHeight) |
|
352 { |
|
353 newH = iTargetHeight; |
|
354 } |
|
355 */ |
|
356 } |
|
357 } |
|
358 |
|
359 vgSetiv((VGParamType)type, count, value); |
|
360 |
|
361 NVG_DEBUGSTMT(LogvgSetXv((VGParamType)type, count, 'i', value)); |
|
362 CleanupStack::PopAndDestroy(); |
|
363 } |
|
364 |
|
365 void CTLVRenderer::DvgLoadMatrixL() |
|
366 { |
|
367 VGfloat matrix[9]; |
|
368 for(int i=0;i<9;i++) |
|
369 { |
|
370 matrix[i] = iNVGIconData->ReadReal32L(); |
|
371 } |
|
372 // keep the caller's matrix as base |
|
373 TInt matrixMode = vgGeti(VG_MATRIX_MODE); |
|
374 |
|
375 if (matrixMode == VG_MATRIX_PATH_USER_TO_SURFACE || |
|
376 matrixMode == VG_MATRIX_IMAGE_USER_TO_SURFACE /* need to check?*/) |
|
377 { |
|
378 vgLoadMatrix(iUserMatrix); |
|
379 vgMultMatrix(matrix); |
|
380 } |
|
381 else |
|
382 { |
|
383 vgLoadMatrix(matrix); |
|
384 } |
|
385 |
|
386 #ifdef NVG_DEBUG |
|
387 int matrixCount = clock() % 1000; |
|
388 NVG_DEBUGP2("VGfloat ldMatrix%d[] = {", matrixCount); |
|
389 |
|
390 NVG_DEBUGP4(" %f, %f, %f, ", matrix[0], matrix[1], matrix[2]); |
|
391 NVG_DEBUGP4(" %f, %f, %f, ", matrix[3], matrix[4], matrix[5]); |
|
392 NVG_DEBUGP4(" %f, %f, %f};\n", matrix[6], matrix[7], matrix[8]); |
|
393 |
|
394 NVG_DEBUGP2("vgLoadMatrix(ldMatrix%d);\n", matrixCount); |
|
395 #endif |
|
396 } |
|
397 |
|
398 void CTLVRenderer::DvgMultMatrixL() |
|
399 { |
|
400 VGfloat matrix[9]; |
|
401 for (int i = 0; i < 9; i++) |
|
402 { |
|
403 matrix[i] = iNVGIconData->ReadReal32L(); |
|
404 } |
|
405 |
|
406 vgMultMatrix(matrix); |
|
407 |
|
408 #ifdef NVG_DEBUG |
|
409 int matrixCount = clock() % 1000; |
|
410 NVG_DEBUGP2("VGfloat mlMatrix%d[] = {", ++matrixCount); |
|
411 |
|
412 NVG_DEBUGP1("VGfloat matrix[] = {"); |
|
413 NVG_DEBUGP4(" %f, %f, %f, ", matrix[0], matrix[1], matrix[2]); |
|
414 NVG_DEBUGP4(" %f, %f, %f, ", matrix[3], matrix[4], matrix[5]); |
|
415 NVG_DEBUGP4(" %f, %f, %f};\n", matrix[6], matrix[7], matrix[8]); |
|
416 |
|
417 NVG_DEBUGP2("vgMultMatrix(mlMatrix%d);\n", matrixCount); |
|
418 #endif |
|
419 } |
|
420 |
|
421 void CTLVRenderer::DvgLoadIdentityL() |
|
422 { |
|
423 if (vgGeti(VG_MATRIX_MODE) == (VGint)VG_MATRIX_IMAGE_USER_TO_SURFACE) |
|
424 { |
|
425 vgLoadIdentity(); |
|
426 } |
|
427 NVG_DEBUGP1("vgLoadIdentity();\n"); |
|
428 } |
|
429 |
|
430 void CTLVRenderer::DvgScaleL() |
|
431 { |
|
432 VGfloat sx = iNVGIconData->ReadReal32L(); |
|
433 VGfloat sy = iNVGIconData->ReadReal32L(); |
|
434 vgScale(sx, sy); |
|
435 |
|
436 NVG_DEBUGP3("vgScale(%f, %f);\n", sx, sy); |
|
437 } |
|
438 |
|
439 void CTLVRenderer::DvgTranslateL() |
|
440 { |
|
441 VGfloat tx = iNVGIconData->ReadReal32L(); |
|
442 VGfloat ty = iNVGIconData->ReadReal32L(); |
|
443 |
|
444 vgTranslate(tx, ty); |
|
445 |
|
446 NVG_DEBUGP3("vgTranslate(%f, %f);\n", tx, ty); |
|
447 } |
|
448 |
|
449 void CTLVRenderer::DvgAppendPathDataL() |
|
450 { |
|
451 TUint16 numSegments; |
|
452 TUint16 coordinatecount; |
|
453 VGubyte * pathSegments; |
|
454 VGubyte * segmenthandle; |
|
455 TFloatFixPt * pathData; |
|
456 TFloatFixPt * coordhandle; |
|
457 |
|
458 iNVGIconData->ReadInt32L(); |
|
459 numSegments = iNVGIconData->ReadInt16L(); |
|
460 |
|
461 pathSegments = new (ELeave) VGubyte[numSegments]; |
|
462 CleanupStack::PushL(TCleanupItem(CleanupArray, pathSegments)); |
|
463 |
|
464 segmenthandle = pathSegments; |
|
465 for(int j=0;j<numSegments;j++, segmenthandle++) |
|
466 { |
|
467 *segmenthandle = iNVGIconData->ReadInt8L(); |
|
468 } |
|
469 |
|
470 coordinatecount = iNVGIconData->ReadInt16L(); |
|
471 pathData = new (ELeave) TFloatFixPt[coordinatecount]; |
|
472 CleanupStack::PushL(TCleanupItem(CleanupTFloatFixArray, pathData)); |
|
473 |
|
474 TInt lFloatFixVal = 0; |
|
475 coordhandle= pathData; |
|
476 for(int i=0;i<coordinatecount;i++, coordhandle++) |
|
477 { |
|
478 lFloatFixVal = iNVGIconData->ReadInt32L(); |
|
479 coordhandle->copyfloatfix(lFloatFixVal); |
|
480 } |
|
481 |
|
482 vgAppendPathData(iPathHandle, numSegments, pathSegments, pathData); |
|
483 |
|
484 NVG_DEBUGP3("vgAppendPathData((VGPath)%d, (SENGMENTS)%d);\n", iPathHandle, numSegments); |
|
485 |
|
486 CleanupStack::PopAndDestroy(); |
|
487 CleanupStack::PopAndDestroy(); |
|
488 } |
|
489 |
|
490 void CTLVRenderer::DvgDrawPathL() |
|
491 { |
|
492 TUint16 value; |
|
493 |
|
494 iNVGIconData->ReadInt32L(); |
|
495 value = iNVGIconData->ReadInt16L(); |
|
496 |
|
497 vgDrawPath(iPathHandle, value); |
|
498 vgClearPath(iPathHandle, VG_PATH_CAPABILITY_APPEND_TO); |
|
499 |
|
500 NVG_DEBUGSTMT(LogvgDrawPath(iPathHandle, value)); |
|
501 } |
|
502 |
|
503 void CTLVRenderer::DvgClearPathL() |
|
504 { |
|
505 TUint16 value; |
|
506 |
|
507 iNVGIconData->ReadInt32L(); |
|
508 value = iNVGIconData->ReadInt16L(); |
|
509 |
|
510 vgClearPath(iPathHandle, value); |
|
511 NVG_DEBUGP1("vgClearPath();\n"); |
|
512 } |
|
513 |
|
514 void CTLVRenderer::DvgCreatePaintL() |
|
515 { |
|
516 TUint encodedHandle = iNVGIconData->ReadInt32L(); |
|
517 |
|
518 VGPaint paintH = VGCREATEPAINT(); |
|
519 if (paintH == VG_INVALID_HANDLE) |
|
520 { |
|
521 User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError())); |
|
522 } |
|
523 |
|
524 TInt error = iTLVVGHandleList.Append(TLVVGHandlePair(paintH, encodedHandle, TLVVGHandlePair::EVGPAINT)); |
|
525 if (error != KErrNone) |
|
526 { |
|
527 VGDESTROYPAINT(paintH); |
|
528 User::Leave(error); |
|
529 } |
|
530 |
|
531 NVG_DEBUGP2("%d = vgCreatePaint();\n", GetHandleL(encodedHandle)); |
|
532 } |
|
533 |
|
534 void CTLVRenderer::DvguRectL() |
|
535 { |
|
536 |
|
537 TReal32 x; |
|
538 TReal32 y; |
|
539 TReal32 width; |
|
540 TReal32 height; |
|
541 |
|
542 iNVGIconData->ReadInt32L(); |
|
543 |
|
544 x = iNVGIconData->ReadReal32L(); |
|
545 y = iNVGIconData->ReadReal32L(); |
|
546 |
|
547 width = iNVGIconData->ReadReal32L(); |
|
548 height = iNVGIconData->ReadReal32L(); |
|
549 |
|
550 vguRect(iPathHandle, x, y, width, height); |
|
551 |
|
552 NVG_DEBUGP6("vguRect(%d, %f, %f, %f, %f);\n", iPathHandle, x, y, width, height); |
|
553 |
|
554 //##########workaround for graphics library which doesnt support vgu libraries:Start######## |
|
555 /* |
|
556 const VGubyte pathSegments[] = |
|
557 { |
|
558 VG_MOVE_TO_ABS, VG_HLINE_TO_REL, |
|
559 VG_VLINE_TO_REL, VG_HLINE_TO_REL, |
|
560 VG_CLOSE_PATH |
|
561 }; |
|
562 TFloatFixPt dataff[5]; |
|
563 |
|
564 dataff[0]=x; |
|
565 dataff[1]= y; |
|
566 dataff[2]= width; |
|
567 dataff[3]= height; |
|
568 dataff[4]= -width; |
|
569 |
|
570 TInt32 numCommands = sizeof(pathSegments)/sizeof(pathSegments[0]); |
|
571 vgAppendPathData(iPathHandle, numCommands, pathSegments, dataff); |
|
572 */ |
|
573 //##########workaround for graphics library which doesnt support vgu libraries:End######## |
|
574 } |
|
575 |
|
576 void CTLVRenderer::DvguEllipseL() |
|
577 { |
|
578 TReal32 cx; |
|
579 TReal32 cy; |
|
580 TReal32 width; |
|
581 TReal32 height; |
|
582 |
|
583 iNVGIconData->ReadInt32L(); |
|
584 |
|
585 cx = iNVGIconData->ReadReal32L(); |
|
586 cy = iNVGIconData->ReadReal32L(); |
|
587 |
|
588 width = iNVGIconData->ReadReal32L(); |
|
589 height = iNVGIconData->ReadReal32L(); |
|
590 |
|
591 vguEllipse(iPathHandle, cx, cy, width, height); |
|
592 |
|
593 NVG_DEBUGP6("vguEllipse(%d, %f, %f, %f, %f);\n",iPathHandle, cx, cy, width, height); |
|
594 |
|
595 //##########workaround for graphics library which doesnt support vgu libraries:Start######## |
|
596 /* |
|
597 { |
|
598 const VGubyte pathSegments[] = |
|
599 { |
|
600 VG_MOVE_TO_ABS, |
|
601 VG_SCCWARC_TO_REL, |
|
602 VG_SCCWARC_TO_REL, |
|
603 VG_CLOSE_PATH |
|
604 }; |
|
605 |
|
606 VGfloat widthDiv2 = width / 2; |
|
607 VGfloat heightDiv2 = height / 2; |
|
608 |
|
609 TFloatFixPt data[12]; |
|
610 data[0] = cx + widthDiv2; |
|
611 data[1] = cy; |
|
612 data[2] = widthDiv2; |
|
613 data[3] = heightDiv2; |
|
614 data[4] = 0; |
|
615 data[5] = -width; |
|
616 data[6] = 0; |
|
617 data[7] = widthDiv2; |
|
618 data[8] = heightDiv2; |
|
619 data[9] = 0; |
|
620 data[10] = width; |
|
621 data[11] = 0; |
|
622 |
|
623 TInt32 numCommands = sizeof(pathSegments)/sizeof(pathSegments[0]); |
|
624 |
|
625 vgAppendPathData(iPathHandle, numCommands, pathSegments, data); |
|
626 } */ |
|
627 //##########workaround for graphics library which doesnt support vgu libraries:End######## |
|
628 } |
|
629 |
|
630 void CTLVRenderer::DvguRoundRectL() |
|
631 { |
|
632 TReal32 x; |
|
633 TReal32 y; |
|
634 TReal32 width; |
|
635 TReal32 height; |
|
636 TReal32 arcWidth; |
|
637 TReal32 arcHeight; |
|
638 |
|
639 iNVGIconData->ReadInt32L(); |
|
640 |
|
641 x = iNVGIconData->ReadReal32L(); |
|
642 y = iNVGIconData->ReadReal32L(); |
|
643 |
|
644 width = iNVGIconData->ReadReal32L(); |
|
645 height= iNVGIconData->ReadReal32L(); |
|
646 |
|
647 arcWidth = iNVGIconData->ReadReal32L(); |
|
648 arcHeight= iNVGIconData->ReadReal32L(); |
|
649 |
|
650 //uncomment |
|
651 //vguRoundRect(iPathHandle, x, y, width, height, arcWidth, arcHeight); |
|
652 |
|
653 NVG_DEBUGP8("vguRoundRect(%d, %f, %f, %f, %f, %f, %f);\n", iPathHandle, x, y, width, height, arcWidth, arcHeight); |
|
654 |
|
655 //##########workaround for graphics library which doesnt support vgu libraries:Start######## |
|
656 /* commented*/ { |
|
657 if(arcWidth < 0.0f) |
|
658 arcWidth = 0.0f; |
|
659 else if(arcWidth > width) |
|
660 arcWidth = width; |
|
661 |
|
662 if(arcHeight < 0.0f) |
|
663 arcHeight = 0.0f; |
|
664 else if(arcHeight > height) |
|
665 arcHeight = height; |
|
666 |
|
667 const VGubyte pathSegments[] = |
|
668 { |
|
669 VG_MOVE_TO_ABS, VG_HLINE_TO_REL, |
|
670 VG_SCCWARC_TO_REL, VG_VLINE_TO_REL, |
|
671 VG_SCCWARC_TO_REL, VG_HLINE_TO_REL, |
|
672 VG_SCCWARC_TO_REL, VG_VLINE_TO_REL, |
|
673 VG_SCCWARC_TO_REL, VG_CLOSE_PATH |
|
674 }; |
|
675 |
|
676 VGfloat arcWidthDiv2 = arcWidth / 2; |
|
677 VGfloat arcHeightDiv2 = arcHeight / 2; |
|
678 |
|
679 TFloatFixPt data[26]; |
|
680 data[0] = (x + arcWidthDiv2); |
|
681 data[1] = y; |
|
682 data[2] = width - arcWidth; |
|
683 data[3] = arcWidthDiv2; |
|
684 data[4] = arcHeightDiv2; |
|
685 data[5] = 0; |
|
686 data[6] = arcWidthDiv2; |
|
687 data[7] = arcHeightDiv2; |
|
688 data[8] = height - arcHeight; |
|
689 data[9] = arcWidthDiv2; |
|
690 data[10] = arcHeightDiv2; |
|
691 data[11] = 0; |
|
692 data[12] = -arcWidthDiv2; |
|
693 data[13] = arcHeightDiv2; |
|
694 data[14] = -(width - arcWidth); |
|
695 data[15] = arcWidthDiv2; |
|
696 data[16] = arcHeightDiv2; |
|
697 data[17] = 0; |
|
698 data[18] = -arcWidthDiv2; |
|
699 data[19] = -arcHeightDiv2; |
|
700 data[20] = -(height - arcHeight); |
|
701 data[21] = arcWidthDiv2; |
|
702 data[22] = arcHeightDiv2; |
|
703 data[23] = 0; |
|
704 data[24] = arcWidthDiv2; |
|
705 data[25] = -arcHeightDiv2; |
|
706 |
|
707 TInt32 numCommands = sizeof(pathSegments)/sizeof(pathSegments[0]); |
|
708 |
|
709 vgAppendPathData(iPathHandle, numCommands, pathSegments, data); |
|
710 |
|
711 }/* commented */ |
|
712 //##########workaround for graphics library which doesnt support vgu libraries:End######## |
|
713 } |
|
714 |
|
715 void CTLVRenderer::DvguLineL() |
|
716 { |
|
717 TReal32 x0; |
|
718 TReal32 y0; |
|
719 TReal32 x1; |
|
720 TReal32 y1; |
|
721 |
|
722 iNVGIconData->ReadInt32L(); |
|
723 |
|
724 x0 = iNVGIconData->ReadReal32L(); |
|
725 y0 = iNVGIconData->ReadReal32L(); |
|
726 |
|
727 x1 = iNVGIconData->ReadReal32L(); |
|
728 y1 = iNVGIconData->ReadReal32L(); |
|
729 |
|
730 vguLine(iPathHandle, x0, y0, x1, y1); |
|
731 |
|
732 NVG_DEBUGP6("vguLine(%d, %f, %f, %f, %f);\n", iPathHandle, x0, y0, x1, y1); |
|
733 |
|
734 //##########workaround for graphics library which doesnt support vgu libraries:Start######## |
|
735 /* { |
|
736 const VGubyte pathSegments[] = |
|
737 { |
|
738 VG_MOVE_TO_ABS, VG_LINE_TO_ABS |
|
739 }; |
|
740 |
|
741 TFloatFixPt data[4]; |
|
742 data[0] = x0; |
|
743 data[1] = y0; |
|
744 data[2] = x1; |
|
745 data[3] = y1; |
|
746 |
|
747 TInt32 numCommands = sizeof(pathSegments)/sizeof(pathSegments[0]); |
|
748 |
|
749 vgAppendPathData(iPathHandle, numCommands, pathSegments, data); |
|
750 }*/ |
|
751 //##########workaround for graphics library which doesnt support vgu libraries:End######## |
|
752 |
|
753 } |
|
754 |
|
755 void CTLVRenderer::DvgClearL() |
|
756 { |
|
757 |
|
758 TReal32 width; |
|
759 TReal32 height; |
|
760 |
|
761 iNVGIconData->ReadReal32L(); |
|
762 iNVGIconData->ReadReal32L(); |
|
763 width = iNVGIconData->ReadReal32L(); |
|
764 height = iNVGIconData->ReadReal32L(); |
|
765 |
|
766 if (!iScaled) |
|
767 { |
|
768 VGfloat scaleX = iTargetWidth / width; |
|
769 VGfloat scaleY = iTargetHeight / height; |
|
770 vgLoadMatrix(iUserMatrix); |
|
771 vgTranslate(iTargetWidth / 2, iTargetHeight / 2); |
|
772 vgScale(scaleX, scaleY); |
|
773 vgTranslate(- width / 2, - height / 2); |
|
774 |
|
775 vgGetMatrix(iUserMatrix); |
|
776 iScaled = ETrue; |
|
777 } |
|
778 #if 0 |
|
779 // create a path and fill with color. |
|
780 VGint color = vgGeti(VG_CLEAR_COLOR); |
|
781 NVG_DEBUGP2("\nclear color %d", color); |
|
782 vgClearPath(iPathHandle, VG_PATH_CAPABILITY_APPEND_TO); |
|
783 |
|
784 const VGubyte pathSegments[] = |
|
785 { |
|
786 VG_MOVE_TO_ABS, |
|
787 VG_LINE_TO_ABS, |
|
788 VG_LINE_TO_ABS, |
|
789 VG_LINE_TO_ABS, |
|
790 VG_CLOSE_PATH |
|
791 }; |
|
792 VGfloat* coords = NULL; |
|
793 coords = new VGfloat[8]; |
|
794 coords[0] = x; |
|
795 coords[1] = y; |
|
796 coords[2] = x + width; |
|
797 coords[3] = y; |
|
798 coords[4] = x + width; |
|
799 coords[5] = y + height; |
|
800 coords[6] = x; |
|
801 coords[7] = y + height; |
|
802 |
|
803 VGint orgPaint = vgGetPaint(VG_FILL_PATH); |
|
804 VGint paint = VGCREATEPAINT(); |
|
805 vgSetPaint(paint, VG_FILL_PATH); |
|
806 vgSetColor(paint, color); |
|
807 vgAppendPathData(iPathHandle, 5, pathSegments, coords); |
|
808 |
|
809 vgDrawPath(iPathHandle, VG_FILL_PATH); |
|
810 vgClearPath(iPathHandle, VG_PATH_CAPABILITY_APPEND_TO); |
|
811 vgSetPaint(orgPaint, VG_FILL_PATH); |
|
812 VGDESTROYPAINT(paint); |
|
813 #endif |
|
814 |
|
815 NVG_DEBUGP1("vgClear();\n"); |
|
816 } |
|
817 |
|
818 void CTLVRenderer::DvgSetfvL() |
|
819 { |
|
820 TInt innerpos = 1; |
|
821 TUint16 type; |
|
822 TUint16 count; |
|
823 VGfloat * value; |
|
824 |
|
825 type = iNVGIconData->ReadInt16L(); |
|
826 count = iNVGIconData->ReadInt16L(); |
|
827 |
|
828 value = new (ELeave) VGfloat[count]; |
|
829 CleanupStack::PushL(TCleanupItem(CleanupArray, value)); |
|
830 |
|
831 for(int i=0; i<count; i++) |
|
832 { |
|
833 value[i] = iNVGIconData->ReadReal32L(); |
|
834 } |
|
835 |
|
836 innerpos = innerpos + 2*sizeof(TUint16) + count*sizeof(VGfloat); |
|
837 |
|
838 vgSetfv((VGParamType)type, count, value); |
|
839 |
|
840 NVG_DEBUGSTMT(LogvgSetXv((VGParamType)type, count, 'f', (VGint *)value)); |
|
841 |
|
842 CleanupStack::PopAndDestroy(); |
|
843 } |
|
844 |
|
845 void CTLVRenderer::DvgRotateL() |
|
846 { |
|
847 TReal32 angle; |
|
848 |
|
849 angle = iNVGIconData->ReadReal32L(); |
|
850 |
|
851 vgRotate(angle); |
|
852 |
|
853 NVG_DEBUGP2("vgRotate(%f);\n", angle); |
|
854 } |
|
855 |
|
856 void CTLVRenderer::DvgCreatePathL() |
|
857 { |
|
858 TUint32 pathFormat; |
|
859 TUint8 datatype; |
|
860 TReal32 scale; |
|
861 TReal32 bias; |
|
862 TUint32 segmentCapacityHint; |
|
863 TUint32 coordCapacityHint; |
|
864 TUint32 capabilities; |
|
865 |
|
866 pathFormat = iNVGIconData->ReadInt32L(); |
|
867 datatype = iNVGIconData->ReadInt8L(); |
|
868 |
|
869 scale = iNVGIconData->ReadReal32L(); |
|
870 bias = iNVGIconData->ReadReal32L(); |
|
871 |
|
872 segmentCapacityHint = iNVGIconData->ReadInt32L(); |
|
873 coordCapacityHint = iNVGIconData->ReadInt32L(); |
|
874 capabilities = iNVGIconData->ReadInt32L(); |
|
875 iNVGIconData->ReadInt32L(); |
|
876 |
|
877 iPathHandle = VGCREATEPATH(pathFormat, (VGPathDatatype)datatype, scale, bias, segmentCapacityHint, coordCapacityHint, |
|
878 (VGbitfield)capabilities); |
|
879 |
|
880 if (iPathHandle == VG_INVALID_HANDLE) |
|
881 { |
|
882 User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError())); |
|
883 } |
|
884 |
|
885 NVG_DEBUGP9("%d = vgCreatePath(%d, (VGPathDatatype)%d, %f, %f, %d, %d, (VGPathCapabilities)%d);\n", |
|
886 iPathHandle, pathFormat, datatype, scale, bias, segmentCapacityHint, coordCapacityHint, capabilities); |
|
887 } |
|
888 |
|
889 void CTLVRenderer::DvgCreateImageL() |
|
890 { |
|
891 TInt32 format = (VGImageFormat)iNVGIconData->ReadInt32L(); |
|
892 TInt width = (VGImageFormat)iNVGIconData->ReadInt32L(); |
|
893 TInt height = (VGImageFormat)iNVGIconData->ReadInt32L(); |
|
894 TUint8 aq = (VGImageFormat)iNVGIconData->ReadInt8L(); |
|
895 |
|
896 TInt encodedHandle = iNVGIconData->ReadInt32L(); |
|
897 VGImage image = 0; |
|
898 |
|
899 if (iPrepareToBindImage) |
|
900 { |
|
901 TPoint leftBottom = GetTranslatedPoint(iUserMatrix, TPoint(0, 0)); |
|
902 TPoint rightBottom = GetTranslatedPoint(iUserMatrix, TPoint(width, 0)); |
|
903 TPoint leftTop = GetTranslatedPoint(iUserMatrix, TPoint(0, height)); |
|
904 TPoint rightTop = GetTranslatedPoint(iUserMatrix, TPoint(width, height)); |
|
905 |
|
906 VGfloat maxX = leftBottom.iX; |
|
907 VGfloat maxY = leftBottom.iY; |
|
908 |
|
909 maxX = MaxVal4(leftBottom.iX, leftTop.iX, rightBottom.iX, rightTop.iX); |
|
910 maxY = MaxVal4(leftBottom.iY, leftTop.iY, rightBottom.iY, rightTop.iY); |
|
911 |
|
912 width = maxX - 0; |
|
913 height = maxY - 0; |
|
914 |
|
915 iPrepareToBindImage = 0; |
|
916 } |
|
917 |
|
918 image = VGCREATEIMAGE((VGImageFormat)format, |
|
919 width, height, aq); |
|
920 |
|
921 if (image == VG_INVALID_HANDLE) |
|
922 { |
|
923 User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError())); |
|
924 } |
|
925 |
|
926 TInt error = iTLVVGHandleList.Append(TLVVGHandlePair(image, encodedHandle, TLVVGHandlePair::EVGIMAGE, aq)); |
|
927 if (error != KErrNone) |
|
928 { |
|
929 VGDESTROYIMAGE(image); |
|
930 User::Leave(error); |
|
931 } |
|
932 |
|
933 NVG_DEBUGP6("%d = vgCreateImage(%d, %d, %d, %d);\n", GetHandleL(encodedHandle), format, width, height, (TInt32)aq); |
|
934 } |
|
935 |
|
936 void CTLVRenderer::DvgClearImageL() |
|
937 { |
|
938 TInt encodedImageHandle = iNVGIconData->ReadInt32L(); |
|
939 VGImage imageHandle = GetHandleL(encodedImageHandle); |
|
940 |
|
941 TInt x = iNVGIconData->ReadInt32L(); |
|
942 TInt y = iNVGIconData->ReadInt32L(); |
|
943 TInt width = iNVGIconData->ReadInt32L(); |
|
944 TInt height = iNVGIconData->ReadInt32L(); |
|
945 vgClearImage(imageHandle, x, y, width, height); |
|
946 |
|
947 NVG_DEBUGP6("vgClearImage(%d, %d, %d, %d, %d);\n", imageHandle, x, y, width, height); |
|
948 } |
|
949 |
|
950 void CTLVRenderer::DvgDrawImageL() |
|
951 { |
|
952 TInt encodedImageHandle = iNVGIconData->ReadInt32L(); |
|
953 VGImage imageHandle = GetHandleL(encodedImageHandle); |
|
954 |
|
955 vgDrawImage(imageHandle); |
|
956 |
|
957 NVG_DEBUGP2("vgDrawImage(%d);\n", imageHandle); |
|
958 } |
|
959 |
|
960 void CTLVRenderer::DvgImageSubDataL() |
|
961 { |
|
962 TInt encodedImageHandle = iNVGIconData->ReadInt32L(); |
|
963 VGImage imageHandle = GetHandleL(encodedImageHandle); |
|
964 TInt dataLength = 0; |
|
965 |
|
966 TInt dataStride = iNVGIconData->ReadInt32L(); |
|
967 TInt dataFormat = iNVGIconData->ReadInt32L(); |
|
968 TInt x = iNVGIconData->ReadInt32L(); |
|
969 TInt y = iNVGIconData->ReadInt32L(); |
|
970 TInt width = iNVGIconData->ReadInt32L(); |
|
971 TInt height = iNVGIconData->ReadInt32L(); |
|
972 |
|
973 dataLength = iNVGIconData->ReadInt32L(); |
|
974 if (dataLength) |
|
975 { |
|
976 TUint8 * data = new (ELeave) TUint8[dataLength]; |
|
977 CleanupStack::PushL(TCleanupItem(CleanupArray, data)); |
|
978 |
|
979 iNVGIconData->ReadL(data, dataLength); |
|
980 TUint8 * dataPtr; |
|
981 if (dataStride < 0) |
|
982 { |
|
983 dataPtr = data + ( height - 1 ) * (-dataStride); |
|
984 } |
|
985 else |
|
986 { |
|
987 dataPtr = data; |
|
988 } |
|
989 |
|
990 vgImageSubData(imageHandle, dataPtr, dataStride, (VGImageFormat)dataFormat, x, y, width, height); |
|
991 |
|
992 NVG_DEBUGSTMT(LogvgImageSubData(imageHandle, dataPtr, dataLength, dataStride, (VGImageFormat)dataFormat, x, y, width, height)); |
|
993 CleanupStack::PopAndDestroy(); |
|
994 } |
|
995 else |
|
996 { |
|
997 User::Leave(KErrCorrupt); |
|
998 } |
|
999 } |
|
1000 |
|
1001 void CTLVRenderer::DvgGetPixelsL() |
|
1002 { |
|
1003 //not used in SVGEngine |
|
1004 } |
|
1005 |
|
1006 void CTLVRenderer::DvgDestroyImageL() |
|
1007 { |
|
1008 VGImage imageHandle = RemoveHandleL(iNVGIconData->ReadInt32L()); |
|
1009 VGDESTROYIMAGE(imageHandle); |
|
1010 NVG_DEBUGP2("vgDestroyImage(%d);\n", imageHandle); |
|
1011 } |
|
1012 |
|
1013 void CTLVRenderer::DvgDestroyPaintL() |
|
1014 { |
|
1015 TInt paint = iNVGIconData->ReadInt32L(); |
|
1016 VGDESTROYPAINT(RemoveHandleL(paint)); |
|
1017 NVG_DEBUGP2("vgDestroyPaint(%d);\n", GetHandleL(paint)); |
|
1018 } |
|
1019 |
|
1020 void CTLVRenderer::DvgDestroyPathL() |
|
1021 { |
|
1022 // only one path handle is maintained, which is a member variable |
|
1023 NVG_DEBUGP2("vgDestroyPath(%d);\n", iPathHandle); |
|
1024 } |
|
1025 |
|
1026 void CTLVRenderer::DvgFlushL() |
|
1027 { |
|
1028 //no need to implement? |
|
1029 NVG_DEBUGP1("vgFlush();\n"); |
|
1030 } |
|
1031 |
|
1032 TInt CTLVRenderer::ExecuteL(TInt aIndex) |
|
1033 { |
|
1034 if (0 <= aIndex && aIndex < EvgFlush + 1) |
|
1035 { |
|
1036 (this->*(vgapi[aIndex]))(); |
|
1037 } |
|
1038 else |
|
1039 { |
|
1040 return KErrCorrupt; |
|
1041 } |
|
1042 |
|
1043 return KErrNone; |
|
1044 } |
|
1045 |
|
1046 TInt CTLVRenderer::ExecuteL() |
|
1047 { |
|
1048 TInt error = KErrNone; |
|
1049 |
|
1050 NVG_DEBUGP1("TLV rendering starts"); |
|
1051 |
|
1052 while (!iNVGIconData->EOF()) |
|
1053 { |
|
1054 error = ExecuteL(iNVGIconData->ReadInt8L()); |
|
1055 if (error != KErrNone) |
|
1056 { |
|
1057 break; |
|
1058 } |
|
1059 } |
|
1060 |
|
1061 NVG_DEBUGP1("TLV rendering ends"); |
|
1062 |
|
1063 return error; |
|
1064 } |
|
1065 |
|
1066 void CTLVRenderer::GetHandlePair(int aIndex, TLVVGHandlePair & aPair) |
|
1067 { |
|
1068 TInt handleListCount = iTLVVGHandleList.Count(); |
|
1069 |
|
1070 for (TInt i = 0; i < handleListCount; i++) |
|
1071 { |
|
1072 if (iTLVVGHandleList[i].iTLVHandle == aIndex) |
|
1073 { |
|
1074 aPair = iTLVVGHandleList[i]; |
|
1075 break; |
|
1076 } |
|
1077 } |
|
1078 } |
|
1079 |
|
1080 VGHandle CTLVRenderer::RemoveHandleL(int aIndex) |
|
1081 { |
|
1082 TInt handleListCount = iTLVVGHandleList.Count(); |
|
1083 VGHandle handle = 0; |
|
1084 |
|
1085 for (TInt i = 0; i < handleListCount; i++) |
|
1086 { |
|
1087 if (iTLVVGHandleList[i].iTLVHandle == aIndex) |
|
1088 { |
|
1089 handle = iTLVVGHandleList[i].iVGHandle; |
|
1090 iTLVVGHandleList.Remove(i); |
|
1091 break; |
|
1092 } |
|
1093 } |
|
1094 |
|
1095 if (!handle) |
|
1096 { |
|
1097 User::Leave(KErrCorrupt); |
|
1098 } |
|
1099 return handle; |
|
1100 } |
|
1101 |
|
1102 VGHandle CTLVRenderer::GetHandleL(int aIndex) |
|
1103 { |
|
1104 VGHandle handle = GetHandle(aIndex); |
|
1105 |
|
1106 if (!handle) |
|
1107 { |
|
1108 User::Leave(KErrCorrupt); |
|
1109 } |
|
1110 return handle; |
|
1111 } |
|
1112 |
|
1113 VGHandle CTLVRenderer::GetHandle(int aIndex) |
|
1114 { |
|
1115 TInt handleListCount = iTLVVGHandleList.Count(); |
|
1116 VGHandle handle = 0; |
|
1117 |
|
1118 for (TInt i = 0; i < handleListCount; i++) |
|
1119 { |
|
1120 if (iTLVVGHandleList[i].iTLVHandle == aIndex) |
|
1121 { |
|
1122 handle = iTLVVGHandleList[i].iVGHandle; |
|
1123 break; |
|
1124 } |
|
1125 } |
|
1126 return handle; |
|
1127 } |
|
1128 |
|
1129 void CTLVRenderer::SetHandle(int aIndex, VGHandle aHandle) |
|
1130 { |
|
1131 TInt handleListCount = iTLVVGHandleList.Count(); |
|
1132 |
|
1133 for (TInt i = 0; i < handleListCount; i++) |
|
1134 { |
|
1135 if (iTLVVGHandleList[i].iTLVHandle == aIndex) |
|
1136 { |
|
1137 iTLVVGHandleList[i].iVGHandle = aHandle; |
|
1138 break; |
|
1139 } |
|
1140 } |
|
1141 } |
|
1142 |
|
1143 void CTLVRenderer::DvgPrepareToBindImageL() |
|
1144 { |
|
1145 iPrepareToBindImage = 1; |
|
1146 NVG_DEBUGP1("vgPrepareToBindImage();\n"); |
|
1147 } |
|
1148 |
|
1149 void CTLVRenderer::DvgBindImageL() |
|
1150 { |
|
1151 iPrepareToBindImage = 0; |
|
1152 |
|
1153 TInt imageHandle = iNVGIconData->ReadInt32L(); |
|
1154 |
|
1155 if (iVGImageBinder) |
|
1156 { |
|
1157 iVGImageBinder->BindClientBuffer((VGHandle)GetHandleL(imageHandle)); |
|
1158 } |
|
1159 NVG_DEBUGP2("vgBindImage(%d);\n", imageHandle); |
|
1160 } |
|
1161 |
|
1162 void CTLVRenderer::DvgUnBindImageL() |
|
1163 { |
|
1164 if (iVGImageBinder) |
|
1165 { |
|
1166 iVGImageBinder->UnBindClientBuffer(); |
|
1167 } |
|
1168 NVG_DEBUGP1("vgUnBindImage();\n"); |
|
1169 } |
|
1170 |
|
1171 #ifdef NVG_DEBUG |
|
1172 void CTLVRenderer::LogvgSetf(VGParamType type, VGfloat value) |
|
1173 { |
|
1174 RDebug::Print(_L("vgSetf(")); |
|
1175 switch(type) |
|
1176 { |
|
1177 case VG_STROKE_LINE_WIDTH: |
|
1178 { |
|
1179 RDebug::Print(_L("VG_STROKE_LINE_WIDTH")); |
|
1180 } |
|
1181 break; |
|
1182 case VG_STROKE_MITER_LIMIT: |
|
1183 { |
|
1184 RDebug::Print(_L("VG_STROKE_MITER_LIMIT")); |
|
1185 } |
|
1186 break; |
|
1187 case VG_STROKE_DASH_PHASE: |
|
1188 { |
|
1189 RDebug::Print(_L("VG_STROKE_DASH_PHASE")); |
|
1190 } |
|
1191 break; |
|
1192 |
|
1193 case VG_MATRIX_MODE: |
|
1194 { |
|
1195 RDebug::Print(_L("VG_MATRIX_MODE")); |
|
1196 } |
|
1197 break; |
|
1198 case VG_FILL_RULE: |
|
1199 { |
|
1200 RDebug::Print(_L("VG_FILL_RULE")); |
|
1201 } |
|
1202 break; |
|
1203 case VG_IMAGE_QUALITY: |
|
1204 { |
|
1205 RDebug::Print(_L("VG_IMAGE_QUALITY")); |
|
1206 } |
|
1207 break; |
|
1208 case VG_IMAGE_MODE: |
|
1209 { |
|
1210 RDebug::Print(_L("VG_IMAGE_MODE")); |
|
1211 } |
|
1212 break; |
|
1213 case VG_RENDERING_QUALITY: |
|
1214 { |
|
1215 RDebug::Print(_L("VG_RENDERING_QUALITY")); |
|
1216 } |
|
1217 break; |
|
1218 case VG_BLEND_MODE: |
|
1219 { |
|
1220 RDebug::Print(_L("VG_BLEND_MODE")); |
|
1221 } |
|
1222 break; |
|
1223 case VG_MASKING: |
|
1224 { |
|
1225 RDebug::Print(_L("VG_MASKING")); |
|
1226 } |
|
1227 break; |
|
1228 case VG_SCISSORING: |
|
1229 { |
|
1230 RDebug::Print(_L("VG_SCISSORING")); |
|
1231 } |
|
1232 break; |
|
1233 case VG_PIXEL_LAYOUT: |
|
1234 { |
|
1235 RDebug::Print(_L("VG_PIXEL_LAYOUT")); |
|
1236 } |
|
1237 break; |
|
1238 case VG_FILTER_FORMAT_LINEAR: |
|
1239 { |
|
1240 RDebug::Print(_L("VG_FILTER_FORMAT_LINEAR")); |
|
1241 } |
|
1242 break; |
|
1243 case VG_FILTER_FORMAT_PREMULTIPLIED: |
|
1244 { |
|
1245 RDebug::Print(_L("VG_FILTER_FORMAT_PREMULTIPLIED")); |
|
1246 } |
|
1247 break; |
|
1248 case VG_FILTER_CHANNEL_MASK: |
|
1249 { |
|
1250 RDebug::Print(_L("VG_FILTER_CHANNEL_MASK")); |
|
1251 } |
|
1252 break; |
|
1253 case VG_STROKE_CAP_STYLE: |
|
1254 { |
|
1255 RDebug::Print(_L("VG_STROKE_CAP_STYLE")); |
|
1256 } |
|
1257 break; |
|
1258 case VG_STROKE_JOIN_STYLE: |
|
1259 { |
|
1260 RDebug::Print(_L("VG_STROKE_JOIN_STYLE")); |
|
1261 } |
|
1262 break; |
|
1263 case VG_STROKE_DASH_PHASE_RESET: |
|
1264 { |
|
1265 RDebug::Print(_L("VG_STROKE_DASH_PHASE_RESET")); |
|
1266 } |
|
1267 break; |
|
1268 /* Implementation limits (read-only) */ |
|
1269 case VG_SCREEN_LAYOUT: |
|
1270 { |
|
1271 RDebug::Print(_L("VG_SCREEN_LAYOUT")); |
|
1272 } |
|
1273 break; |
|
1274 case VG_MAX_SCISSOR_RECTS: |
|
1275 { |
|
1276 RDebug::Print(_L("VG_MAX_SCISSOR_RECTS")); |
|
1277 } |
|
1278 break; |
|
1279 case VG_MAX_DASH_COUNT: |
|
1280 { |
|
1281 RDebug::Print(_L("VG_MAX_DASH_COUNT")); |
|
1282 } |
|
1283 break; |
|
1284 case VG_MAX_KERNEL_SIZE: |
|
1285 { |
|
1286 RDebug::Print(_L("VG_MAX_KERNEL_SIZE")); |
|
1287 } |
|
1288 break; |
|
1289 case VG_MAX_SEPARABLE_KERNEL_SIZE: |
|
1290 { |
|
1291 RDebug::Print(_L("VG_MAX_SEPARABLE_KERNEL_SIZE")); |
|
1292 } |
|
1293 break; |
|
1294 case VG_MAX_COLOR_RAMP_STOPS: |
|
1295 { |
|
1296 RDebug::Print(_L("VG_MAX_COLOR_RAMP_STOPS")); |
|
1297 } |
|
1298 break; |
|
1299 case VG_MAX_IMAGE_WIDTH: |
|
1300 { |
|
1301 RDebug::Print(_L("VG_MAX_IMAGE_WIDTH")); |
|
1302 } |
|
1303 break; |
|
1304 case VG_MAX_IMAGE_HEIGHT: |
|
1305 { |
|
1306 RDebug::Print(_L("VG_MAX_IMAGE_HEIGHT")); |
|
1307 } |
|
1308 break; |
|
1309 case VG_MAX_IMAGE_PIXELS: |
|
1310 { |
|
1311 RDebug::Print(_L("VG_MAX_IMAGE_PIXELS")); |
|
1312 } |
|
1313 break; |
|
1314 case VG_MAX_IMAGE_BYTES: |
|
1315 { |
|
1316 RDebug::Print(_L("VG_MAX_IMAGE_BYTES")); |
|
1317 } |
|
1318 break; |
|
1319 case VG_MAX_FLOAT: |
|
1320 { |
|
1321 RDebug::Print(_L("VG_MAX_FLOAT")); |
|
1322 } |
|
1323 break; |
|
1324 case VG_MAX_GAUSSIAN_STD_DEVIATION: |
|
1325 { |
|
1326 RDebug::Print(_L("VG_MAX_GAUSSIAN_STD_DEVIATION")); |
|
1327 } |
|
1328 break; |
|
1329 |
|
1330 default: |
|
1331 { |
|
1332 RDebug::Print(_L("%d"), type); |
|
1333 } |
|
1334 break; |
|
1335 }; |
|
1336 |
|
1337 RDebug::Print(_L(", ")); |
|
1338 RDebug::Print(_L("%f"), value); |
|
1339 RDebug::Print(_L(");\n")); |
|
1340 return; |
|
1341 } |
|
1342 |
|
1343 void CTLVRenderer::LogvgSeti (VGParamType type, VGint value) |
|
1344 { |
|
1345 RDebug::Print(_L("vgSeti(")); |
|
1346 |
|
1347 switch(type) |
|
1348 { |
|
1349 case VG_STROKE_LINE_WIDTH: |
|
1350 { |
|
1351 RDebug::Print(_L("VG_STROKE_LINE_WIDTH")); |
|
1352 } |
|
1353 break; |
|
1354 case VG_STROKE_MITER_LIMIT: |
|
1355 { |
|
1356 RDebug::Print(_L("VG_STROKE_MITER_LIMIT")); |
|
1357 } |
|
1358 break; |
|
1359 case VG_STROKE_DASH_PHASE: |
|
1360 { |
|
1361 RDebug::Print(_L("VG_STROKE_DASH_PHASE")); |
|
1362 } |
|
1363 break; |
|
1364 |
|
1365 case VG_MATRIX_MODE: |
|
1366 { |
|
1367 RDebug::Print(_L("VG_MATRIX_MODE")); |
|
1368 } |
|
1369 break; |
|
1370 case VG_FILL_RULE: |
|
1371 { |
|
1372 RDebug::Print(_L("VG_FILL_RULE")); |
|
1373 } |
|
1374 break; |
|
1375 case VG_IMAGE_QUALITY: |
|
1376 { |
|
1377 RDebug::Print(_L("VG_IMAGE_QUALITY")); |
|
1378 } |
|
1379 break; |
|
1380 case VG_IMAGE_MODE: |
|
1381 { |
|
1382 RDebug::Print(_L("VG_IMAGE_MODE")); |
|
1383 } |
|
1384 break; |
|
1385 case VG_RENDERING_QUALITY: |
|
1386 { |
|
1387 RDebug::Print(_L("VG_RENDERING_QUALITY")); |
|
1388 } |
|
1389 break; |
|
1390 case VG_BLEND_MODE: |
|
1391 { |
|
1392 RDebug::Print(_L("VG_BLEND_MODE")); |
|
1393 } |
|
1394 break; |
|
1395 case VG_MASKING: |
|
1396 { |
|
1397 RDebug::Print(_L("VG_MASKING")); |
|
1398 } |
|
1399 break; |
|
1400 case VG_SCISSORING: |
|
1401 { |
|
1402 RDebug::Print(_L("VG_SCISSORING")); |
|
1403 } |
|
1404 break; |
|
1405 case VG_PIXEL_LAYOUT: |
|
1406 { |
|
1407 RDebug::Print(_L("VG_PIXEL_LAYOUT")); |
|
1408 } |
|
1409 break; |
|
1410 case VG_FILTER_FORMAT_LINEAR: |
|
1411 { |
|
1412 RDebug::Print(_L("VG_FILTER_FORMAT_LINEAR")); |
|
1413 } |
|
1414 break; |
|
1415 case VG_FILTER_FORMAT_PREMULTIPLIED: |
|
1416 { |
|
1417 RDebug::Print(_L("VG_FILTER_FORMAT_PREMULTIPLIED")); |
|
1418 } |
|
1419 break; |
|
1420 case VG_FILTER_CHANNEL_MASK: |
|
1421 { |
|
1422 RDebug::Print(_L("VG_FILTER_CHANNEL_MASK")); |
|
1423 } |
|
1424 break; |
|
1425 case VG_STROKE_CAP_STYLE: |
|
1426 { |
|
1427 RDebug::Print(_L("VG_STROKE_CAP_STYLE")); |
|
1428 } |
|
1429 break; |
|
1430 case VG_STROKE_JOIN_STYLE: |
|
1431 { |
|
1432 RDebug::Print(_L("VG_STROKE_JOIN_STYLE")); |
|
1433 } |
|
1434 break; |
|
1435 case VG_STROKE_DASH_PHASE_RESET: |
|
1436 { |
|
1437 RDebug::Print(_L("VG_STROKE_DASH_PHASE_RESET")); |
|
1438 } |
|
1439 break; |
|
1440 /* Implementation limits (read-only) */ |
|
1441 case VG_SCREEN_LAYOUT: |
|
1442 { |
|
1443 RDebug::Print(_L("VG_SCREEN_LAYOUT")); |
|
1444 } |
|
1445 break; |
|
1446 case VG_MAX_SCISSOR_RECTS: |
|
1447 { |
|
1448 RDebug::Print(_L("VG_MAX_SCISSOR_RECTS")); |
|
1449 } |
|
1450 break; |
|
1451 case VG_MAX_DASH_COUNT: |
|
1452 { |
|
1453 RDebug::Print(_L("VG_MAX_DASH_COUNT")); |
|
1454 } |
|
1455 break; |
|
1456 case VG_MAX_KERNEL_SIZE: |
|
1457 { |
|
1458 RDebug::Print(_L("VG_MAX_KERNEL_SIZE")); |
|
1459 } |
|
1460 break; |
|
1461 case VG_MAX_SEPARABLE_KERNEL_SIZE: |
|
1462 { |
|
1463 RDebug::Print(_L("VG_MAX_SEPARABLE_KERNEL_SIZE")); |
|
1464 } |
|
1465 break; |
|
1466 case VG_MAX_COLOR_RAMP_STOPS: |
|
1467 { |
|
1468 RDebug::Print(_L("VG_MAX_COLOR_RAMP_STOPS")); |
|
1469 } |
|
1470 break; |
|
1471 case VG_MAX_IMAGE_WIDTH: |
|
1472 { |
|
1473 RDebug::Print(_L("VG_MAX_IMAGE_WIDTH")); |
|
1474 } |
|
1475 break; |
|
1476 case VG_MAX_IMAGE_HEIGHT: |
|
1477 { |
|
1478 RDebug::Print(_L("VG_MAX_IMAGE_HEIGHT")); |
|
1479 } |
|
1480 break; |
|
1481 case VG_MAX_IMAGE_PIXELS: |
|
1482 { |
|
1483 RDebug::Print(_L("VG_MAX_IMAGE_PIXELS")); |
|
1484 } |
|
1485 break; |
|
1486 case VG_MAX_IMAGE_BYTES: |
|
1487 { |
|
1488 RDebug::Print(_L("VG_MAX_IMAGE_BYTES")); |
|
1489 } |
|
1490 break; |
|
1491 case VG_MAX_FLOAT: |
|
1492 { |
|
1493 RDebug::Print(_L("VG_MAX_FLOAT")); |
|
1494 } |
|
1495 break; |
|
1496 case VG_MAX_GAUSSIAN_STD_DEVIATION: |
|
1497 { |
|
1498 RDebug::Print(_L("VG_MAX_GAUSSIAN_STD_DEVIATION")); |
|
1499 } |
|
1500 break; |
|
1501 |
|
1502 default: |
|
1503 { |
|
1504 RDebug::Print(_L("%d"), type); |
|
1505 } |
|
1506 break; |
|
1507 }; |
|
1508 |
|
1509 RDebug::Print(_L(", ")); |
|
1510 switch(value) |
|
1511 { |
|
1512 case VG_RENDERING_QUALITY_NONANTIALIASED: |
|
1513 { |
|
1514 RDebug::Print(_L("VG_RENDERING_QUALITY_NONANTIALIASED")); |
|
1515 } |
|
1516 break; |
|
1517 case VG_RENDERING_QUALITY_FASTER: |
|
1518 { |
|
1519 RDebug::Print(_L("VG_RENDERING_QUALITY_FASTER")); |
|
1520 } |
|
1521 break; |
|
1522 case VG_RENDERING_QUALITY_BETTER: |
|
1523 { |
|
1524 RDebug::Print(_L("VG_RENDERING_QUALITY_BETTER")); |
|
1525 } |
|
1526 break; |
|
1527 case VG_MATRIX_PATH_USER_TO_SURFACE: |
|
1528 { |
|
1529 RDebug::Print(_L("VG_MATRIX_PATH_USER_TO_SURFACE")); |
|
1530 } |
|
1531 break; |
|
1532 case VG_MATRIX_IMAGE_USER_TO_SURFACE: |
|
1533 { |
|
1534 RDebug::Print(_L("VG_MATRIX_IMAGE_USER_TO_SURFACE")); |
|
1535 } |
|
1536 break; |
|
1537 case VG_MATRIX_FILL_PAINT_TO_USER : |
|
1538 { |
|
1539 RDebug::Print(_L("VG_MATRIX_FILL_PAINT_TO_USER")); |
|
1540 } |
|
1541 break; |
|
1542 case VG_MATRIX_STROKE_PAINT_TO_USER: |
|
1543 { |
|
1544 RDebug::Print(_L("VG_MATRIX_STROKE_PAINT_TO_USER")); |
|
1545 } |
|
1546 break; |
|
1547 case VG_CAP_BUTT: |
|
1548 { |
|
1549 RDebug::Print(_L("VG_CAP_BUTT")); |
|
1550 } |
|
1551 break; |
|
1552 case VG_CAP_ROUND: |
|
1553 { |
|
1554 RDebug::Print(_L("VG_CAP_ROUND")); |
|
1555 } |
|
1556 break; |
|
1557 case VG_CAP_SQUARE: |
|
1558 { |
|
1559 RDebug::Print(_L("VG_CAP_SQUARE")); |
|
1560 } |
|
1561 break; |
|
1562 case VG_BLEND_SRC: |
|
1563 { |
|
1564 RDebug::Print(_L("VG_BLEND_SRC")); |
|
1565 } |
|
1566 break; |
|
1567 case VG_BLEND_SRC_OVER: |
|
1568 { |
|
1569 RDebug::Print(_L("VG_BLEND_SRC_OVER")); |
|
1570 } |
|
1571 break; |
|
1572 case VG_BLEND_DST_OVER: |
|
1573 { |
|
1574 RDebug::Print(_L("VG_BLEND_DST_OVER")); |
|
1575 } |
|
1576 break; |
|
1577 case VG_BLEND_SRC_IN: |
|
1578 { |
|
1579 RDebug::Print(_L("VG_BLEND_SRC_IN")); |
|
1580 } |
|
1581 break; |
|
1582 case VG_BLEND_DST_IN: |
|
1583 { |
|
1584 RDebug::Print(_L("VG_BLEND_DST_IN")); |
|
1585 } |
|
1586 break; |
|
1587 case VG_BLEND_MULTIPLY: |
|
1588 { |
|
1589 RDebug::Print(_L("VG_BLEND_MULTIPLY")); |
|
1590 } |
|
1591 break; |
|
1592 case VG_BLEND_SCREEN: |
|
1593 { |
|
1594 RDebug::Print(_L("VG_BLEND_SCREEN")); |
|
1595 } |
|
1596 break; |
|
1597 case VG_BLEND_DARKEN: |
|
1598 { |
|
1599 RDebug::Print(_L("VG_BLEND_DARKEN")); |
|
1600 } |
|
1601 break; |
|
1602 case VG_BLEND_LIGHTEN: |
|
1603 { |
|
1604 RDebug::Print(_L("VG_BLEND_LIGHTEN")); |
|
1605 } |
|
1606 break; |
|
1607 case VG_BLEND_ADDITIVE: |
|
1608 { |
|
1609 RDebug::Print(_L("VG_BLEND_ADDITIVE")); |
|
1610 } |
|
1611 break; |
|
1612 case VG_IMAGE_QUALITY_NONANTIALIASED: |
|
1613 { |
|
1614 RDebug::Print(_L("1")); |
|
1615 } |
|
1616 break; |
|
1617 case VG_IMAGE_QUALITY_FASTER: |
|
1618 { |
|
1619 RDebug::Print(_L("VG_IMAGE_QUALITY_FASTER")); |
|
1620 } |
|
1621 break; |
|
1622 case VG_IMAGE_QUALITY_BETTER: |
|
1623 { |
|
1624 RDebug::Print(_L("VG_IMAGE_QUALITY_BETTER")); |
|
1625 } |
|
1626 break; |
|
1627 case VG_FALSE: |
|
1628 { |
|
1629 RDebug::Print(_L("VG_FALSE")); |
|
1630 } |
|
1631 break; |
|
1632 case VG_RED: |
|
1633 { |
|
1634 RDebug::Print(_L("VG_RED")); |
|
1635 } |
|
1636 break; |
|
1637 |
|
1638 case VG_DRAW_IMAGE_NORMAL: |
|
1639 { |
|
1640 RDebug::Print(_L("VG_DRAW_IMAGE_NORMAL")); |
|
1641 } |
|
1642 break; |
|
1643 case VG_DRAW_IMAGE_MULTIPLY: |
|
1644 { |
|
1645 RDebug::Print(_L("VG_DRAW_IMAGE_MULTIPLY")); |
|
1646 } |
|
1647 break; |
|
1648 case VG_DRAW_IMAGE_STENCIL: |
|
1649 { |
|
1650 RDebug::Print(_L("VG_DRAW_IMAGE_STENCIL")); |
|
1651 } |
|
1652 break; |
|
1653 case VG_JOIN_MITER: |
|
1654 { |
|
1655 RDebug::Print(_L("VG_JOIN_MITER")); |
|
1656 } |
|
1657 break; |
|
1658 case VG_JOIN_ROUND: |
|
1659 { |
|
1660 RDebug::Print(_L("VG_JOIN_ROUND")); |
|
1661 } |
|
1662 break; |
|
1663 case VG_JOIN_BEVEL: |
|
1664 { |
|
1665 RDebug::Print(_L("VG_JOIN_BEVEL")); |
|
1666 } |
|
1667 case VG_EVEN_ODD: |
|
1668 RDebug::Print(_L("VG_EVEN_ODD")); |
|
1669 break; |
|
1670 case VG_NON_ZERO: |
|
1671 RDebug::Print(_L("VG_NON_ZERO")); |
|
1672 break; |
|
1673 default: |
|
1674 { |
|
1675 RDebug::Print(_L("%d"), value); |
|
1676 } |
|
1677 break; |
|
1678 }; |
|
1679 |
|
1680 RDebug::Print(_L(");\n")); |
|
1681 return; |
|
1682 } |
|
1683 |
|
1684 void CTLVRenderer::LogvgSetXv(VGParamType type, VGint count, TInt8 vtype, VGint * data) |
|
1685 { |
|
1686 int vgsetvDataCount = clock() % 1000; |
|
1687 RDebug::Print(_L("VGfloat * vgsetvData%d = new VGfloat[%d];\n"), ++vgsetvDataCount, count); |
|
1688 |
|
1689 for (int i=0; i<count; ++i) |
|
1690 { |
|
1691 RDebug::Print(_L("*(vgsetvData%d+i) = "), vgsetvDataCount); |
|
1692 if (vtype == 'f') |
|
1693 { |
|
1694 TRealFormat rf; |
|
1695 RDebug::Print(_L("%f"), (TReal)*(((TReal*)data)+i), rf); |
|
1696 } |
|
1697 else if (vtype == 'i') |
|
1698 { |
|
1699 RDebug::Print(_L("%d"), (TInt)*(data+i)); |
|
1700 } |
|
1701 |
|
1702 RDebug::Print(_L(";\n")); |
|
1703 } |
|
1704 |
|
1705 RDebug::Print(_L("vgSet%cv("), vtype); |
|
1706 |
|
1707 switch(type) |
|
1708 { |
|
1709 case VG_STROKE_DASH_PATTERN: |
|
1710 RDebug::Print(_L("VG_STROKE_DASH_PATTERN")); |
|
1711 break; |
|
1712 case VG_SCISSOR_RECTS: |
|
1713 RDebug::Print(_L("VG_SCISSOR_RECTS")); |
|
1714 break; |
|
1715 case VG_CLEAR_COLOR: |
|
1716 RDebug::Print(_L("VG_CLEAR_COLOR")); |
|
1717 break; |
|
1718 case VG_STROKE_LINE_WIDTH: |
|
1719 { |
|
1720 RDebug::Print(_L("VG_STROKE_LINE_WIDTH")); |
|
1721 } |
|
1722 break; |
|
1723 case VG_STROKE_MITER_LIMIT: |
|
1724 { |
|
1725 RDebug::Print(_L("VG_STROKE_MITER_LIMIT")); |
|
1726 } |
|
1727 break; |
|
1728 case VG_STROKE_DASH_PHASE: |
|
1729 { |
|
1730 RDebug::Print(_L("VG_STROKE_DASH_PHASE")); |
|
1731 } |
|
1732 break; |
|
1733 |
|
1734 case VG_MATRIX_MODE: |
|
1735 { |
|
1736 RDebug::Print(_L("VG_MATRIX_MODE")); |
|
1737 } |
|
1738 break; |
|
1739 case VG_FILL_RULE: |
|
1740 { |
|
1741 RDebug::Print(_L("VG_FILL_RULE")); |
|
1742 } |
|
1743 break; |
|
1744 case VG_IMAGE_QUALITY: |
|
1745 { |
|
1746 RDebug::Print(_L("VG_IMAGE_QUALITY")); |
|
1747 } |
|
1748 break; |
|
1749 case VG_IMAGE_MODE: |
|
1750 { |
|
1751 RDebug::Print(_L("VG_IMAGE_MODE")); |
|
1752 } |
|
1753 break; |
|
1754 case VG_RENDERING_QUALITY: |
|
1755 { |
|
1756 RDebug::Print(_L("VG_RENDERING_QUALITY")); |
|
1757 } |
|
1758 break; |
|
1759 case VG_BLEND_MODE: |
|
1760 { |
|
1761 RDebug::Print(_L("VG_BLEND_MODE")); |
|
1762 } |
|
1763 break; |
|
1764 case VG_MASKING: |
|
1765 { |
|
1766 RDebug::Print(_L("VG_MASKING")); |
|
1767 } |
|
1768 break; |
|
1769 case VG_SCISSORING: |
|
1770 { |
|
1771 RDebug::Print(_L("VG_SCISSORING")); |
|
1772 } |
|
1773 break; |
|
1774 case VG_PIXEL_LAYOUT: |
|
1775 { |
|
1776 RDebug::Print(_L("VG_PIXEL_LAYOUT")); |
|
1777 } |
|
1778 break; |
|
1779 case VG_FILTER_FORMAT_LINEAR: |
|
1780 { |
|
1781 RDebug::Print(_L("VG_FILTER_FORMAT_LINEAR")); |
|
1782 } |
|
1783 break; |
|
1784 case VG_FILTER_FORMAT_PREMULTIPLIED: |
|
1785 { |
|
1786 RDebug::Print(_L("VG_FILTER_FORMAT_PREMULTIPLIED")); |
|
1787 } |
|
1788 break; |
|
1789 case VG_FILTER_CHANNEL_MASK: |
|
1790 { |
|
1791 RDebug::Print(_L("VG_FILTER_CHANNEL_MASK")); |
|
1792 } |
|
1793 break; |
|
1794 case VG_STROKE_CAP_STYLE: |
|
1795 { |
|
1796 RDebug::Print(_L("VG_STROKE_CAP_STYLE")); |
|
1797 } |
|
1798 break; |
|
1799 case VG_STROKE_JOIN_STYLE: |
|
1800 { |
|
1801 RDebug::Print(_L("VG_STROKE_JOIN_STYLE")); |
|
1802 } |
|
1803 break; |
|
1804 case VG_STROKE_DASH_PHASE_RESET: |
|
1805 { |
|
1806 RDebug::Print(_L("VG_STROKE_DASH_PHASE_RESET")); |
|
1807 } |
|
1808 break; |
|
1809 /* Implementation limits (read-only) */ |
|
1810 case VG_SCREEN_LAYOUT: |
|
1811 { |
|
1812 RDebug::Print(_L("VG_SCREEN_LAYOUT")); |
|
1813 } |
|
1814 break; |
|
1815 case VG_MAX_SCISSOR_RECTS: |
|
1816 { |
|
1817 RDebug::Print(_L("VG_MAX_SCISSOR_RECTS")); |
|
1818 } |
|
1819 break; |
|
1820 case VG_MAX_DASH_COUNT: |
|
1821 { |
|
1822 RDebug::Print(_L("VG_MAX_DASH_COUNT")); |
|
1823 } |
|
1824 break; |
|
1825 case VG_MAX_KERNEL_SIZE: |
|
1826 { |
|
1827 RDebug::Print(_L("VG_MAX_KERNEL_SIZE")); |
|
1828 } |
|
1829 break; |
|
1830 case VG_MAX_SEPARABLE_KERNEL_SIZE: |
|
1831 { |
|
1832 RDebug::Print(_L("VG_MAX_SEPARABLE_KERNEL_SIZE")); |
|
1833 } |
|
1834 break; |
|
1835 case VG_MAX_COLOR_RAMP_STOPS: |
|
1836 { |
|
1837 RDebug::Print(_L("VG_MAX_COLOR_RAMP_STOPS")); |
|
1838 } |
|
1839 break; |
|
1840 case VG_MAX_IMAGE_WIDTH: |
|
1841 { |
|
1842 RDebug::Print(_L("VG_MAX_IMAGE_WIDTH")); |
|
1843 } |
|
1844 break; |
|
1845 case VG_MAX_IMAGE_HEIGHT: |
|
1846 { |
|
1847 RDebug::Print(_L("VG_MAX_IMAGE_HEIGHT")); |
|
1848 } |
|
1849 break; |
|
1850 case VG_MAX_IMAGE_PIXELS: |
|
1851 { |
|
1852 RDebug::Print(_L("VG_MAX_IMAGE_PIXELS")); |
|
1853 } |
|
1854 break; |
|
1855 case VG_MAX_IMAGE_BYTES: |
|
1856 { |
|
1857 RDebug::Print(_L("VG_MAX_IMAGE_BYTES")); |
|
1858 } |
|
1859 break; |
|
1860 case VG_MAX_FLOAT: |
|
1861 { |
|
1862 RDebug::Print(_L("VG_MAX_FLOAT")); |
|
1863 } |
|
1864 break; |
|
1865 case VG_MAX_GAUSSIAN_STD_DEVIATION: |
|
1866 { |
|
1867 RDebug::Print(_L("VG_MAX_GAUSSIAN_STD_DEVIATION")); |
|
1868 } |
|
1869 break; |
|
1870 |
|
1871 default: |
|
1872 { |
|
1873 RDebug::Print(_L("%d"), type); |
|
1874 } |
|
1875 break; |
|
1876 }; |
|
1877 |
|
1878 RDebug::Print(_L(", %d, vgsetvData%d);\n"), count, vgsetvDataCount); |
|
1879 RDebug::Print(_L("delete [] vgsetvData%d;\n"), vgsetvDataCount); |
|
1880 return; |
|
1881 } |
|
1882 |
|
1883 void CTLVRenderer::LogvgSetParameteri(VGHandle handle, VGint paramType, VGint value, TInt /*Lpvalue*/) |
|
1884 { |
|
1885 |
|
1886 RDebug::Print(_L("vgSetParameteri(%d, "), handle); |
|
1887 |
|
1888 switch(paramType) |
|
1889 { |
|
1890 case VG_PAINT_TYPE: |
|
1891 { |
|
1892 RDebug::Print(_L("VG_PAINT_TYPE")); |
|
1893 } |
|
1894 break; |
|
1895 case VG_PAINT_COLOR: |
|
1896 { |
|
1897 RDebug::Print(_L("VG_PAINT_COLOR")); |
|
1898 } |
|
1899 break; |
|
1900 case VG_PAINT_COLOR_RAMP_SPREAD_MODE: |
|
1901 { |
|
1902 RDebug::Print(_L("VG_PAINT_COLOR_RAMP_SPREAD_MODE")); |
|
1903 } |
|
1904 break; |
|
1905 case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: |
|
1906 { |
|
1907 RDebug::Print(_L("VG_PAINT_COLOR_RAMP_PREMULTIPLIED")); |
|
1908 } |
|
1909 break; |
|
1910 case VG_PAINT_COLOR_RAMP_STOPS: |
|
1911 { |
|
1912 RDebug::Print(_L("VG_PAINT_COLOR_RAMP_STOPS")); |
|
1913 } |
|
1914 break; |
|
1915 |
|
1916 /* Linear gradient paint parameters */ |
|
1917 case VG_PAINT_LINEAR_GRADIENT: |
|
1918 { |
|
1919 RDebug::Print(_L("VG_PAINT_LINEAR_GRADIENT")); |
|
1920 } |
|
1921 break; |
|
1922 /* Radial gradient paint parameters */ |
|
1923 case VG_PAINT_RADIAL_GRADIENT: |
|
1924 { |
|
1925 RDebug::Print(_L("VG_PAINT_RADIAL_GRADIENT")); |
|
1926 } |
|
1927 break; |
|
1928 /* Pattern paint parameters */ |
|
1929 case VG_PAINT_PATTERN_TILING_MODE: |
|
1930 { |
|
1931 RDebug::Print(_L("VG_PAINT_PATTERN_TILING_MODE")); |
|
1932 } |
|
1933 break; |
|
1934 default: |
|
1935 { |
|
1936 RDebug::Print(_L("%d"), paramType); |
|
1937 } |
|
1938 break; |
|
1939 }; |
|
1940 |
|
1941 RDebug::Print(_L(", ")); |
|
1942 |
|
1943 switch(value) |
|
1944 { |
|
1945 case VG_PAINT_TYPE_COLOR: |
|
1946 { |
|
1947 RDebug::Print(_L("VG_PAINT_TYPE_COLOR")); |
|
1948 } |
|
1949 break; |
|
1950 case VG_PAINT_TYPE_LINEAR_GRADIENT: |
|
1951 { |
|
1952 RDebug::Print(_L("VG_PAINT_TYPE_LINEAR_GRADIENT")); |
|
1953 } |
|
1954 break; |
|
1955 case VG_PAINT_TYPE_RADIAL_GRADIENT: |
|
1956 { |
|
1957 RDebug::Print(_L("VG_PAINT_TYPE_RADIAL_GRADIENT")); |
|
1958 } |
|
1959 break; |
|
1960 case VG_PAINT_TYPE_PATTERN: |
|
1961 { |
|
1962 RDebug::Print(_L("VG_PAINT_TYPE_PATTERN")); |
|
1963 } |
|
1964 break; |
|
1965 default: |
|
1966 { |
|
1967 RDebug::Print(_L("%d"), value); |
|
1968 } |
|
1969 break; |
|
1970 }; |
|
1971 RDebug::Print(_L(");\n")); |
|
1972 return; |
|
1973 } |
|
1974 |
|
1975 void CTLVRenderer::LogvgSetPaint(VGPaint paint, VGbitfield paintModes, TInt /*Lpvalue*/) |
|
1976 { |
|
1977 RDebug::Print(_L("vgSetPaint(%d, "), paint); |
|
1978 |
|
1979 switch(paintModes) |
|
1980 { |
|
1981 case VG_STROKE_PATH: |
|
1982 { |
|
1983 RDebug::Print(_L("VG_STROKE_PATH")); |
|
1984 } |
|
1985 break; |
|
1986 case VG_FILL_PATH: |
|
1987 { |
|
1988 RDebug::Print(_L("VG_FILL_PATH")); |
|
1989 } |
|
1990 break; |
|
1991 default: |
|
1992 { |
|
1993 RDebug::Print(_L("%d"), paintModes); |
|
1994 } |
|
1995 break; |
|
1996 }; |
|
1997 RDebug::Print(_L(");\n")); |
|
1998 return; |
|
1999 } |
|
2000 |
|
2001 void CTLVRenderer::LogvgDrawPath(VGuint path, VGbitfield paintModes) |
|
2002 { |
|
2003 RDebug::Print(_L("vgDrawPath(%d, "), path); |
|
2004 |
|
2005 switch(paintModes) |
|
2006 { |
|
2007 case VG_STROKE_PATH: |
|
2008 { |
|
2009 RDebug::Print(_L("VG_STROKE_PATH")); |
|
2010 } |
|
2011 break; |
|
2012 case VG_FILL_PATH: |
|
2013 { |
|
2014 RDebug::Print(_L("VG_FILL_PATH")); |
|
2015 } |
|
2016 break; |
|
2017 case VG_FILL_PATH | VG_STROKE_PATH: |
|
2018 { |
|
2019 RDebug::Print(_L("VG_FILL_PATH | VG_STROKE_PATH")); |
|
2020 } |
|
2021 break; |
|
2022 default: |
|
2023 { |
|
2024 RDebug::Print(_L("%d"), paintModes); |
|
2025 } |
|
2026 break; |
|
2027 }; |
|
2028 RDebug::Print(_L(");\n")); |
|
2029 return; |
|
2030 } |
|
2031 |
|
2032 void CTLVRenderer::LogvgSetParameterfv(VGPaint handle, VGint paramtype, TInt count, VGfloat * data) |
|
2033 { |
|
2034 int vgSetParameterfvDataCount = clock() % 1000; |
|
2035 RDebug::Print(_L("VGfloat * vgSetParameterfvData%d = new VGfloat[%d];\n"), ++vgSetParameterfvDataCount, count); |
|
2036 |
|
2037 for (int i=0; i<count; ++i) |
|
2038 { |
|
2039 RDebug::Print(_L("*(vgSetParameterfvData%d+i) = %f;\n"), vgSetParameterfvDataCount, data[i]); |
|
2040 } |
|
2041 |
|
2042 RDebug::Print(_L("vgSetParameterfv(%d, "), handle); |
|
2043 |
|
2044 switch(paramtype) |
|
2045 { |
|
2046 case VG_PAINT_TYPE: |
|
2047 { |
|
2048 RDebug::Print(_L("VG_PAINT_TYPE")); |
|
2049 } |
|
2050 break; |
|
2051 case VG_PAINT_COLOR: |
|
2052 { |
|
2053 RDebug::Print(_L("VG_PAINT_COLOR")); |
|
2054 } |
|
2055 break; |
|
2056 case VG_PAINT_COLOR_RAMP_SPREAD_MODE: |
|
2057 { |
|
2058 RDebug::Print(_L("VG_PAINT_COLOR_RAMP_SPREAD_MODE")); |
|
2059 } |
|
2060 break; |
|
2061 case VG_PAINT_COLOR_RAMP_PREMULTIPLIED: |
|
2062 { |
|
2063 RDebug::Print(_L("VG_PAINT_COLOR_RAMP_PREMULTIPLIED")); |
|
2064 } |
|
2065 break; |
|
2066 case VG_PAINT_COLOR_RAMP_STOPS: |
|
2067 { |
|
2068 RDebug::Print(_L("VG_PAINT_COLOR_RAMP_STOPS")); |
|
2069 } |
|
2070 break; |
|
2071 case VG_PAINT_LINEAR_GRADIENT: |
|
2072 { |
|
2073 RDebug::Print(_L("VG_PAINT_LINEAR_GRADIENT")); |
|
2074 } |
|
2075 break; |
|
2076 case VG_PAINT_RADIAL_GRADIENT: |
|
2077 { |
|
2078 RDebug::Print(_L("VG_PAINT_RADIAL_GRADIENT")); |
|
2079 } |
|
2080 break; |
|
2081 case VG_PAINT_PATTERN_TILING_MODE: |
|
2082 { |
|
2083 RDebug::Print(_L("VG_PAINT_PATTERN_TILING_MODE")); |
|
2084 } |
|
2085 break; |
|
2086 default: |
|
2087 { |
|
2088 RDebug::Print(_L("%d"), paramtype); |
|
2089 } |
|
2090 break; |
|
2091 }; |
|
2092 RDebug::Print(_L(", %d, vgSetParameterfvData%d);\n"), count, vgSetParameterfvDataCount); |
|
2093 RDebug::Print(_L("delete [] vgSetParameterfvData%d;\n"), vgSetParameterfvDataCount); |
|
2094 return; |
|
2095 } |
|
2096 |
|
2097 void CTLVRenderer::LogvgImageSubData(VGImage imageHandle, const void * dataPtr, TInt dataLength, VGint dataStride, |
|
2098 VGImageFormat dataFormat, VGint x, VGint y, VGint width, VGint height) |
|
2099 { |
|
2100 int imageDataCount = clock() % 1000; |
|
2101 |
|
2102 RDebug::Print(_L("VGbyte imageData%d[] = {"), ++imageDataCount); |
|
2103 |
|
2104 for (TInt i = 0; i < dataLength; ++i) |
|
2105 { |
|
2106 if (i == dataLength-1) |
|
2107 { |
|
2108 int data = (int)*(((VGbyte *)(dataPtr))+i); |
|
2109 RDebug::Print(_L("%d};\n"), data); |
|
2110 } |
|
2111 else |
|
2112 { |
|
2113 int data = (int)*(((VGbyte *)(dataPtr))+i); |
|
2114 RDebug::Print(_L("%d, "), data); |
|
2115 } |
|
2116 |
|
2117 if (i % 10 == 0) |
|
2118 { |
|
2119 RDebug::Print(_L("\n\t")); |
|
2120 } |
|
2121 } |
|
2122 |
|
2123 RDebug::Print(_L("vgImageSubData(%d, imageData%d, %d, (VGImageFormat)%d, %d, %d, %d, %d);\n"), |
|
2124 imageHandle, imageDataCount, dataStride, dataFormat, x, y, width, height); |
|
2125 } |
|
2126 |
|
2127 #endif |
|
2128 |