| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
| 6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
| 7 #include "cc/layers/nine_patch_layer_impl.h" | 7 #include "cc/layers/nine_patch_layer_impl.h" |
| 8 #include "cc/quads/texture_draw_quad.h" | 8 #include "cc/quads/texture_draw_quad.h" |
| 9 #include "cc/resources/ui_resource_bitmap.h" | 9 #include "cc/resources/ui_resource_bitmap.h" |
| 10 #include "cc/resources/ui_resource_client.h" | 10 #include "cc/resources/ui_resource_client.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 layer->SetImageBounds(bitmap_size); | 63 layer->SetImageBounds(bitmap_size); |
| 64 layer->SetLayout(aperture_rect, border, fill_center); | 64 layer->SetLayout(aperture_rect, border, fill_center); |
| 65 AppendQuadsData data; | 65 AppendQuadsData data; |
| 66 layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 66 layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); |
| 67 | 67 |
| 68 // Verify quad rects | 68 // Verify quad rects |
| 69 const QuadList& quads = render_pass->quad_list; | 69 const QuadList& quads = render_pass->quad_list; |
| 70 EXPECT_EQ(expected_quad_size, quads.size()); | 70 EXPECT_EQ(expected_quad_size, quads.size()); |
| 71 | 71 |
| 72 Region remaining(visible_content_rect); | 72 Region remaining(visible_content_rect); |
| 73 size_t i = 0; | |
| 74 for (QuadList::ConstIterator iter = quads.begin(); iter != quads.end(); | 73 for (QuadList::ConstIterator iter = quads.begin(); iter != quads.end(); |
| 75 ++iter) { | 74 ++iter) { |
| 76 gfx::Rect quad_rect = iter->rect; | 75 gfx::Rect quad_rect = iter->rect; |
| 77 | 76 |
| 78 EXPECT_TRUE(visible_content_rect.Contains(quad_rect)) << i; | 77 EXPECT_TRUE(visible_content_rect.Contains(quad_rect)) << iter.index(); |
| 79 EXPECT_TRUE(remaining.Contains(quad_rect)) << i; | 78 EXPECT_TRUE(remaining.Contains(quad_rect)) << iter.index(); |
| 80 remaining.Subtract(Region(quad_rect)); | 79 remaining.Subtract(Region(quad_rect)); |
| 81 ++i; | |
| 82 } | 80 } |
| 83 | 81 |
| 84 // Check if the left-over quad is the same size as the mapped aperture quad in | 82 // Check if the left-over quad is the same size as the mapped aperture quad in |
| 85 // layer space. | 83 // layer space. |
| 86 if (!fill_center) { | 84 if (!fill_center) { |
| 87 EXPECT_RECT_EQ(expected_remaining, gfx::ToEnclosedRect(remaining.bounds())); | 85 EXPECT_RECT_EQ(expected_remaining, gfx::ToEnclosedRect(remaining.bounds())); |
| 88 } else { | 86 } else { |
| 89 EXPECT_TRUE(remaining.bounds().IsEmpty()); | 87 EXPECT_TRUE(remaining.bounds().IsEmpty()); |
| 90 } | 88 } |
| 91 | 89 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 impl.quad_list(), occluded, &partially_occluded_count); | 269 impl.quad_list(), occluded, &partially_occluded_count); |
| 272 // The layer outputs nine quads, three of which are partially occluded, and | 270 // The layer outputs nine quads, three of which are partially occluded, and |
| 273 // three fully occluded. | 271 // three fully occluded. |
| 274 EXPECT_EQ(6u, impl.quad_list().size()); | 272 EXPECT_EQ(6u, impl.quad_list().size()); |
| 275 EXPECT_EQ(3u, partially_occluded_count); | 273 EXPECT_EQ(3u, partially_occluded_count); |
| 276 } | 274 } |
| 277 } | 275 } |
| 278 | 276 |
| 279 } // namespace | 277 } // namespace |
| 280 } // namespace cc | 278 } // namespace cc |
| OLD | NEW |