Adding the notion of a volatile bitmap to SkBitmap. 

Volatility is a hint that indicates that the contents of a bitmap 
are ephemeral. SkGpuDevice will not preserve volatile bitmaps
in its texture cache, and will use textures from a pool of
keyless (recyclable) textures to avoid the performance hit of
texture allocation and release.

A subsequent change is required in webkit in order to take advantage
of this optimization. putImageData, and other methods that create
temporary bitmaps will have to mark their bitmaps as volatile.
before rendering them through skia.



git-svn-id: http://skia.googlecode.com/svn/trunk@1769 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 600c336..4f1e6fd 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -97,8 +97,16 @@
 
             // our compressed data will be trimmed, so pass width() for its
             // "rowBytes", since they are the same now.
-            return ctx->createAndLockTexture(key, sampler, desc, storage.get(),
-                                             bitmap->width());
+            
+            if (NULL != key) {
+                return ctx->createAndLockTexture(key, sampler, desc, storage.get(),
+                                                 bitmap->width());
+            } else {
+                GrTextureEntry* entry = ctx->lockKeylessTexture(desc);
+                entry->texture()->uploadTextureData(0, 0, bitmap->width(), 
+                    bitmap->height(), storage.get(), 0);
+                return entry;
+            }
 
         } else {
             origBitmap.copyTo(&tmpBitmap, SkBitmap::kARGB_8888_Config);
@@ -108,8 +116,15 @@
     }
 
     desc.fFormat = SkGr::Bitmap2PixelConfig(*bitmap);
-    return ctx->createAndLockTexture(key, sampler, desc, bitmap->getPixels(),
-                                     bitmap->rowBytes());
+    if (NULL != key) {
+        return ctx->createAndLockTexture(key, sampler, desc, 
+            bitmap->getPixels(), bitmap->rowBytes());
+    } else {
+        GrTextureEntry* entry = ctx->lockKeylessTexture(desc);
+        entry->texture()->uploadTextureData(0, 0, bitmap->width(), 
+            bitmap->height(), bitmap->getPixels(), bitmap->rowBytes());
+        return entry;
+    }
 }
 
 ///////////////////////////////////////////////////////////////////////////////