aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkImageGenerator.cpp
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 /src/core/SkImageGenerator.cpp
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 'src/core/SkImageGenerator.cpp')
-rw-r--r--src/core/SkImageGenerator.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index 7008e7b42f..c062978f0f 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -57,7 +57,8 @@ 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]) {
+bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace) {
#ifdef SK_DEBUG
// In all cases, we need the sizes array
SkASSERT(sizes);
@@ -89,13 +90,25 @@ bool SkImageGenerator::getYUV8Planes(SkISize sizes[3], void* planes[3], size_t r
(rowBytes[2] >= (size_t)sizes[2].fWidth)));
#endif
- return this->onGetYUV8Planes(sizes, planes, rowBytes);
+ return this->onGetYUV8Planes(sizes, planes, rowBytes, colorSpace);
}
bool SkImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) {
return false;
}
+bool SkImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace) {
+ // In order to maintain compatibility with clients that implemented the original
+ // onGetYUV8Planes interface, we assume that the color space is JPEG.
+ // TODO(rileya): remove this and the old onGetYUV8Planes once clients switch over to
+ // the new interface.
+ if (colorSpace) {
+ *colorSpace = kJPEG_SkYUVColorSpace;
+ }
+ return this->onGetYUV8Planes(sizes, planes, rowBytes);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////////
SkData* SkImageGenerator::onRefEncodedData() {