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

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

Issue 2578803002: Remove full-size bitmap copy on SkImage::scalePixels->IFG::decodeAndScale
Patch Set: Created 4 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 29eefb7ce6fda231c01f26935684a23ac5c31bbf..923cc10e10c22dc32c4cbc64855db08df8d37ece 100644
--- a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
@@ -100,6 +100,26 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info,
return decoded;
}
+bool DecodingImageGenerator::onGenerateScaledPixels(
+ const SkISize& scaledSize,
+ const SkIPoint& subsetOrigin,
+ const SkPixmap& subsetPixels,
+ SkFilterQuality quality) {
+ TRACE_EVENT1("blink", "DecodingImageGenerator::onGenerateScaledPixels",
+ "frame index", static_cast<int>(m_frameIndex));
+ // TODO(aleksandar.stojiljkovic): sub-rect decoding, see crbug.com/671821.
+ if (!subsetOrigin.isZero() || subsetPixels.width() != scaledSize.width() ||
+ subsetPixels.height() != subsetPixels.height())
+ return false;
+ PlatformInstrumentation::willDecodeLazyPixelRef(uniqueID());
+ bool decoded = m_frameGenerator->decodeAndScale(
+ m_data.get(), m_allDataReceived, m_frameIndex,
+ getInfo().makeWH(scaledSize.width(), scaledSize.height()),
+ subsetPixels.writable_addr(), subsetPixels.rowBytes(), quality);
+ PlatformInstrumentation::didDecodeLazyPixelRef();
+ return decoded;
+}
+
bool DecodingImageGenerator::onQueryYUV8(SkYUVSizeInfo* sizeInfo,
SkYUVColorSpace* colorSpace) const {
// YUV decoding does not currently support progressive decoding. See comment

Powered by Google App Engine
This is Rietveld 408576698