| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/paint/PaintArtifact.h" | 5 #include "platform/graphics/paint/PaintArtifact.h" |
| 6 | 6 |
| 7 #include "cc/paint/display_item_list.h" | 7 #include "cc/paint/display_item_list.h" |
| 8 #include "platform/geometry/IntRect.h" | 8 #include "platform/geometry/IntRect.h" |
| 9 #include "platform/graphics/GraphicsLayer.h" | 9 #include "platform/graphics/GraphicsLayer.h" |
| 10 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" | 10 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } else { | 93 } else { |
| 94 replay(bounds, *graphicsContext.canvas()); | 94 replay(bounds, *graphicsContext.canvas()); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 void PaintArtifact::replay(const FloatRect& bounds, | 98 void PaintArtifact::replay(const FloatRect& bounds, |
| 99 PaintCanvas& canvas, | 99 PaintCanvas& canvas, |
| 100 const PropertyTreeState& replayState) const { | 100 const PropertyTreeState& replayState) const { |
| 101 TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay"); | 101 TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay"); |
| 102 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 102 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 103 std::unique_ptr<GeometryMapper> geometryMapper = GeometryMapper::create(); | |
| 104 Vector<const PaintChunk*> pointerPaintChunks; | 103 Vector<const PaintChunk*> pointerPaintChunks; |
| 105 pointerPaintChunks.reserveInitialCapacity(paintChunks().size()); | 104 pointerPaintChunks.reserveInitialCapacity(paintChunks().size()); |
| 106 | 105 |
| 107 // TODO(chrishtr): it's sad to have to copy this vector just to turn | 106 // TODO(chrishtr): it's sad to have to copy this vector just to turn |
| 108 // references into pointers. | 107 // references into pointers. |
| 109 for (const auto& chunk : paintChunks()) | 108 for (const auto& chunk : paintChunks()) |
| 110 pointerPaintChunks.push_back(&chunk); | 109 pointerPaintChunks.push_back(&chunk); |
| 111 scoped_refptr<cc::DisplayItemList> displayItemList = | 110 scoped_refptr<cc::DisplayItemList> displayItemList = |
| 112 PaintChunksToCcLayer::convert(pointerPaintChunks, replayState, | 111 PaintChunksToCcLayer::convert(pointerPaintChunks, replayState, |
| 113 gfx::Vector2dF(), getDisplayItemList(), | 112 gfx::Vector2dF(), getDisplayItemList()); |
| 114 *geometryMapper); | |
| 115 canvas.drawDisplayItemList(displayItemList); | 113 canvas.drawDisplayItemList(displayItemList); |
| 116 } | 114 } |
| 117 | 115 |
| 118 DISABLE_CFI_PERF | 116 DISABLE_CFI_PERF |
| 119 void PaintArtifact::appendToWebDisplayItemList(WebDisplayItemList* list) const { | 117 void PaintArtifact::appendToWebDisplayItemList(WebDisplayItemList* list) const { |
| 120 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList"); | 118 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList"); |
| 121 size_t visualRectIndex = 0; | 119 size_t visualRectIndex = 0; |
| 122 for (const DisplayItem& displayItem : m_displayItemList) { | 120 for (const DisplayItem& displayItem : m_displayItemList) { |
| 123 displayItem.appendToWebDisplayItemList( | 121 displayItem.appendToWebDisplayItemList( |
| 124 m_displayItemList.visualRect(visualRectIndex), list); | 122 m_displayItemList.visualRect(visualRectIndex), list); |
| 125 visualRectIndex++; | 123 visualRectIndex++; |
| 126 } | 124 } |
| 127 list->setIsSuitableForGpuRasterization(isSuitableForGpuRasterization()); | 125 list->setIsSuitableForGpuRasterization(isSuitableForGpuRasterization()); |
| 128 } | 126 } |
| 129 | 127 |
| 130 } // namespace blink | 128 } // namespace blink |
| OLD | NEW |