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