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

Unified Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp

Issue 1508683002: DeferredImageDecoder: early-out onGetYUV8Planes when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix canYUVDecode enable logic Created 5 years 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: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
index e5a1c88f4df1115947612dde313db1ccba1d5f38..ac7e784e0a0bab87f9cb46f7260ad6cca502aaaf 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "platform/graphics/DeferredImageDecoder.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/graphics/DecodingImageGenerator.h"
#include "platform/graphics/FrameData.h"
#include "platform/graphics/ImageDecodingStore.h"
@@ -58,6 +59,7 @@ DeferredImageDecoder::DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecode
, m_actualDecoder(actualDecoder)
, m_repetitionCount(cAnimationNone)
, m_hasColorProfile(false)
+ , m_canYUVDecode(false)
{
}
@@ -214,9 +216,13 @@ void DeferredImageDecoder::activateLazyDecoding()
{
if (m_frameGenerator)
return;
+
m_size = m_actualDecoder->size();
m_filenameExtension = m_actualDecoder->filenameExtension();
+ // JPEG images support YUV decoding: other decoders do not, WEBP could in future.
+ m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() && (m_filenameExtension == "jpg");
m_hasColorProfile = m_actualDecoder->hasColorProfile();
+
const bool isSingleFrame = m_actualDecoder->repetitionCount() == cAnimationNone || (m_allDataReceived && m_actualDecoder->frameCount() == 1u);
m_frameGenerator = ImageFrameGenerator::create(SkISize::Make(m_actualDecoder->decodedSize().width(), m_actualDecoder->decodedSize().height()), m_data, m_allDataReceived, !isSingleFrame);
}
@@ -276,6 +282,7 @@ PassRefPtr<SkImage> DeferredImageDecoder::createFrameImageAtIndex(size_t index,
return nullptr;
generator->setGenerationId(image->uniqueID());
+ generator->setCanYUVDecode(m_canYUVDecode);
scroggo_chromium 2015/12/07 16:40:02 Can we instead set this in DecodingImageGenerator'
Noel Gordon 2015/12/08 01:40:08 Yeah possible, though I noted the setup / construc
return image.release();
}

Powered by Google App Engine
This is Rietveld 408576698