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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp

Issue 2751433002: [SPv2] Flatten property trees in PaintRecordBuilder into a single display list. (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 8e1d79b9b1be2af718a1fb8673ec45805c9dee55..920c745fe37b88d3cf555f6c12cf247802003884 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
@@ -4,9 +4,12 @@
#include "platform/graphics/paint/PaintArtifact.h"
+#include "cc/paint/display_item_list.h"
#include "platform/geometry/IntRect.h"
#include "platform/graphics/GraphicsLayer.h"
+#include "platform/graphics/compositing/PaintChunksToCcLayer.h"
#include "platform/graphics/paint/DrawingDisplayItem.h"
+#include "platform/graphics/paint/GeometryMapper.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
#include "public/platform/WebDisplayItemList.h"
#include "third_party/skia/include/core/SkRegion.h"
@@ -81,10 +84,27 @@ size_t PaintArtifact::approximateUnsharedMemoryUsage() const {
m_paintChunks.capacity() * sizeof(m_paintChunks[0]);
}
-void PaintArtifact::replay(GraphicsContext& graphicsContext) const {
+void PaintArtifact::replay(const FloatRect& bounds,
+ GraphicsContext& graphicsContext) const {
TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay");
- for (const DisplayItem& displayItem : m_displayItemList)
- displayItem.replay(graphicsContext);
+ 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, PropertyTreeState::root(), gfx::Vector2dF(),
+ getDisplayItemList(), *geometryMapper);
+ graphicsContext.canvas()->drawDisplayItemList(displayItemList);
+ }
}
DISABLE_CFI_PERF

Powered by Google App Engine
This is Rietveld 408576698