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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.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/platform/graphics/paint/PaintArtifact.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
index 1190f93debb49d43557e3ab20de59c1eac4728dc..a3ad96af48dbe6857fccb2ec32f6644f82ea2647 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
@@ -85,29 +85,36 @@ size_t PaintArtifact::approximateUnsharedMemoryUsage() const {
}
void PaintArtifact::replay(const FloatRect& bounds,
- GraphicsContext& graphicsContext,
- const PropertyTreeState& replayState) const {
+ GraphicsContext& graphicsContext) const {
TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay");
if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
for (const DisplayItem& displayItem : m_displayItemList)
displayItem.replay(graphicsContext);
} else {
- std::unique_ptr<GeometryMapper> geometryMapper = GeometryMapper::create();
- Vector<const PaintChunk*> pointerPaintChunks;
- pointerPaintChunks.reserveInitialCapacity(paintChunks().size());
-
- // TODO(chrishtr): it's sad to have to copy this vector just to turn
- // references into pointers.
- for (const auto& chunk : paintChunks())
- pointerPaintChunks.push_back(&chunk);
- scoped_refptr<cc::DisplayItemList> displayItemList =
- PaintChunksToCcLayer::convert(pointerPaintChunks, replayState,
- gfx::Vector2dF(), getDisplayItemList(),
- *geometryMapper);
- graphicsContext.canvas()->drawDisplayItemList(displayItemList);
+ replay(bounds, *graphicsContext.canvas());
}
}
+void PaintArtifact::replay(const FloatRect& bounds,
+ PaintCanvas& canvas,
+ const PropertyTreeState& replayState) const {
+ TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay");
+ DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ std::unique_ptr<GeometryMapper> geometryMapper = GeometryMapper::create();
+ Vector<const PaintChunk*> pointerPaintChunks;
+ pointerPaintChunks.reserveInitialCapacity(paintChunks().size());
+
+ // TODO(chrishtr): it's sad to have to copy this vector just to turn
+ // references into pointers.
+ for (const auto& chunk : paintChunks())
+ pointerPaintChunks.push_back(&chunk);
+ scoped_refptr<cc::DisplayItemList> displayItemList =
+ PaintChunksToCcLayer::convert(pointerPaintChunks, replayState,
+ gfx::Vector2dF(), getDisplayItemList(),
+ *geometryMapper);
+ canvas.drawDisplayItemList(displayItemList);
+}
+
DISABLE_CFI_PERF
void PaintArtifact::appendToWebDisplayItemList(WebDisplayItemList* list) const {
TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList");

Powered by Google App Engine
This is Rietveld 408576698