Revision: 201017 RCL_3 PDK_3.0.0 PDK_3.0.1
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 17:02:26 +0300
branchRCL_3
changeset 14 9be6eed35a80
parent 12 b52e29b42806
child 17 db5c883ad1c5
Revision: 201017 Kit: 201019
svgtopt/VGRenderer/PseudoVG/inc/PseodoVGRendererImpl.h
svgtopt/VGRenderer/PseudoVG/src/PseodoVGRendererImpl.cpp
svgtopt/VGRenderer/PseudoVG/src/PseudoVGSurfaceImpl.cpp
--- a/svgtopt/VGRenderer/PseudoVG/inc/PseodoVGRendererImpl.h	Tue Apr 27 17:34:09 2010 +0300
+++ b/svgtopt/VGRenderer/PseudoVG/inc/PseodoVGRendererImpl.h	Tue May 11 17:02:26 2010 +0300
@@ -169,7 +169,7 @@
     static const TUint  ENCODEDDATAGRANULARITY;
     TInt                iCommonHeaderLength;
     const TUint8* iCommonHeader;
-    
+    VGErrorCode iVgErrorCode;
     //Command specific logging methods
 #ifdef VGRENDERER_LOG
     RFileLogger iLog;//logs    
--- a/svgtopt/VGRenderer/PseudoVG/src/PseodoVGRendererImpl.cpp	Tue Apr 27 17:34:09 2010 +0300
+++ b/svgtopt/VGRenderer/PseudoVG/src/PseodoVGRendererImpl.cpp	Tue May 11 17:02:26 2010 +0300
@@ -39,6 +39,7 @@
     iHandle             = 1;
     iCommonHeaderLength = 0;
     iCommonHeader = 0;
+    iVgErrorCode = VG_NO_ERROR;
     }
 
 CPseodoVGRendererImpl::~CPseodoVGRendererImpl()
@@ -232,6 +233,9 @@
 
 TUint CPseodoVGRendererImpl::vgCreatePaint()
     {
+    if(iVgErrorCode != VG_NO_ERROR)
+        return VG_INVALID_HANDLE;
+    
     iHandle++;
     EncodeInt8(EvgCreatePaint);
     EncodeInt32(iHandle);
@@ -244,6 +248,10 @@
 TUint CPseodoVGRendererImpl::vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias,
         TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities)
     {
+    if(iVgErrorCode != VG_NO_ERROR)
+        return VG_INVALID_HANDLE;
+    
+        
     iHandle++;
     EncodeInt8(EvgCreatePath);
     EncodeInt32(pathFormat);
@@ -383,7 +391,7 @@
     EncodeInt16(capabilities);
 
 #ifdef VGRENDERER_LOG
-    LogvgDrawPath(paintModes,0);   
+    LogvgDrawPath(path,0);   
 #endif
 
     }
@@ -460,6 +468,9 @@
 
 TUint CPseodoVGRendererImpl::vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality)
     {
+    if(iVgErrorCode != VG_NO_ERROR)
+        return VG_INVALID_HANDLE;
+    
     iHandle++;
     EncodeInt8(EvgCreateImage);
     EncodeInt32(format);
@@ -467,6 +478,9 @@
     EncodeInt32(height);
     EncodeInt8(allowedQuality);
     EncodeInt32(iHandle);
+#ifdef VGRENDERER_LOG
+    iLog.WriteFormat(_L("vgcreateimage"));
+#endif
     return iHandle;
     }
 
@@ -479,6 +493,9 @@
     {
     EncodeInt8(EvgDrawImage);
     EncodeInt32(image);
+#ifdef VGRENDERER_LOG
+    iLog.WriteFormat(_L("vgdrawimage"));
+#endif
     }
 
 void CPseodoVGRendererImpl::vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height)
@@ -489,6 +506,9 @@
     EncodeInt32(y);
     EncodeInt32(width);
     EncodeInt32(height);
