Chromium Code Reviews| Index: src/gpu/SkGr.cpp |
| diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp |
| index a3972806f7c319df1160ca04980421bf3c97187f..1e5cf3c6fbe6d6c6b0e55ff51458c98849663b07 100644 |
| --- a/src/gpu/SkGr.cpp |
| +++ b/src/gpu/SkGr.cpp |
| @@ -240,17 +240,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)); |
| @@ -259,8 +260,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 |
|
scroggo
2015/01/22 19:47:47
Does this comment still apply?
|
| - if (!pixelRef->getYUV8Planes(yuvInfo.fSize, planes, yuvInfo.fRowBytes, |
| - &yuvInfo.fColorSpace)) { |
| + if (!pixelRef->getYUV8(optimalAllocationSizes, planes, &yuvInfo.fColorSpace)) { |
| return NULL; |
| } |