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

Unified Diff: src/images/SkImageDecoder.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/SkImageDecoder.cpp
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index b25e7dbbab1e9f64d9fe2b36486dbb21f63d66b9..42ab120feaaf1699af5e31adeaf74863d8775987 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -285,3 +285,41 @@ bool SkImageDecoder::DecodeStream(SkStreamRewindable* stream, SkBitmap* bm, SkCo
}
return success;
}
+
+bool SkImageDecoder::getYUVComponentSizes(SkStream* stream, SkISize componentSizes[3]) {
+ return this->onDecodeToYUV(stream, componentSizes, NULL);
+}
+
+bool SkImageDecoder::decodeToYUV(SkStream* stream, SkISize componentSizes[3], void* planes[3],
+ size_t rowBytes[3]) {
+ SkImagePlanes imagePlanes(planes, rowBytes);
+ return this->onDecodeToYUV(stream, componentSizes, &imagePlanes);
+}
+
+SkImagePlanes::SkImagePlanes()
+{
reed1 2014/10/13 13:15:36 nit: place { on the same lines as the constructor
sugoi1 2014/10/14 15:07:36 Code removed
+ for (int i = 0; i < 3; ++i) {
+ m_planes[i] = 0;
reed1 2014/10/13 13:15:35 m_planes[i] = NULL;
sugoi1 2014/10/14 15:07:36 Code removed
+ m_rowBytes[i] = 0;
+ }
+}
+
+SkImagePlanes::SkImagePlanes(void* planes[3], size_t rowBytes[3])
+{
+ for (int i = 0; i < 3; ++i) {
+ m_planes[i] = planes[i];
+ m_rowBytes[i] = rowBytes[i];
+ }
+}
+
+void* SkImagePlanes::plane(int i)
+{
+ SkASSERT((i >= 0) && i < 3);
+ return m_planes[i];
+}
+
+size_t SkImagePlanes::rowBytes(int i) const
+{
+ SkASSERT((i >= 0) && i < 3);
+ return m_rowBytes[i];
+}

Powered by Google App Engine
This is Rietveld 408576698