Index: src/gpu/SkGr.cpp |
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp |
index 9083860db84420fc0bac47c4edaaa2ce3185e189..9bf25d2f89dea8457297181fb53d28c6198af001 100644 |
--- a/src/gpu/SkGr.cpp |
+++ b/src/gpu/SkGr.cpp |
@@ -234,17 +234,18 @@ static GrTexture *load_yuv_texture(GrContext* ctx, bool cache, const GrTexturePa |
planes[1] = (uint8_t*)planes[0] + yuvInfo.fSizeInMemory[0]; |
planes[2] = (uint8_t*)planes[1] + yuvInfo.fSizeInMemory[1]; |
} else { |
+ SkISize optimalAllocationSizes[3]; |
// Fetch yuv plane sizes for memory allocation. Here, width and height can be |
// rounded up to JPEG block size and be larger than the image's width and height. |
- if (!pixelRef->getYUV8Planes(yuvInfo.fSize, NULL, NULL, NULL)) { |
+ if (!pixelRef->queryYUV8(yuvInfo.fSize, optimalAllocationSizes)) { |
return NULL; |
} |
// Allocate the memory for YUV |
size_t totalSize(0); |
for (int i = 0; i < 3; ++i) { |
- yuvInfo.fRowBytes[i] = yuvInfo.fSize[i].fWidth; |
- yuvInfo.fSizeInMemory[i] = yuvInfo.fRowBytes[i] * yuvInfo.fSize[i].fHeight; |
+ yuvInfo.fRowBytes[i] = optimalAllocationSizes[i].width(); |
+ yuvInfo.fSizeInMemory[i] = yuvInfo.fRowBytes[i] * optimalAllocationSizes[i].height(); |
totalSize += yuvInfo.fSizeInMemory[i]; |
} |
cachedData.reset(SkResourceCache::NewCachedData(totalSize)); |
@@ -253,8 +254,7 @@ static GrTexture *load_yuv_texture(GrContext* ctx, bool cache, const GrTexturePa |
planes[2] = (uint8_t*)planes[1] + yuvInfo.fSizeInMemory[1]; |
// Get the YUV planes and update plane sizes to actual image size |
- if (!pixelRef->getYUV8Planes(yuvInfo.fSize, planes, yuvInfo.fRowBytes, |
- &yuvInfo.fColorSpace)) { |
+ if (!pixelRef->getYUV8(optimalAllocationSizes, planes, &yuvInfo.fColorSpace)) { |
return NULL; |
} |