Reapply r1951.



git-svn-id: http://skia.googlecode.com/svn/trunk@1959 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrTexture.cpp b/gpu/src/GrTexture.cpp
index 8df9c9e..360bcf6 100644
--- a/gpu/src/GrTexture.cpp
+++ b/gpu/src/GrTexture.cpp
@@ -29,6 +29,16 @@
                                            config, buffer);
 }
 
+size_t GrRenderTarget::sizeInBytes() const {
+    int colorBits;
+    if (kUnknown_GrPixelConfig == fConfig) {
+        colorBits = 32; // don't know, make a guess
+    } else {
+        colorBits = GrBytesPerPixel(fConfig);
+    }
+    return fWidth * fHeight * (fStencilBits + colorBits);
+}
+
 void GrRenderTarget::flagAsNeedingResolve(const GrIRect* rect) {
     if (kCanResolve_ResolveType == getResolveType()) {
         if (NULL != rect) {
@@ -63,3 +73,4 @@
                                         width, height,
                                         config, buffer);
 }
+