+#ifdef VGRENDERER_LOG
+    iLog.WriteFormat(_L("vgclearimage"));
+#endif    
     }
 
 void CPseodoVGRendererImpl::vgImageSubData(TUint image, const void * data, TInt dataStride,
@@ -623,6 +643,9 @@
 
         EncodeData(dstData, dataLength);
         delete [] dstData;
+#ifdef VGRENDERER_LOG
+        iLog.WriteFormat(_L("vgimagesubdata"));
+#endif        
         }
     else
         {
@@ -648,6 +671,9 @@
     {
     EncodeInt8(EvgDestroyImage);
     EncodeInt32(aHandle);
+#ifdef VGRENDERER_LOG
+    iLog.WriteFormat(_L("vgdestroyimage"));
+#endif    
     }
 
 void CPseodoVGRendererImpl::vgDestroyPaint(TUint /*aHandle*/)
@@ -667,8 +693,7 @@
 
 TInt CPseodoVGRendererImpl::vgGetError()
     {
-    //TODO
-    return 0;
+   return iVgErrorCode;
     }
 
 MVGSurfaceImpl* CPseodoVGRendererImpl::CreateVGSurfaceL(TInt /*aOption*/)
@@ -708,10 +733,13 @@
 
 TInt CPseodoVGRendererImpl::EncodeData(const TAny *aData, TUint aLength)
     {
-    TInt result = KErrNone;
-    TPtr8 lPtr( iEncodedData->Des() );
-    TInt encodedDataLength      = lPtr.Length() + aLength;
-    TInt encodedDataMaxLength   = lPtr.MaxLength();
+
+    if(iVgErrorCode==VG_NO_ERROR)
+        {
+        TInt result = KErrNone;
+        TPtr8 lPtr( iEncodedData->Des() );
+        TInt encodedDataLength      = lPtr.Length() + aLength;
+        TInt encodedDataMaxLength   = lPtr.MaxLength();
 
     if (encodedDataLength >= encodedDataMaxLength)
         {
@@ -726,7 +754,12 @@
         lPtr.Append((TUint8*)(aData), aLength);
         }
 
-    return result;
+        return result;
+        }
+    else
+        {
+        return iVgErrorCode;
+        }
     }
 
 TInt CPseodoVGRendererImpl::ExpandEncodedData(TUint aNewLength)
@@ -740,6 +773,7 @@
     if (tmpBuf == 0)
         {
         result = KErrNoMemory;
+        iVgErrorCode = VG_OUT_OF_MEMORY_ERROR;
         }
 
     else
@@ -757,6 +791,17 @@
 
 void CPseodoVGRendererImpl::EmptyEncodedData()
     {
+    iVgErrorCode = VG_NO_ERROR;
+    if(iEncodedData->Length() > CPseodoVGRendererImpl::ENCODEDDATALENGTH)
+        {
+        delete iEncodedData;    
+        iEncodedData = HBufC8::New(CPseodoVGRendererImpl::ENCODEDDATALENGTH);
+        if(!iEncodedData)
+            {
+            iVgErrorCode = VG_OUT_OF_MEMORY_ERROR;
+            return;
+            }
+        }
     TPtr8 lPtr( iEncodedData->Des() );
     lPtr.Zero();
     WriteHeader();
--- a/svgtopt/VGRenderer/PseudoVG/src/PseudoVGSurfaceImpl.cpp	Tue Apr 27 17:34:09 2010 +0300
+++ b/svgtopt/VGRenderer/PseudoVG/src/PseudoVGSurfaceImpl.cpp	Tue May 11 17:02:26 2010 +0300
@@ -50,8 +50,8 @@
 TInt CPseudoVGSurfaceImpl::InitializeSurface(TSize aSize, TInt /*aColorSpace*/)
     {
     iSize = aSize;
-    iPseodoVGRendererImpl->EmptyEncodedData();
-    return KErrNone;
+    return iPseodoVGRendererImpl->vgGetError();
+    
     }
 
 void CPseudoVGSurfaceImpl::SetConfiguration(TInt aOption, const TAny* aValue)
@@ -69,8 +69,9 @@
 
 TInt CPseudoVGSurfaceImpl::ResizeSurface(TSize aSize)
     {
-    iSize = aSize;
-    return KErrNone;
+    iSize = aSize;    
+    iPseodoVGRendererImpl->EmptyEncodedData();
+    return iPseodoVGRendererImpl->vgGetError();
     }
 
 TInt CPseudoVGSurfaceImpl::CopyBitmap(TInt aDisplayMode, TInt aMaskMode,CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize /*aSize*/)