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

Unified Diff: include/core/SkPixelRef.h

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 | « include/core/SkImageGenerator.h ('k') | src/core/SkImageGenerator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPixelRef.h
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 109d3c911e94160569b9bda4fae9ac5cd6ecf313..079422386b6072d0fdc048a2b30ef92841e046e6 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -232,6 +232,7 @@ public:
*/
virtual GrTexture* getTexture() { return NULL; }
+#ifdef SK_SUPPORT_LEGACY_IMAGEGENERATOR_YUV_API
/**
* If any planes or rowBytes is NULL, this should output the sizes and return true
* if it can efficiently return YUV planar data. If it cannot, it should return false.
@@ -247,6 +248,40 @@ public:
SkYUVColorSpace* colorSpace) {
return this->onGetYUV8Planes(sizes, planes, rowBytes, colorSpace);
}
+#endif
+
+ /**
+ * If this pixelref supports returning planar YUV data, return true, and return
+ * the logicalSizes (if not NULL) and the optimalAllocationSizes (if not NULL), where each
+ * array represents [0]=Y, [1]=U, [2]=V
+ *
+ * The optimalAllocationSizes may be the same as the logicalSizes, but they may also be larger
+ * if that will aid the pixelref (for performance).
+ *
+ * If this returns false, the value of the (optional) sizes parameters is undefined.
+ */
+ bool queryYUV8(SkISize logicalSizes[3], SkISize optimalAllocationSizes[3]) {
+ return this->onQueryYUV8(logicalSizes, optimalAllocationSizes);
+ }
+
+ /**
+ * If this pixelref supports returning planar YUV data, and can fulfill the requested
+ * sizes for each plane, return true and write the YUV data into the planes.
+ *
+ * Calling queryYUV8() will return both the logical sizes (W/H) and the optimal-allocation
+ * sizes for the 3 planes. For getYUV8(), tt is legal to pass the logical sizes
+ * (though smaller than those will return false). However, this may
+ * (depending on the implementation) be slower than passing in the optimal-allocation sizes
+ * (or larger). The extra space may allow the implementation to run faster at the cost of
+ * slightly more ram being allocated. There should be no performance penalty for the
+ * allocationSizes to larger than the values in optimalAllocationSizes, as they are just the
+ * minimum sizes for best performance.
+ *
+ * If colorSpace is not NULL, return the corresponding colorSpace for the YUV data.
+ */
+ bool getYUV8(const SkISize allocationSizes[3], void* planes[3], SkYUVColorSpace* colorSpace) {
+ return this->onGetYUV8(allocationSizes, planes, colorSpace);
+ }
bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL);
@@ -335,9 +370,20 @@ protected:
// default impl returns NULL.
virtual SkData* onRefEncodedData();
- // default impl returns false.
+ virtual bool onQueryYUV8(SkISize logicalSizes[3], SkISize optimalAllocationSizes[3]) {
+ return false;
+ }
+
+ virtual bool onGetYUV8(const SkISize sizes[3], void* planes[3], SkYUVColorSpace*) {
+ return false;
+ }
+
+#ifdef SK_SUPPORT_LEGACY_IMAGEGENERATOR_YUV_API
virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
- SkYUVColorSpace* colorSpace);
+ SkYUVColorSpace* colorSpace) {
+ return false;
+ }
+#endif
/**
* Returns the size (in bytes) of the internally allocated memory.
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/core/SkImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698