aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar rileya <rileya@chromium.org>2014-09-12 17:45:58 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-12 17:45:58 -0700
commitabaef86f2b37d8a939506a2076da07f6db456951 (patch)
treee206bd6ee9f049c43c0ba9033c8417bb5008258c /include
parent94c415170b6f62fa80b598fe30bf2f99f0aecf6a (diff)
Add support for the Rec601 YUV color space to GrYUVtoRGBEffect.
R=bsalomon@google.com, senorblanco@chromium.org, sugoi@chromium.org, reed@google.com Author: rileya@chromium.org Review URL: https://codereview.chromium.org/516463005
Diffstat (limited to 'include')
-rw-r--r--include/core/SkImageGenerator.h7
-rw-r--r--include/core/SkImageInfo.h15
-rw-r--r--include/core/SkPixelRef.h11
3 files changed, 28 insertions, 5 deletions
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index 4eb5cf85d6..fc6b1b4421 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -8,8 +8,8 @@
#ifndef SkImageGenerator_DEFINED
#define SkImageGenerator_DEFINED
-#include "SkImageInfo.h"
#include "SkColor.h"
+#include "SkImageInfo.h"
class SkBitmap;
class SkData;
@@ -121,7 +121,8 @@ public:
* associated YUV data into those planes of memory supplied by the caller. It should validate
* that the sizes match what it expected. If the sizes do not match, it should return false.
*/
- bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]);
+ bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace);
protected:
virtual SkData* onRefEncodedData();
@@ -130,6 +131,8 @@ protected:
void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount);
virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]);
+ virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace);
};
#endif // SkImageGenerator_DEFINED
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 6204cb3b81..7fedfa1a4a 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -133,6 +133,21 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
///////////////////////////////////////////////////////////////////////////////
/**
+ * Describes the color space a YUV pixel.
+ */
+enum SkYUVColorSpace {
+ /** Standard JPEG color space. */
+ kJPEG_SkYUVColorSpace,
+ /** SDTV standard Rec. 601 color space. Uses "studio swing" [16, 235] color
+ range. See http://en.wikipedia.org/wiki/Rec._601 for details. */
+ kRec601_SkYUVColorSpace,
+
+ kLastEnum_SkYUVColorSpace = kRec601_SkYUVColorSpace
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
* Describe an image's dimensions and pixel type.
*/
struct SkImageInfo {
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index afab7fad9e..02d696edd8 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -227,9 +227,13 @@ public:
* If all planes and rowBytes are not NULL, then it should copy the associated Y,U,V data
* into those planes of memory supplied by the caller. It should validate that the sizes
* match what it expected. If the sizes do not match, it should return false.
+ *
+ * If colorSpace is not NULL, the YUV color space of the data should be stored in the address
+ * it points at.
*/
- bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) {
- return this->onGetYUV8Planes(sizes, planes, rowBytes);
+ bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace) {
+ return this->onGetYUV8Planes(sizes, planes, rowBytes, colorSpace);
}
bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL);
@@ -319,7 +323,8 @@ protected:
virtual SkData* onRefEncodedData();
// default impl returns false.
- virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]);
+ virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace);
/**
* Returns the size (in bytes) of the internally allocated memory.