Disabled YUV decoding for subsets
authorsugoi <sugoi@chromium.org>
Thu, 16 Oct 2014 12:19:31 +0000 (05:19 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 16 Oct 2014 12:19:31 +0000 (05:19 -0700)
Image subsets were always showing the same tile and were causing an image to be fully YUV decoded once per tile, which was both slow and wrong.

BUG=413001, 419718

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

src/gpu/SkGr.cpp

index fdd4a79e48b22a8dffc74198bf764315f1059666..e7d4ea121f23d7ca45b47130c10563d3dec7f114 100644 (file)
@@ -220,6 +220,12 @@ static GrTexture *load_etc1_texture(GrContext* ctx, bool cache,
 
 static GrTexture *load_yuv_texture(GrContext* ctx, bool cache, const GrTextureParams* params,
                                    const SkBitmap& bm, const GrTextureDesc& desc) {
+    // Subsets are not supported, the whole pixelRef is loaded when using YUV decoding
+    if ((bm.pixelRef()->info().width()  != bm.info().width()) ||
+        (bm.pixelRef()->info().height() != bm.info().height())) {
+        return NULL;
+    }
+
     SkPixelRef* pixelRef = bm.pixelRef();
     SkISize yuvSizes[3];
     if ((NULL == pixelRef) || !pixelRef->getYUV8Planes(yuvSizes, NULL, NULL, NULL)) {