Make picture backed images sRGB by default

This adds support for playing back a picture image in a different
color space. This is currently limited to just the original space
(sRGB) or legacy mode. I think the best next step is to make them
fully flexible (playing back in the destination surface's space),
but that's going to involve changes to caching logic. I'd like to
keep that separate.

BUG=skia:

Change-Id: I15e6d44e977328b06a4da008ff7b2ed88d851a0b
Reviewed-on: https://skia-review.googlesource.com/5777
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index f18eea3..21b112f 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -233,9 +233,7 @@
 
     {
         ScopedGenerator generator(fSharedGenerator);
-        SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(),
-                                           cacheInfo.width(), cacheInfo.height());
-        tex.reset(generator->generateTexture(nullptr, subset));
+        tex.reset(generator->generateTexture(nullptr, cacheInfo, fOrigin));
     }
     if (!tex) {
         bitmap->reset();
@@ -541,22 +539,21 @@
         }
     }
 
+    // The CachedFormat is both an index for which cache "slot" we'll use to store this particular
+    // decoded variant of the encoded data, and also a recipe for how to transform the original
+    // info to get the one that we're going to decode to.
+    SkImageInfo cacheInfo = this->buildCacheInfo(format);
+
     // 2. Ask the generator to natively create one
     {
         ScopedGenerator generator(fSharedGenerator);
-        SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width(), fInfo.height());
-        if (GrTexture* tex = generator->generateTexture(ctx, subset)) {
+        if (GrTexture* tex = generator->generateTexture(ctx, cacheInfo, fOrigin)) {
             SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath,
                                      kLockTexturePathCount);
             return set_key_and_return(tex, key);
         }
     }
 
-    // The CachedFormat is both an index for which cache "slot" we'll use to store this particular
-    // decoded variant of the encoded data, and also a recipe for how to transform the original
-    // info to get the one that we're going to decode to.
-    SkImageInfo cacheInfo = this->buildCacheInfo(format);
-
     const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(cacheInfo, *ctx->caps());
 
 #ifdef SK_SUPPORT_COMPRESSED_TEXTURES_IN_CACHERATOR