Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: src/gpu/SkGr.cpp

Issue 863053002: new API for retrieving YUV data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698