OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/testing/TestPaintArtifact.h" | 5 #include "platform/testing/TestPaintArtifact.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "platform/graphics/paint/DisplayItemClient.h" | 8 #include "platform/graphics/paint/DisplayItemClient.h" |
9 #include "platform/graphics/paint/DrawingDisplayItem.h" | 9 #include "platform/graphics/paint/DrawingDisplayItem.h" |
10 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" | 10 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 PaintChunk chunk; | 67 PaintChunk chunk; |
68 chunk.beginIndex = m_displayItemList.size(); | 68 chunk.beginIndex = m_displayItemList.size(); |
69 chunk.properties = properties; | 69 chunk.properties = properties; |
70 m_paintChunks.append(chunk); | 70 m_paintChunks.append(chunk); |
71 return *this; | 71 return *this; |
72 } | 72 } |
73 | 73 |
74 TestPaintArtifact& TestPaintArtifact::rectDrawing(const FloatRect& bounds, | 74 TestPaintArtifact& TestPaintArtifact::rectDrawing(const FloatRect& bounds, |
75 Color color) { | 75 Color color) { |
76 std::unique_ptr<DummyRectClient> client = | 76 std::unique_ptr<DummyRectClient> client = |
77 makeUnique<DummyRectClient>(bounds, color); | 77 WTF::makeUnique<DummyRectClient>(bounds, color); |
78 m_displayItemList.allocateAndConstruct<DrawingDisplayItem>( | 78 m_displayItemList.allocateAndConstruct<DrawingDisplayItem>( |
79 *client, DisplayItem::kDrawingFirst, client->makePicture()); | 79 *client, DisplayItem::kDrawingFirst, client->makePicture()); |
80 m_dummyClients.append(std::move(client)); | 80 m_dummyClients.append(std::move(client)); |
81 return *this; | 81 return *this; |
82 } | 82 } |
83 | 83 |
84 TestPaintArtifact& TestPaintArtifact::foreignLayer( | 84 TestPaintArtifact& TestPaintArtifact::foreignLayer( |
85 const FloatPoint& location, | 85 const FloatPoint& location, |
86 const IntSize& size, | 86 const IntSize& size, |
87 scoped_refptr<cc::Layer> layer) { | 87 scoped_refptr<cc::Layer> layer) { |
88 FloatRect floatBounds(location, FloatSize(size)); | 88 FloatRect floatBounds(location, FloatSize(size)); |
89 std::unique_ptr<DummyRectClient> client = | 89 std::unique_ptr<DummyRectClient> client = |
90 wrapUnique(new DummyRectClient(floatBounds, Color::transparent)); | 90 WTF::wrapUnique(new DummyRectClient(floatBounds, Color::transparent)); |
91 m_displayItemList.allocateAndConstruct<ForeignLayerDisplayItem>( | 91 m_displayItemList.allocateAndConstruct<ForeignLayerDisplayItem>( |
92 *client, DisplayItem::kForeignLayerFirst, std::move(layer), location, | 92 *client, DisplayItem::kForeignLayerFirst, std::move(layer), location, |
93 size); | 93 size); |
94 m_dummyClients.append(std::move(client)); | 94 m_dummyClients.append(std::move(client)); |
95 return *this; | 95 return *this; |
96 } | 96 } |
97 | 97 |
98 const PaintArtifact& TestPaintArtifact::build() { | 98 const PaintArtifact& TestPaintArtifact::build() { |
99 if (m_built) | 99 if (m_built) |
100 return m_paintArtifact; | 100 return m_paintArtifact; |
101 | 101 |
102 if (!m_paintChunks.isEmpty()) | 102 if (!m_paintChunks.isEmpty()) |
103 m_paintChunks.back().endIndex = m_displayItemList.size(); | 103 m_paintChunks.back().endIndex = m_displayItemList.size(); |
104 m_paintArtifact = PaintArtifact(std::move(m_displayItemList), | 104 m_paintArtifact = PaintArtifact(std::move(m_displayItemList), |
105 std::move(m_paintChunks), true); | 105 std::move(m_paintChunks), true); |
106 m_built = true; | 106 m_built = true; |
107 return m_paintArtifact; | 107 return m_paintArtifact; |
108 } | 108 } |
109 | 109 |
110 } // namespace blink | 110 } // namespace blink |
OLD | NEW |