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

Unified Diff: src/images/SkDecodingImageGenerator.cpp

Issue 399683007: JPEG YUV Decoding (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update from blink's version of YUV decoding Created 6 years, 2 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
Index: src/images/SkDecodingImageGenerator.cpp
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index 3b5cb784edd4254f2c7ce4b51ad7d4c2dfe02b4a..0518a5c0c901cec411300e7c6754f2122cdd2e57 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -45,6 +45,8 @@ protected:
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,24 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info,
return true;
}
+bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3],
+ size_t rowBytes[3], SkYUVColorSpace* colorSpace) {
reed1 2014/10/13 13:15:35 where do we set colorSpace? Seems like we need the
sugoi1 2014/10/14 15:07:36 I set it here. For now I set it unconditionally to
reed1 2014/10/14 15:34:28 I don't see where "here" is.
sugoi1 2014/10/14 15:46:37 Sorry, I meant: in this function (next version of
+ if (!fStream->rewind()) {
+ return false;
+ }
+
+ SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));
+ if (NULL == decoder.get()) {
+ return false;
+ }
+
+ if (!planes || !planes[0]) {
+ return decoder->getYUVComponentSizes(fStream, sizes);
+ }
+
+ return decoder->decodeToYUV(fStream, sizes, planes, rowBytes);
+}
+
// 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

Powered by Google App Engine
This is Rietveld 408576698