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

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

Issue 1403393004: JPEGImageDecoder RGB565 and downsample support and related Skia imagegenerator changes Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: 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 a1adcce004f065ad73110d3e77733144419bfd66..446d832b6c3cb5c413f56ae9f6560bc57f3a2bb2 100644
--- a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
@@ -72,13 +72,13 @@ 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.
- return false;
+ // So far, only one implemented is RGB565
+ if (info.colorType() != kRGB_565_SkColorType)
+ return false;
}
PlatformInstrumentation::willDecodeLazyPixelRef(m_generationId);
- bool decoded = m_frameGenerator->decodeAndScale(getInfo(), m_frameIndex, pixels, rowBytes);
+ bool decoded = m_frameGenerator->decodeAndScale(info, m_frameIndex, pixels, rowBytes);
PlatformInstrumentation::didDecodeLazyPixelRef();
return decoded;
@@ -125,5 +125,13 @@ SkImageGenerator* DecodingImageGenerator::create(SkData* data)
return new DecodingImageGenerator(frame, info, 0);
}
+bool DecodingImageGenerator::onCanDecodeAndScale(const SkColorType targetType, const SkScalar scale, SkISize *availableSize, SkISize *lowerSize)
scroggo_chromium 2015/10/19 20:41:36 nit: I believe the "*" should go next to the type,
aleksandar.stojiljkovic 2015/10/20 09:51:12 Done.
+{
+ if (targetType == kRGB_565_SkColorType && targetType != getInfo().colorType() && scale == SK_Scalar1) {
+ return m_frameGenerator->canDecodeToRGB565();
+ }
+ return DecodingImageGenerator::onCanDecodeAndScale(targetType, scale, availableSize, lowerSize);
scroggo_chromium 2015/10/19 20:41:36 This looks like infinite recursion, unless I'm mis
aleksandar.stojiljkovic 2015/10/20 09:51:12 Done.
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698