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

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: ripple API change to SkPixelRef -- still need to tackle decoders" 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
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;
}

Powered by Google App Engine
This is Rietveld 408576698