JPEG YUV Decoding
Enabling JPEG YUV Decoding in Skia
BUG=skia:3005, skia:1674, skia:3029
Committed: https://skia.googlesource.com/skia/+/8e6c3b93a39e19111662a760ede97df55e51d39f
Review URL: https://codereview.chromium.org/399683007
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index 3b5cb78..a90c1cf 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -45,6 +45,8 @@
virtual bool onGetPixels(const SkImageInfo& info,
void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount) SK_OVERRIDE;
+ virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
+ SkYUVColorSpace* colorSpace) SK_OVERRIDE;
private:
typedef SkImageGenerator INHERITED;
@@ -204,6 +206,20 @@
return true;
}
+bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3],
+ size_t rowBytes[3], SkYUVColorSpace* colorSpace) {
+ if (!fStream->rewind()) {
+ return false;
+ }
+
+ SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));
+ if (NULL == decoder.get()) {
+ return false;
+ }
+
+ return decoder->decodeYUV8Planes(fStream, sizes, planes, rowBytes, colorSpace);
+}
+
// A contructor-type function that returns NULL on failure. This
// prevents the returned SkImageGenerator from ever being in a bad
// state. Called by both Create() functions