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

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

Issue 1508683002: DeferredImageDecoder: early-out onGetYUV8Planes when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing 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/DecodingImageGenerator.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
index cd34b54fce2c9e1f6bd72e18027b61b6d1c28352..1470a16d38182e6cf04c54c6647dfd62c972dd49 100644
--- a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
@@ -27,7 +27,6 @@
#include "platform/graphics/DecodingImageGenerator.h"
#include "platform/PlatformInstrumentation.h"
-#include "platform/RuntimeEnabledFeatures.h"
#include "platform/SharedBuffer.h"
#include "platform/TraceEvent.h"
#include "platform/graphics/ImageFrameGenerator.h"
@@ -41,6 +40,7 @@ DecodingImageGenerator::DecodingImageGenerator(PassRefPtr<ImageFrameGenerator> f
, m_frameGenerator(frameGenerator)
, m_frameIndex(index)
, m_generationId(0)
+ , m_canYUVDecode(false)
{
}
@@ -63,8 +63,7 @@ SkData* DecodingImageGenerator::onRefEncodedData()
return 0;
}
-bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
- SkPMColor ctable[], int* ctableCount)
+bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor table[], int* tableCount)
{
TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "frame index", static_cast<int>(m_frameIndex));
@@ -73,8 +72,8 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
return false;
if (info.colorType() != getInfo().colorType()) {
- // ImageFrame may have changed the owning SkBitmap to kOpaque_SkAlphaType after sniffing the encoded data, so if we see a request
- // for opaque, that is ok even if our initial alphatype was not opaque.
+ // blink::ImageFrame may have changed the owning SkBitmap to kOpaque_SkAlphaType after fully decoding the image frame,
+ // so if we see a request for opaque, that is ok even if our initial alpha type was not opaque.
return false;
Noel Gordon 2015/12/08 01:48:10 Tried to correct this comment for what blink::Imag
scroggo 2015/12/08 15:11:28 It's trying to explain why we check that the color
}
@@ -87,7 +86,7 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels,
bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], SkYUVColorSpace* colorSpace)
{
- if (!RuntimeEnabledFeatures::decodeToYUVEnabled())
+ if (!m_canYUVDecode)
return false;
bool requestingYUVSizes = !planes || !planes[0];
@@ -97,11 +96,12 @@ bool DecodingImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3],
if (requestingYUVSizes)
return m_frameGenerator->getYUVComponentSizes(sizes);
+ if (colorSpace)
+ *colorSpace = kJPEG_SkYUVColorSpace;
+
PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId);
bool decoded = m_frameGenerator->decodeToYUV(sizes, planes, rowBytes);
PlatformInstrumentation::didDecodeLazyPixelRef();
- if (colorSpace)
- *colorSpace = kJPEG_SkYUVColorSpace;
return decoded;
}

Powered by Google App Engine
This is Rietveld 408576698