diff options
author | sugoi <sugoi@chromium.org> | 2014-07-21 11:37:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-21 11:37:39 -0700 |
commit | 518d83dbc1c899e316e8c896af5defb58b83120f (patch) | |
tree | 035e0e6b97af79dc24037c647f6093ad9b33f9a9 /src/core/SkImageGenerator.cpp | |
parent | 02cafcc1bf6e2968c2efdf459871167970da150e (diff) |
Skia side RGB to YUV gpu conversion
This code is the one that's currently working in my local chromium build. A few things still need to be addressed and I'll highlight these directly in the code.
BUG=skia:
R=reed@google.com, bsalomon@google.com, senorblanco@google.com, senorblanco@chromium.org, robertphillips@google.com, scroggo@google.com, halcanary@google.com
Author: sugoi@chromium.org
Review URL: https://codereview.chromium.org/374743003
Diffstat (limited to 'src/core/SkImageGenerator.cpp')
-rw-r--r-- | src/core/SkImageGenerator.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp index daa55a3a4d..551d8f78dc 100644 --- a/src/core/SkImageGenerator.cpp +++ b/src/core/SkImageGenerator.cpp @@ -57,6 +57,45 @@ 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 + // In all cases, we need the sizes array + SkASSERT(NULL != sizes); + + bool isValidWithPlanes = (NULL != planes) && (NULL != rowBytes) && + ((NULL != planes[0]) && (NULL != planes[1]) && (NULL != planes[2]) && + (0 != rowBytes[0]) && (0 != rowBytes[1]) && (0 != rowBytes[2])); + bool isValidWithoutPlanes = + ((NULL == planes) || + ((NULL == planes[0]) && (NULL == planes[1]) && (NULL == planes[2]))) && + ((NULL == rowBytes) || + ((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() { |