uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp
branchRCL_3
changeset 63 e1987ab3768a
parent 34 3a60ebea00d0
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Wed Sep 15 13:12:27 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Wed Oct 13 15:34:15 2010 +0300
@@ -127,11 +127,11 @@
 	THuiCachedImageParams cachedImageParams;
     cachedImageParams.iBitmapHandle = aBitmapHandle;
     cachedImageParams.iGcParams = CachedGcParams();
-     
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -145,6 +145,13 @@
             iCanvasGc->SetDrawMode(oldDrawMode);
             }
         }
+    else
+        {
+        if ( IsCacheUpdateNeeded() )
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+            }
+        }
 	}
 
 
@@ -156,10 +163,10 @@
     cachedImageParams.iBitmapHandle = aBitmapHandle;
     cachedImageParams.iGcParams = CachedGcParams();
      
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
-
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -174,6 +181,13 @@
             iCanvasGc->SetDrawMode(oldDrawMode);
             }        
         }
+	else
+	    {
+        if ( IsCacheUpdateNeeded() )
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+            }	        
+	    }
 	}
 
 
@@ -186,11 +200,11 @@
     cachedImageParams.iInvertedMask = aInvertMask;
     cachedImageParams.iGcParams = CachedGcParams();
      
-     
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -201,6 +215,13 @@
             iCanvasGc->DrawImage(*texture, destinationRect, aRect, CHuiGc::EStretchNone);
             }
         }
+	else
+	    {
+	    if (IsCacheUpdateNeeded())
+	        {
+	        iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+	        }
+	    }
 	}
 
 
@@ -209,27 +230,26 @@
 	THuiCachedCombinedImageParams cachedCombinedImageParams;	    
     THuiCachedGcParams gcParams = CachedGcParams();          
     TSize imageSize = aDestinationRect.Size();
-    
+
     // Must convert points relative to the image itself
-    RArray<THuiCachedCombinedImageParams> convertedBlits;
+    RArray<THuiCachedCombinedImageParams> convertedBlits;   
+    
     for (TInt i=0; i<aBlits.Count();i++)
         {
         THuiCachedCombinedImageParams convertedParams;
         convertedParams = aBlits[i];
         convertedParams.iCombinedBitmapPoint -= aDestinationRect.iTl;
         convertedBlits.Append(convertedParams);
-        }    
-    
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCombinedCachedImageL(
-        convertedBlits, 
-        gcParams,
-        imageSize, 
-        *iVisual);
-
-    convertedBlits.Close();
+        }       
 
     if (IsRenderingEnabled())
-        {           
+        {    
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCombinedCachedImageL(
+            convertedBlits, 
+            gcParams,
+            imageSize, 
+            *iVisual);
+       
         const CHuiTexture* texture = cachedImage->Texture();        
         if (texture)
             {
@@ -242,6 +262,19 @@
             iCanvasGc->DrawImage(*texture, destinationRect, TRect(TPoint(0,0), texture->Size()),  CHuiGc::EStretchNone);
             }
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCombinedCachedImageL(
+                convertedBlits, 
+                gcParams,
+                imageSize, 
+                *iVisual);
+            }
+        }
+	
+	convertedBlits.Close();
 	}
 
 
@@ -253,10 +286,10 @@
     cachedImageParams.iMaskOriginPoint = aPoint2;
     cachedImageParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
-
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -267,6 +300,13 @@
             iCanvasGc->DrawImage(*texture, destinationRect, aRect, CHuiGc::EStretchNone);
             }             
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+            }
+        }
 	}
 
 void CHuiCanvasWsHwGc::WsResetClippingRegionL()
@@ -431,9 +471,9 @@
     cachedImageParams.iBitmapHandle = aBitmapHandle;
     cachedImageParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -445,6 +485,13 @@
             iCanvasGc->DrawImage(*texture, destinationRect, TRect(TPoint(0,0), texture->Size()), CHuiGc::EStretchFull); 
             }        	
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+            }
+        }
 	}
 
 void CHuiCanvasWsHwGc::WsDrawBitmap2L(TInt aBitmapHandle, TRect aRect1, TRect aRect2)
@@ -453,10 +500,10 @@
     cachedImageParams.iBitmapHandle = aBitmapHandle;
     cachedImageParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
-
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -467,6 +514,13 @@
             iCanvasGc->DrawImage(*texture, destinationRect, aRect2, CHuiGc::EStretchFull); 
             }        
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+            }
+        }
 	}
 
 void CHuiCanvasWsHwGc::WsDrawBitmap3L(TInt aBitmapHandle, TPoint aPoint)
@@ -475,10 +529,10 @@
     cachedImageParams.iBitmapHandle = aBitmapHandle;
     cachedImageParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
-
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -490,6 +544,13 @@
             iCanvasGc->DrawImage(*texture, destinationRect, TRect(TPoint(0,0), texture->Size()), CHuiGc::EStretchNone);
             }        
         }
+	else
+	    {
+	    if (IsCacheUpdateNeeded())
+	        {
+	        iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+	        }
+	    }
 	}
 
 void CHuiCanvasWsHwGc::WsDrawBitmapMaskedL(TInt aBitmapHandle, TInt aMaskHandle, TInt aInvertMask, TRect& aRect1, TRect& aRect2)
@@ -499,11 +560,11 @@
     cachedImageParams.iMaskHandle = aMaskHandle;
     cachedImageParams.iInvertedMask = aInvertMask;
     cachedImageParams.iGcParams = CachedGcParams();
