| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 chunk.properties = properties; | 70 chunk.properties = properties; |
| 71 m_paintChunks.append(chunk); | 71 m_paintChunks.append(chunk); |
| 72 return *this; | 72 return *this; |
| 73 } | 73 } |
| 74 | 74 |
| 75 TestPaintArtifact& TestPaintArtifact::rectDrawing(const FloatRect& bounds, Color
color) | 75 TestPaintArtifact& TestPaintArtifact::rectDrawing(const FloatRect& bounds, Color
color) |
| 76 { | 76 { |
| 77 OwnPtr<DummyRectClient> client = adoptPtr(new DummyRectClient(bounds, color)
); | 77 OwnPtr<DummyRectClient> client = adoptPtr(new DummyRectClient(bounds, color)
); |
| 78 m_displayItemList.allocateAndConstruct<DrawingDisplayItem>( | 78 m_displayItemList.allocateAndConstruct<DrawingDisplayItem>( |
| 79 *client, DisplayItem::DrawingFirst, client->makePicture()); | 79 *client, DisplayItem::DrawingFirst, client->makePicture()); |
| 80 m_dummyClients.append(client.release()); | 80 m_dummyClients.append(std::move(client)); |
| 81 return *this; | 81 return *this; |
| 82 } | 82 } |
| 83 | 83 |
| 84 TestPaintArtifact& TestPaintArtifact::foreignLayer(const FloatPoint& location, c
onst IntSize& size, scoped_refptr<cc::Layer> layer) | 84 TestPaintArtifact& TestPaintArtifact::foreignLayer(const FloatPoint& location, c
onst IntSize& size, scoped_refptr<cc::Layer> layer) |
| 85 { | 85 { |
| 86 FloatRect floatBounds(location, FloatSize(size)); | 86 FloatRect floatBounds(location, FloatSize(size)); |
| 87 OwnPtr<DummyRectClient> client = adoptPtr(new DummyRectClient(floatBounds, C
olor::transparent)); | 87 OwnPtr<DummyRectClient> client = adoptPtr(new DummyRectClient(floatBounds, C
olor::transparent)); |
| 88 m_displayItemList.allocateAndConstruct<ForeignLayerDisplayItem>( | 88 m_displayItemList.allocateAndConstruct<ForeignLayerDisplayItem>( |
| 89 *client, DisplayItem::ForeignLayerFirst, std::move(layer), location, siz
e); | 89 *client, DisplayItem::ForeignLayerFirst, std::move(layer), location, siz
e); |
| 90 m_dummyClients.append(client.release()); | 90 m_dummyClients.append(std::move(client)); |
| 91 return *this; | 91 return *this; |
| 92 } | 92 } |
| 93 | 93 |
| 94 const PaintArtifact& TestPaintArtifact::build() | 94 const PaintArtifact& TestPaintArtifact::build() |
| 95 { | 95 { |
| 96 if (m_built) | 96 if (m_built) |
| 97 return m_paintArtifact; | 97 return m_paintArtifact; |
| 98 | 98 |
| 99 if (!m_paintChunks.isEmpty()) | 99 if (!m_paintChunks.isEmpty()) |
| 100 m_paintChunks.last().endIndex = m_displayItemList.size(); | 100 m_paintChunks.last().endIndex = m_displayItemList.size(); |
| 101 m_paintArtifact = PaintArtifact(std::move(m_displayItemList), std::move(m_pa
intChunks)); | 101 m_paintArtifact = PaintArtifact(std::move(m_displayItemList), std::move(m_pa
intChunks)); |
| 102 m_built = true; | 102 m_built = true; |
| 103 return m_paintArtifact; | 103 return m_paintArtifact; |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |