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