| 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/graphics/paint/DisplayItemList.h" | 5 #include "platform/graphics/paint/DisplayItemList.h" |
| 6 | 6 |
| 7 #include "SkTypes.h" | 7 #include "SkTypes.h" |
| 8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 9 #include "platform/graphics/paint/PaintFlags.h" | 9 #include "platform/graphics/paint/PaintFlags.h" |
| 10 #include "platform/graphics/paint/PaintRecorder.h" | 10 #include "platform/graphics/paint/PaintRecorder.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 canvas->drawRect( | 41 canvas->drawRect( |
| 42 SkRect::MakeXYWH(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height()), | 42 SkRect::MakeXYWH(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height()), |
| 43 PaintFlags()); | 43 PaintFlags()); |
| 44 return recorder.finishRecordingAsPicture(); | 44 return recorder.finishRecordingAsPicture(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 TEST_F(DisplayItemListTest, AppendVisualRect_Simple) { | 47 TEST_F(DisplayItemListTest, AppendVisualRect_Simple) { |
| 48 IntRect drawing_bounds(5, 6, 7, 8); | 48 IntRect drawing_bounds(5, 6, 7, 8); |
| 49 list_.AllocateAndConstruct<DrawingDisplayItem>( | 49 list_.AllocateAndConstruct<DrawingDisplayItem>( |
| 50 client_, DisplayItem::Type::kDocumentBackground, | 50 client_, DisplayItem::Type::kDocumentBackground, |
| 51 CreateRectRecord(drawing_bounds), true); | 51 CreateRectRecord(drawing_bounds), drawing_bounds, true); |
| 52 list_.AppendVisualRect(drawing_bounds); | 52 list_.AppendVisualRect(drawing_bounds); |
| 53 | 53 |
| 54 EXPECT_EQ(static_cast<size_t>(1), list_.size()); | 54 EXPECT_EQ(static_cast<size_t>(1), list_.size()); |
| 55 EXPECT_RECT_EQ(drawing_bounds, list_.VisualRect(0)); | 55 EXPECT_RECT_EQ(drawing_bounds, list_.VisualRect(0)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 TEST_F(DisplayItemListTest, AppendVisualRect_BlockContainingDrawing) { | 58 TEST_F(DisplayItemListTest, AppendVisualRect_BlockContainingDrawing) { |
| 59 // TODO(wkorman): Note the visual rects for the paired begin/end are now | 59 // TODO(wkorman): Note the visual rects for the paired begin/end are now |
| 60 // irrelevant as they're overwritten in cc::DisplayItemList when rebuilt to | 60 // irrelevant as they're overwritten in cc::DisplayItemList when rebuilt to |
| 61 // represent the union of all drawing display item visual rects between the | 61 // represent the union of all drawing display item visual rects between the |
| 62 // pair. We should consider revising Blink's display item list in some form | 62 // pair. We should consider revising Blink's display item list in some form |
| 63 // so as to only store visual rects for drawing display items. | 63 // so as to only store visual rects for drawing display items. |
| 64 IntRect drawing_bounds(5, 6, 1, 1); | 64 IntRect drawing_bounds(5, 6, 1, 1); |
| 65 list_.AllocateAndConstruct<DrawingDisplayItem>( | 65 list_.AllocateAndConstruct<DrawingDisplayItem>( |
| 66 client_, DisplayItem::Type::kDocumentBackground, | 66 client_, DisplayItem::Type::kDocumentBackground, |
| 67 CreateRectRecord(drawing_bounds), true); | 67 CreateRectRecord(drawing_bounds), drawing_bounds, true); |
| 68 list_.AppendVisualRect(drawing_bounds); | 68 list_.AppendVisualRect(drawing_bounds); |
| 69 | 69 |
| 70 EXPECT_EQ(static_cast<size_t>(1), list_.size()); | 70 EXPECT_EQ(static_cast<size_t>(1), list_.size()); |
| 71 EXPECT_RECT_EQ(drawing_bounds, list_.VisualRect(0)); | 71 EXPECT_RECT_EQ(drawing_bounds, list_.VisualRect(0)); |
| 72 } | 72 } |
| 73 } // namespace | 73 } // namespace |
| 74 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |