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

Unified Diff: src/images/SkDecodingImageGenerator.cpp

Issue 374743003: Skia side RGB to YUV gpu conversion (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Ported a minimal set of blink side changes for YUV decoding tests Created 6 years, 5 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 dfa093becc5d5ff7162727729d04e175fe1d18f0..e3760050f672c70246d79bc80d272bb7c9a67e44 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -45,6 +45,7 @@ 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]) SK_OVERRIDE;
private:
typedef SkImageGenerator INHERITED;
@@ -209,6 +210,26 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info,
return true;
}
+bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3],
+ size_t rowBytes[3]) {
+ if (!fStream->rewind()) {
+ return false;
+ }
+
+ SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));
+ if (NULL == decoder.get()) {
+ return false;
+ }
+
+ if (planes && (NULL != planes[0]) && (NULL != planes[1]) && (NULL != planes[2]) &&
+ rowBytes && (0 != rowBytes[0]) && (0 != rowBytes[1]) && (0 != rowBytes[2])) {
+ decoder->setYUVBuffers(planes, rowBytes);
+ return onGetPixels(fInfo, NULL, 0, NULL, NULL);
scroggo 2014/07/18 21:52:41 this->onGetPixels
sugoi1 2014/07/21 16:51:44 Acknowledged.
+ }
+
+ return decoder->getImageFormat(fStream, sizes);
+}
+
// 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