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/PaintArtifactToSkCanvas.h" | 5 #include "platform/graphics/paint/PaintArtifactToSkCanvas.h" |
6 | 6 |
7 #include "platform/graphics/paint/DisplayItem.h" | 7 #include "platform/graphics/paint/DisplayItem.h" |
8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
9 #include "platform/graphics/paint/PaintArtifact.h" | 9 #include "platform/graphics/paint/PaintArtifact.h" |
10 #include "platform/transforms/TransformationMatrix.h" | 10 #include "platform/transforms/TransformationMatrix.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 class DummyRectClient : public DisplayItemClient { | 63 class DummyRectClient : public DisplayItemClient { |
64 public: | 64 public: |
65 DummyRectClient(const SkRect& rect, SkColor color) : m_rect(rect), m_color(c
olor) {} | 65 DummyRectClient(const SkRect& rect, SkColor color) : m_rect(rect), m_color(c
olor) {} |
66 const SkRect& rect() const { return m_rect; } | 66 const SkRect& rect() const { return m_rect; } |
67 SkColor color() const { return m_color; } | 67 SkColor color() const { return m_color; } |
68 PassRefPtr<SkPicture> makePicture() const { return pictureWithRect(m_rect, m
_color); } | 68 PassRefPtr<SkPicture> makePicture() const { return pictureWithRect(m_rect, m
_color); } |
69 String debugName() const final { return "<dummy>"; } | 69 String debugName() const final { return "<dummy>"; } |
70 IntRect visualRect() const override { return IntRect(); } | 70 IntRect visualRect() const override { return IntRect(); } |
71 | 71 |
72 private: | 72 private: |
| 73 DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION |
73 SkRect m_rect; | 74 SkRect m_rect; |
74 SkColor m_color; | 75 SkColor m_color; |
75 }; | 76 }; |
76 | 77 |
77 TEST(PaintArtifactToSkCanvasTest, Empty) | 78 TEST(PaintArtifactToSkCanvasTest, Empty) |
78 { | 79 { |
79 MockCanvas canvas(kCanvasWidth, kCanvasHeight); | 80 MockCanvas canvas(kCanvasWidth, kCanvasHeight); |
80 EXPECT_CALL(canvas, onDrawRect(_, _, _)).Times(0); | 81 EXPECT_CALL(canvas, onDrawRect(_, _, _)).Times(0); |
81 | 82 |
82 PaintArtifact artifact; | 83 PaintArtifact artifact; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 totalClip.setRect(SkIRect::MakeXYWH(100, 100, 100, 100)); | 285 totalClip.setRect(SkIRect::MakeXYWH(100, 100, 100, 100)); |
285 totalClip.op(SkIRect::MakeXYWH(150, 150, 100, 100), SkRegion::kIntersect_Op)
; | 286 totalClip.op(SkIRect::MakeXYWH(150, 150, 100, 100), SkRegion::kIntersect_Op)
; |
286 EXPECT_CALL(canvas, onDrawRect(client1.rect(), Property(&SkPaint::getColor,
client1.color()), | 287 EXPECT_CALL(canvas, onDrawRect(client1.rect(), Property(&SkPaint::getColor,
client1.color()), |
287 ResultOf(&getCanvasClipAsRegion, Eq(totalClip)))); | 288 ResultOf(&getCanvasClipAsRegion, Eq(totalClip)))); |
288 | 289 |
289 paintArtifactToSkCanvas(artifact, &canvas); | 290 paintArtifactToSkCanvas(artifact, &canvas); |
290 } | 291 } |
291 | 292 |
292 } // namespace | 293 } // namespace |
293 } // namespace blink | 294 } // namespace blink |
OLD | NEW |