svgtopt/nvgdecoder/src/nvg.cpp
branchRCL_3
changeset 17 db5c883ad1c5
parent 1 bfff372fb1f4
child 18 1902ade171ab
equal deleted inserted replaced
14:9be6eed35a80 17:db5c883ad1c5
   179       iUserStrokePaintColor(0xFFFFFFFF),
   179       iUserStrokePaintColor(0xFFFFFFFF),
   180       iRotateApplied(EFalse),
   180       iRotateApplied(EFalse),
   181       iLastPathDataType(0),
   181       iLastPathDataType(0),
   182       iPreserveAspectSetting(ENvgPreserveAspectRatio_XmidYmid),
   182       iPreserveAspectSetting(ENvgPreserveAspectRatio_XmidYmid),
   183       iSmilFitSetting(ENvgMeet),
   183       iSmilFitSetting(ENvgMeet),
   184       iVGImageBinder(0)
   184       iVGImageBinder(0),
       
   185       iBackgroundColor(0)
   185     {
   186     {
   186     }
   187     }
   187 
   188 
   188 EXPORT_C CNvgEngine* CNvgEngine::NewL()
   189 EXPORT_C CNvgEngine* CNvgEngine::NewL()
   189     {
   190     {
   404     if (iCurrentBufferSize != aSize)
   405     if (iCurrentBufferSize != aSize)
   405         { 
   406         { 
   406         iCurrentBufferSize = aSize;
   407         iCurrentBufferSize = aSize;
   407         }
   408         }
   408     
   409     
       
   410     if (iBackgroundColor)
       
   411         {
       
   412         ClearBackground();
       
   413         }
       
   414 
   409     iDstBimtap = aDstBitmap;
   415     iDstBimtap = aDstBitmap;
   410     
   416     
   411     TDereferencer nvgIconData(aBuffer);
   417     TDereferencer nvgIconData(aBuffer);
   412 
   418 
   413     TUint8 * signature = nvgIconData.DerefInt8ArrayL(KNVG_SIGNATURE_LENGTH);
   419     TUint8 * signature = nvgIconData.DerefInt8ArrayL(KNVG_SIGNATURE_LENGTH);
  1557     vgSeti(VG_FILTER_CHANNEL_MASK, KOriginalFilterMasks);
  1563     vgSeti(VG_FILTER_CHANNEL_MASK, KOriginalFilterMasks);
  1558     }
  1564     }
  1559 
  1565 
  1560 void CNvgEngine::ClearBackground()
  1566 void CNvgEngine::ClearBackground()
  1561     {
  1567     {
  1562     TUint32 rgba = (iBackgroundColor << 8) | (iBackgroundColor >> 24);
  1568     TUint32 rgba = iBackgroundColor;//(iBackgroundColor << 8) | (iBackgroundColor >> 24);
  1563     TInt32 r, g, b, a;
  1569     TInt32 r, g, b, a;
  1564     r = (TInt)((rgba & 0xFF000000) >> 24);
  1570     r = (TInt)((rgba & 0xFF000000) >> 24);
  1565     g = (TInt)((rgba & 0x00FF0000) >> 16);
  1571     g = (TInt)((rgba & 0x00FF0000) >> 16);
  1566     b = (TInt)((rgba & 0x0000FF00) >> 8);
  1572     b = (TInt)((rgba & 0x0000FF00) >> 8);
  1567     a = (TInt)(rgba & 0x000000FF);
  1573     a = (TInt)(rgba & 0x000000FF);
  1568     
  1574     
  1569     r += r >> 7; g += g >> 7; b += b >> 7; a += a >> 7;
  1575     //r += r >> 7; g += g >> 7; b += b >> 7; a += a >> 7;
  1570     
  1576     
  1571     const VGfloat KInverse255 =  1.0f/256.0f;
  1577     const VGfloat KInverse255 =  1.0f/256.0f;
  1572     const VGfloat clearColor[4] = { (KInverse255 * VGfloat (r)),
  1578     const VGfloat clearColor[4] = { (KInverse255 * VGfloat (r)),
  1573             (KInverse255 * VGfloat (g)),
  1579             (KInverse255 * VGfloat (g)),
  1574             (KInverse255 * VGfloat (b)),
  1580             (KInverse255 * VGfloat (b)),
  1575             (KInverse255 * VGfloat (a)) };
  1581             (KInverse255 * VGfloat (a)) };
  1576     
  1582     
  1577     vgSeti(VG_SCISSORING, VG_FALSE);
  1583     //vgSeti(VG_SCISSORING, VG_FALSE);
  1578     vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
  1584     vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
  1579     vgClear(0, 0, iCurrentBufferSize.iWidth, iCurrentBufferSize.iHeight);
  1585     vgClear(0, 0, iCurrentBufferSize.iWidth, iCurrentBufferSize.iHeight);
  1580     vgSeti(VG_SCISSORING, VG_TRUE);
  1586     //vgSeti(VG_SCISSORING, VG_TRUE);
  1581     }
  1587     }
  1582 
  1588 
  1583 TBool CNvgEngine::IsIdentity(VGfloat array[])
  1589 TBool CNvgEngine::IsIdentity(VGfloat array[])
  1584     {
  1590     {
  1585     return ((array[0] == 1.0f && array[4] == 1.0f && array[8] == 1.0f)&& 
  1591     return ((array[0] == 1.0f && array[4] == 1.0f && array[8] == 1.0f)&&