| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/playback/display_item_list.h" | 5 #include "cc/playback/display_item_list.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 gfx::Rect merged_drawing_bounds = gfx::Rect(drawing_a_bounds); | 936 gfx::Rect merged_drawing_bounds = gfx::Rect(drawing_a_bounds); |
| 937 merged_drawing_bounds.Union(drawing_b_bounds); | 937 merged_drawing_bounds.Union(drawing_b_bounds); |
| 938 EXPECT_RECT_EQ(merged_drawing_bounds, list->VisualRectForTesting(0)); | 938 EXPECT_RECT_EQ(merged_drawing_bounds, list->VisualRectForTesting(0)); |
| 939 EXPECT_RECT_EQ(drawing_a_bounds, list->VisualRectForTesting(1)); | 939 EXPECT_RECT_EQ(drawing_a_bounds, list->VisualRectForTesting(1)); |
| 940 EXPECT_RECT_EQ(drawing_b_bounds, list->VisualRectForTesting(2)); | 940 EXPECT_RECT_EQ(drawing_b_bounds, list->VisualRectForTesting(2)); |
| 941 EXPECT_RECT_EQ(drawing_b_bounds, list->VisualRectForTesting(3)); | 941 EXPECT_RECT_EQ(drawing_b_bounds, list->VisualRectForTesting(3)); |
| 942 EXPECT_RECT_EQ(drawing_b_bounds, list->VisualRectForTesting(4)); | 942 EXPECT_RECT_EQ(drawing_b_bounds, list->VisualRectForTesting(4)); |
| 943 EXPECT_RECT_EQ(merged_drawing_bounds, list->VisualRectForTesting(5)); | 943 EXPECT_RECT_EQ(merged_drawing_bounds, list->VisualRectForTesting(5)); |
| 944 } | 944 } |
| 945 | 945 |
| 946 TEST(DisplayItemListTest, AppendVisualRectOneFilterNoDrawings) { |
| 947 scoped_refptr<DisplayItemList> list = CreateDefaultList(); |
| 948 |
| 949 // One filter containing no drawings: Bf, Ef |
| 950 |
| 951 gfx::Rect filter_bounds(5, 6, 1, 1); |
| 952 list->CreateAndAppendPairedBeginItemWithVisualRect<FilterDisplayItem>( |
| 953 filter_bounds, FilterOperations(), gfx::RectF(filter_bounds)); |
| 954 |
| 955 list->CreateAndAppendPairedEndItem<EndFilterDisplayItem>(); |
| 956 |
| 957 EXPECT_EQ(2u, list->size()); |
| 958 EXPECT_RECT_EQ(filter_bounds, list->VisualRectForTesting(0)); |
| 959 EXPECT_RECT_EQ(filter_bounds, list->VisualRectForTesting(1)); |
| 960 } |
| 961 |
| 962 TEST(DisplayItemListTest, AppendVisualRectBlockContainingFilterNoDrawings) { |
| 963 scoped_refptr<DisplayItemList> list = CreateDefaultList(); |
| 964 |
| 965 // One block containing one filter and no drawings: B1, Bf, Ef, E1. |
| 966 |
| 967 gfx::Rect clip_bounds(5, 6, 7, 8); |
| 968 list->CreateAndAppendPairedBeginItem<ClipDisplayItem>( |
| 969 clip_bounds, std::vector<SkRRect>(), true); |
| 970 |
| 971 gfx::Rect filter_bounds(5, 6, 1, 1); |
| 972 list->CreateAndAppendPairedBeginItemWithVisualRect<FilterDisplayItem>( |
| 973 filter_bounds, FilterOperations(), gfx::RectF(filter_bounds)); |
| 974 |
| 975 list->CreateAndAppendPairedEndItem<EndFilterDisplayItem>(); |
| 976 list->CreateAndAppendPairedEndItem<EndClipDisplayItem>(); |
| 977 |
| 978 EXPECT_EQ(4u, list->size()); |
| 979 EXPECT_RECT_EQ(filter_bounds, list->VisualRectForTesting(0)); |
| 980 EXPECT_RECT_EQ(filter_bounds, list->VisualRectForTesting(1)); |
| 981 EXPECT_RECT_EQ(filter_bounds, list->VisualRectForTesting(2)); |
| 982 EXPECT_RECT_EQ(filter_bounds, list->VisualRectForTesting(3)); |
| 983 } |
| 984 |
| 946 } // namespace cc | 985 } // namespace cc |
| OLD | NEW |