SkDiscardablePixelRef should favor not decoding to YUV if they already decoded to...
authorvmiura <vmiura@chromium.org>
Mon, 23 Feb 2015 18:59:44 +0000 (10:59 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 23 Feb 2015 18:59:44 +0000 (10:59 -0800)
BUG=skia:
BUG=459760

Review URL: https://codereview.chromium.org/944823004

src/lazy/SkDiscardablePixelRef.h

index 38ff2c4..9fef055 100644 (file)
@@ -53,6 +53,11 @@ private:
                                  void* planes[3],
                                  size_t rowBytes[3],
                                  SkYUVColorSpace* colorSpace) SK_OVERRIDE {
+        // If the image was already decoded with lockPixels(), favor not
+        // re-decoding to YUV8 planes.
+        if (fDiscardableMemory) {
+            return false;
+        }
         return fGenerator->getYUV8Planes(sizes, planes, rowBytes, colorSpace);
     }