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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 2791043002: Draw recorded content directly into the containing PaintCanvas, when possible. (Closed)
Patch Set: none Created 3 years, 9 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/core/svg/graphics/SVGImage.cpp
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
index 1e0702f1115eb21f8a86628670b5048aa03a0a3c..4706881407ba500daccb0310a707313ec4c61131 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -438,6 +438,36 @@ sk_sp<PaintRecord> SVGImage::paintRecordForCurrentFrame(const FloatRect& bounds,
return builder.endRecording();
}
+void SVGImage::paintCurrentFrame(const FloatRect& bounds,
wkorman 2017/04/01 00:32:40 This looks identical to SVGImage::paintRecordForCu
chrishtr 2017/04/01 04:05:47 Good idea, done.
+ const KURL& url,
+ PaintCanvas& canvas) {
+ DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ DCHECK(m_page);
+ FrameView* view = toLocalFrame(m_page->mainFrame())->view();
+ view->resize(containerSize());
+
+ // Always call processUrlFragment, even if the url is empty, because
+ // there may have been a previous url/fragment that needs to be reset.
+ view->processUrlFragment(url);
+
+ // If the image was reset, we need to rewind the timeline back to 0. This
+ // needs to be done before painting, or else we wouldn't get the correct
+ // reset semantics (we'd paint the "last" frame rather than the one at
+ // time=0.) The reason we do this here and not in resetAnimation() is to
+ // avoid setting timers from the latter.
+ flushPendingTimelineRewind();
+
+ IntRect intBounds(enclosingIntRect(bounds));
+ PaintRecordBuilder builder(intBounds, nullptr, nullptr,
+ m_paintController.get());
+
+ view->updateAllLifecyclePhasesExceptPaint();
+ view->paint(builder.context(), CullRect(intBounds));
+ DCHECK(!view->needsLayout());
+
+ builder.endRecording(canvas);
+}
+
void SVGImage::drawInternal(PaintCanvas* canvas,
const PaintFlags& flags,
const FloatRect& dstRect,
@@ -466,7 +496,7 @@ void SVGImage::drawInternal(PaintCanvas* canvas,
canvas->save();
canvas->clipRect(enclosingIntRect(dstRect));
canvas->concat(affineTransformToSkMatrix(transform));
- canvas->PlaybackPaintRecord(paintRecordForCurrentFrame(srcRect, url));
+ paintCurrentFrame(srcRect, url, *canvas);
canvas->restore();
}

Powered by Google App Engine
This is Rietveld 408576698