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

Unified Diff: src/image/SkImage.cpp

Issue 1513393002: Add ability to extract YUV planes from SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rename Created 4 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/image/SkImage.cpp
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 25370bcff15e09ad2e7276ec3a98f23e4a79cf35..5c2ea626bc12dc39003b21fccce49b5ae9c89fdb 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -258,6 +258,25 @@ bool SkImage::readPixels(const SkPixmap& pmap, int srcX, int srcY, CachingHint c
return this->readPixels(pmap.info(), pmap.writable_addr(), pmap.rowBytes(), srcX, srcY, chint);
}
+#if SK_SUPPORT_GPU
+#include "GrTextureToYUVPlanes.h"
+#endif
+
+#include "SkRGBAToYUV.h"
+
robertphillips 2016/01/29 20:33:13 overlength ?
bsalomon 2016/02/01 20:27:45 Done.
+bool SkImage::readYUV8Planes(const SkISize sizes[3], void* const planes[3], const size_t rowBytes[3],
+ SkYUVColorSpace colorSpace) {
+#if SK_SUPPORT_GPU
+ if (GrTexture* texture = as_IB(this)->peekTexture()) {
+ if (GrTextureToYUVPlanes(texture, sizes, planes, rowBytes, colorSpace)) {
+ return true;
+ }
+ }
+#endif
+ SkRGBAToYUV(this, sizes, planes, rowBytes, colorSpace);
+ return true;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) {

Powered by Google App Engine
This is Rietveld 408576698