uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp
branchRCL_3
changeset 41 cd0ae4656946
parent 24 f93c875b566e
child 49 c9d868f1e20c
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Wed Jun 09 10:41:25 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Mon Jun 21 16:41:52 2010 +0300
@@ -69,7 +69,7 @@
 
 /** Constant to define target how much memory UI textures should use, 
     this is not a hard limit but effects how long unused textures are cached */
-const TInt KHuiMaxRecommendedTextureAmountInKBytes = 4096;
+const TInt KHuiMaxRecommendedTextureAmountInKBytes = 6114;
 
 /** Constant to define target how much memory UI render buffers should use, 
     this is not a hard limit but effects how long unused render buffers are cached */
@@ -2940,7 +2940,11 @@
         // Always delete bitmaps from unused entries, we can again duplicate pointers from handles when needed.
         // Pointers are kept only for perfromance reasons.
         CHuiCanvasGraphicImage* entry = aIndexEntries[i];
-
+        TBool is16bit = EFalse;
+        if (entry->iBitmap && !entry->iMask && entry->iBitmap->ExtendedBitmapType() == KNullUid && entry->iBitmap->DisplayMode() == EColor64K)
+            {
+            is16bit = ETrue;
+            }
         delete entry->iBitmap;    
         entry->iBitmap = NULL;
 
@@ -2957,7 +2961,7 @@
             }
                     
         TSize textureSize = entry->iTexture->Size();    
-        TInt textureEstimatedSizeInBytes = textureSize.iWidth * textureSize.iHeight * KHuiCanvasImageEstimatedBpp/8.f;
+        TInt textureEstimatedSizeInBytes = textureSize.iWidth * textureSize.iHeight * (is16bit ? KHuiCanvasImageEstimatedBpp/16.f : KHuiCanvasImageEstimatedBpp/8.f);
 
         if (totalUnusedTextureBytes + textureEstimatedSizeInBytes < iUnusedCanvasImageTextureCacheSizeInKBytes*1024)
             {
@@ -3156,8 +3160,14 @@
 
     for(TInt i=imageEntries.Count() - 1; i >= 0; i--)
         {
+        TBool is16bit = EFalse;
+        if (imageEntries[i]->iBitmap && !imageEntries[i]->iMask && imageEntries[i]->iBitmap->ExtendedBitmapType() == KNullUid &&imageEntries[i]->iBitmap->DisplayMode() == EColor64K)
+            {
+            is16bit = ETrue;
+            }
+
         TSize textureSize = imageEntries[i]->iTexture->Size();    
-        totalUnusedTextureBytes += textureSize.iWidth * textureSize.iHeight * KHuiCanvasImageEstimatedBpp/8.f;
+        totalUnusedTextureBytes += textureSize.iWidth * textureSize.iHeight * (is16bit ? KHuiCanvasImageEstimatedBpp/16.f : KHuiCanvasImageEstimatedBpp/8.f);
         }            
     
     imageEntries.Close();