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

Unified Diff: src/core/SkImageGenerator.cpp

Issue 374743003: Skia side RGB to YUV gpu conversion (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed more comments Created 6 years, 5 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 | « include/core/SkPixelRef.h ('k') | src/gpu/SkGr.cpp » ('j') | src/gpu/SkGr.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageGenerator.cpp
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index daa55a3a4dcbd842f34264f79a8fa18a7f293353..a767cc805218ac622cf6245a6c0cc65fc70ca3b0 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -57,6 +57,40 @@ bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
}
#endif
+bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) {
+#ifdef SK_DEBUG
+ bool isValidWithPlanes =
+ ((NULL != planes[0]) && (NULL != planes[1]) && (NULL != planes[2]) &&
reed1 2014/07/10 18:21:40 if planes is NULL, this will crash! We should add
sugoi1 2014/07/10 19:59:06 Acknowledged. Added the NULL test here, I'll write
sugoi1 2014/07/11 18:46:15 Done.
+ (0 != rowBytes[0]) && (0 != rowBytes[1]) && (0 != rowBytes[2]));
+ bool isValidWithoutPlanes =
+ ((NULL == planes[0]) && (NULL == planes[1]) && (NULL == planes[2]) &&
+ (0 == rowBytes[0]) && (0 == rowBytes[1]) && (0 == rowBytes[2]));
+
+ // Either we have all planes and rowBytes information or we have none of it
+ // Having only partial information is not supported
+ SkASSERT(isValidWithPlanes || isValidWithoutPlanes);
+
+ // If we do have planes information, make sure all sizes are non 0
+ // and all rowBytes are valid
+ SkASSERT(!isValidWithPlanes ||
+ ((sizes[0].fWidth >= 0) &&
+ (sizes[0].fHeight >= 0) &&
+ (sizes[1].fWidth >= 0) &&
+ (sizes[1].fHeight >= 0) &&
+ (sizes[2].fWidth >= 0) &&
+ (sizes[2].fHeight >= 0) &&
+ (rowBytes[0] >= (size_t)sizes[0].fWidth) &&
+ (rowBytes[1] >= (size_t)sizes[1].fWidth) &&
+ (rowBytes[2] >= (size_t)sizes[2].fWidth)));
+#endif
+
+ return this->onGetYUV8Planes(sizes, planes, rowBytes);
+}
+
+bool SkImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) {
+ return false;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////////
SkData* SkImageGenerator::onRefEncodedData() {
« no previous file with comments | « include/core/SkPixelRef.h ('k') | src/gpu/SkGr.cpp » ('j') | src/gpu/SkGr.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698