-    
-    const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
-
+        
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasGraphicImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -514,6 +575,13 @@
             iCanvasGc->DrawImage(*texture, destinationRect, aRect2, CHuiGc::EStretchFull);
             }        
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedImageL(cachedImageParams,*iVisual);
+            }
+        }
 	}
 
 void CHuiCanvasWsHwGc::WsDrawRoundRectL(TPoint aPoint, TRect& aRect)
@@ -972,10 +1040,10 @@
     cachedtextParams.iTextParams = aTextParameters;
     cachedtextParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
-
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1004,6 +1072,13 @@
                 }
             }        
         }
+	else
+	    {
+	    if (IsCacheUpdateNeeded())
+	        {
+	        iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+	        }
+	    }
 	}
 
 void CHuiCanvasWsHwGc::WsDrawText2L(TPtr& aTextValue, TPoint& aPoint,THuiCanvasTextParameters& aTextParameters)
@@ -1014,10 +1089,11 @@
     cachedtextParams.iTextParams = aTextParameters;
     cachedtextParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1047,6 +1123,13 @@
                 }
             }
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+            }
+        }
 	}
 
 void CHuiCanvasWsHwGc::WsDrawText3L(TPtr& aTextValue, TRect& aRect, THuiCanvasTextParameters& aTextParameters)
@@ -1058,10 +1141,11 @@
     cachedtextParams.iTextBoxMaxSize = aRect.Size();
     cachedtextParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1092,6 +1176,13 @@
                 }
             }
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+            }
+        }
 	}
 
 
@@ -1107,10 +1198,10 @@
     cachedtextParams.iMargin = aTextMargin;
     cachedtextParams.iGcParams = CachedGcParams();
     
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
-
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1141,6 +1232,13 @@
                 }
             }    
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+            }
+        }
     }
 
 void CHuiCanvasWsHwGc::WsDrawText5L( TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextAlign, TInt aTextMargin,TInt aTextWidth, THuiCanvasTextParameters& aTextParameters)
@@ -1156,10 +1254,11 @@
     cachedtextParams.iTextWidth = aTextWidth;
     cachedtextParams.iGcParams = CachedGcParams();
     
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
-
+    
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1190,6 +1289,13 @@
                 }
             }    
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+            }
+        }
 	}
 	
 void CHuiCanvasWsHwGc::WsDrawTextVertical1L(TPtr& aTextValue, TInt aTextUp, THuiCanvasTextParameters& aTextParameters)	
@@ -1203,11 +1309,12 @@
     cachedtextParams.iTextParams = aTextParameters;
     cachedtextParams.iAngle = angle;
     cachedtextParams.iGcParams = CachedGcParams();
-
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+ 
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1237,6 +1344,13 @@
                 }
             }    
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual);
+            }
+        }
     }
 
 void CHuiCanvasWsHwGc::WsDrawTextVertical2L(TPtr& aTextValue, TInt aTextUp,TPoint& aPoint, THuiCanvasTextParameters& aTextParameters)	
@@ -1249,11 +1363,12 @@
     cachedtextParams.iTextParams = aTextParameters;
     cachedtextParams.iAngle = angle;
     cachedtextParams.iGcParams = CachedGcParams();
-	
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+	 
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual);
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1283,6 +1398,13 @@
                 }
             }
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual);
+            }
+        }
     }
 
 void CHuiCanvasWsHwGc::WsDrawTextVertical3L(TPtr& aTextValue, TInt aTextUp, TRect& aRect, THuiCanvasTextParameters& aTextParameters)	
@@ -1297,10 +1419,11 @@
     cachedtextParams.iAngle = angle;
     cachedtextParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1331,13 +1454,19 @@
                 }
             }
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+            }
+        }
     }
 
 void CHuiCanvasWsHwGc::WsDrawTextVertical4L(TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextUp, TInt aTextAlign, TInt aTextMargin,THuiCanvasTextParameters& aTextParameters)
     {
     TInt angle = aTextUp ? -90 : 90;
 
-
     THuiCachedTextParams cachedtextParams;
     cachedtextParams.iFindTextPtr = &aTextValue;
     cachedtextParams.iFontHandle = iWsCurrentFont;
@@ -1349,10 +1478,11 @@
     cachedtextParams.iMargin = aTextMargin;
     cachedtextParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1383,6 +1513,13 @@
                 }
             }
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+            }
+        }
     }
 
 void CHuiCanvasWsHwGc::WsDrawTextVertical5L(TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextUp, TInt aTextAlign, TInt aTextMargin, TInt aTextWidth, THuiCanvasTextParameters& aTextParameters)
@@ -1401,10 +1538,11 @@
     cachedtextParams.iMargin = aTextMargin;
     cachedtextParams.iGcParams = CachedGcParams();
 
-    const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
 
     if (IsRenderingEnabled())
         {           
+        const CHuiCanvasTextImage* cachedImage = iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+        
         const CHuiTexture* texture = cachedImage->Texture();
         if (texture)
             {
@@ -1435,6 +1573,13 @@
                 }
             }
         }
+    else
+        {
+        if (IsCacheUpdateNeeded())
+            {
+            iVisual->Env().CanvasTextureCache().CreateCachedTextL(cachedtextParams,*iVisual); 
+            }
+        }
     }
 
 void CHuiCanvasWsHwGc::WsMoveToL( TPoint& aPoint)
@@ -2309,3 +2454,14 @@
     iCanvasGc->SetPenWidth(iOldPenWidth);
     iCanvasGc->SetPolygonDrawMode(iOldPolygonDrawMode);
     }
+
+TBool CHuiCanvasWsHwGc::IsCacheUpdateNeeded() const
+    {
+    TBool result = ETrue;
+    if ( iVisual )
+        {
+        result = IsRenderingEnabled() || iVisual->KeepCache();
+        }
+    return result;
+    }
+