uifw/ganes/src/HgVgSkinRenderer.cpp
branchRCL_3
changeset 16 71dd06cfe933
parent 10 9f56a4e1b8ab
--- a/uifw/ganes/src/HgVgSkinRenderer.cpp	Wed Mar 31 21:59:52 2010 +0300
+++ b/uifw/ganes/src/HgVgSkinRenderer.cpp	Wed Apr 14 16:14:00 2010 +0300
@@ -59,7 +59,7 @@
 void CHgVgSkinRenderer::ConstructL ()
     {
         
-    iDrawBuffer = CHgVgDrawBuffer::NewL( TSize(iRect.Width(), iRect.Height()), EColor64K );
+    iDrawBuffer = CHgVgDrawBuffer::NewL( TSize(iRect.Width(), iRect.Height()), EColor16MA );
 
     
     }
@@ -96,12 +96,6 @@
 void CHgVgSkinRenderer::UpdateSkinL(const MObjectProvider* aProvider, 
         const CCoeControl* aControl)
     {
-    // render skin to draw buffer
-    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-    MAknsControlContext* cc = AknsDrawUtils::ControlContext( aProvider );
-    AknsDrawUtils::DrawBackground( skin, cc, aControl, iDrawBuffer->Gc(), TPoint(0,0), 
-            aControl->Rect(), KAknsDrawParamDefault );
-
     // destroy old vg image
     if (iSkinImage != VG_INVALID_HANDLE)
         {
@@ -109,20 +103,27 @@
         iSkinImage = VG_INVALID_HANDLE;
         }
 
-    // create new image for the skin
-    iSkinImage = vgCreateImage(VG_sRGB_565, 
-            iRect.Width(), iRect.Height(), 
-            VG_IMAGE_QUALITY_NONANTIALIASED);
-    
-    // handle out of memory
-    if( iSkinImage == VG_INVALID_HANDLE )
+    // render skin to draw buffer
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( aProvider );
+    if( AknsDrawUtils::DrawBackground( skin, cc, aControl, iDrawBuffer->Gc(), TPoint(0,0), 
+            aControl->Rect(), KAknsDrawParamDefault ) )
         {
-        User::Leave(KErrNoMemory);
+        // create new image for the skin
+        iSkinImage = vgCreateImage(VG_sRGBA_8888, 
+                iRect.Width(), iRect.Height(), 
+                VG_IMAGE_QUALITY_NONANTIALIASED);
+        
+        // handle out of memory
+        if( iSkinImage == VG_INVALID_HANDLE )
+            {
+            User::Leave(KErrNoMemory);
+            }
+                
+        // Copy to draw buffer to vg image
+        iDrawBuffer->GetDrawBufferToVgImage(TRect(TPoint(0,0), TPoint(iRect.Width(), iRect.Height())), 
+                TPoint(0,0), iSkinImage, VG_sARGB_8888);    
         }
-            
-    // Copy to draw buffer to vg image
-    iDrawBuffer->GetDrawBufferToVgImage(TRect(TPoint(0,0), TPoint(iRect.Width(), iRect.Height())), 
-            TPoint(0,0), iSkinImage, VG_sRGB_565);    
     }
 
 void CHgVgSkinRenderer::SetRect( const TRect& aRect )
@@ -137,7 +138,16 @@
 //
 void CHgVgSkinRenderer::Draw() const
     {
-    HgVgHelper::DrawImage(iSkinImage, TPoint(0, 0), iRect, EFalse, iLandscape);
+    
+    VGfloat color[] = {255,255,255,0};
+    vgSetfv(VG_CLEAR_COLOR, 4, color);
+    if(iLandscape)
+        vgClear(0, 0, iRect.Height(), iRect.Width());
+    else
+        vgClear(0, 0, iRect.Width(), iRect.Height());
+    
+    if( iSkinImage != VG_INVALID_HANDLE )
+        HgVgHelper::DrawImage(iSkinImage, TPoint(0, 0), iRect, EFalse, iLandscape);
     }
 
 void CHgVgSkinRenderer::EnableLanscapeRendering(TBool aLandscape)