| 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 11 matching lines...) Expand all Loading... |
| 22 class TestPaintArtifact::DummyRectClient : public DisplayItemClient { | 22 class TestPaintArtifact::DummyRectClient : public DisplayItemClient { |
| 23 USING_FAST_MALLOC(DummyRectClient); | 23 USING_FAST_MALLOC(DummyRectClient); |
| 24 public: | 24 public: |
| 25 DummyRectClient(const FloatRect& rect, Color color) : m_rect(rect), m_color(
color) {} | 25 DummyRectClient(const FloatRect& rect, Color color) : m_rect(rect), m_color(
color) {} |
| 26 String debugName() const final { return "<dummy>"; } | 26 String debugName() const final { return "<dummy>"; } |
| 27 LayoutRect visualRect() const final { return enclosingLayoutRect(m_rect); } | 27 LayoutRect visualRect() const final { return enclosingLayoutRect(m_rect); } |
| 28 PassRefPtr<SkPicture> makePicture() const; | 28 PassRefPtr<SkPicture> makePicture() const; |
| 29 private: | 29 private: |
| 30 FloatRect m_rect; | 30 FloatRect m_rect; |
| 31 Color m_color; | 31 Color m_color; |
| 32 DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 PassRefPtr<SkPicture> TestPaintArtifact::DummyRectClient::makePicture() const | 35 PassRefPtr<SkPicture> TestPaintArtifact::DummyRectClient::makePicture() const |
| 35 { | 36 { |
| 36 SkPictureRecorder recorder; | 37 SkPictureRecorder recorder; |
| 37 SkCanvas* canvas = recorder.beginRecording(m_rect); | 38 SkCanvas* canvas = recorder.beginRecording(m_rect); |
| 38 SkPaint paint; | 39 SkPaint paint; |
| 39 paint.setColor(m_color.rgb()); | 40 paint.setColor(m_color.rgb()); |
| 40 canvas->drawRect(m_rect, paint); | 41 canvas->drawRect(m_rect, paint); |
| 41 return fromSkSp(recorder.finishRecordingAsPicture()); | 42 return fromSkSp(recorder.finishRecordingAsPicture()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return m_paintArtifact; | 99 return m_paintArtifact; |
| 99 | 100 |
| 100 if (!m_paintChunks.isEmpty()) | 101 if (!m_paintChunks.isEmpty()) |
| 101 m_paintChunks.last().endIndex = m_displayItemList.size(); | 102 m_paintChunks.last().endIndex = m_displayItemList.size(); |
| 102 m_paintArtifact = PaintArtifact(std::move(m_displayItemList), std::move(m_pa
intChunks), true); | 103 m_paintArtifact = PaintArtifact(std::move(m_displayItemList), std::move(m_pa
intChunks), true); |
| 103 m_built = true; | 104 m_built = true; |
| 104 return m_paintArtifact; | 105 return m_paintArtifact; |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |