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

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..f30cb10455ac6a38b3276de91bde8cecc35684bb 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -411,7 +411,8 @@ void SVGImage::draw(PaintCanvas* canvas,
}
sk_sp<PaintRecord> SVGImage::paintRecordForCurrentFrame(const FloatRect& bounds,
- const KURL& url) {
+ const KURL& url,
+ PaintCanvas* canvas) {
DCHECK(m_page);
FrameView* view = toLocalFrame(m_page->mainFrame())->view();
view->resize(containerSize());
@@ -435,6 +436,10 @@ sk_sp<PaintRecord> SVGImage::paintRecordForCurrentFrame(const FloatRect& bounds,
view->paint(builder.context(), CullRect(intBounds));
DCHECK(!view->needsLayout());
+ if (canvas) {
+ builder.endRecording(*canvas);
+ return nullptr;
+ }
return builder.endRecording();
}
@@ -466,7 +471,7 @@ void SVGImage::drawInternal(PaintCanvas* canvas,
canvas->save();
canvas->clipRect(enclosingIntRect(dstRect));
canvas->concat(affineTransformToSkMatrix(transform));
- canvas->PlaybackPaintRecord(paintRecordForCurrentFrame(srcRect, url));
+ paintRecordForCurrentFrame(srcRect, url, canvas);
canvas->restore();
}

Powered by Google App Engine
This is Rietveld 408576698