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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (!fill_center) { | 82 if (!fill_center) { |
83 EXPECT_RECT_EQ(expected_remaining, gfx::ToEnclosedRect(remaining.bounds())); | 83 EXPECT_RECT_EQ(expected_remaining, gfx::ToEnclosedRect(remaining.bounds())); |
84 } else { | 84 } else { |
85 EXPECT_TRUE(remaining.bounds().IsEmpty()); | 85 EXPECT_TRUE(remaining.bounds().IsEmpty()); |
86 } | 86 } |
87 | 87 |
88 // Verify UV rects | 88 // Verify UV rects |
89 gfx::Rect bitmap_rect(bitmap_size); | 89 gfx::Rect bitmap_rect(bitmap_size); |
90 Region tex_remaining(bitmap_rect); | 90 Region tex_remaining(bitmap_rect); |
91 for (const auto& quad : quads) { | 91 for (const auto& quad : quads) { |
92 const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(&quad); | 92 const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(quad); |
93 gfx::RectF tex_rect = | 93 gfx::RectF tex_rect = |
94 gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right); | 94 gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right); |
95 tex_rect.Scale(bitmap_size.width(), bitmap_size.height()); | 95 tex_rect.Scale(bitmap_size.width(), bitmap_size.height()); |
96 tex_remaining.Subtract(Region(ToRoundedIntRect(tex_rect))); | 96 tex_remaining.Subtract(Region(ToRoundedIntRect(tex_rect))); |
97 } | 97 } |
98 | 98 |
99 if (!fill_center) { | 99 if (!fill_center) { |
100 EXPECT_RECT_EQ(aperture_rect, tex_remaining.bounds()); | 100 EXPECT_RECT_EQ(aperture_rect, tex_remaining.bounds()); |
101 Region aperture_region(aperture_rect); | 101 Region aperture_region(aperture_rect); |
102 EXPECT_EQ(aperture_region, tex_remaining); | 102 EXPECT_EQ(aperture_region, tex_remaining); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 impl.quad_list(), occluded, &partially_occluded_count); | 266 impl.quad_list(), occluded, &partially_occluded_count); |
267 // The layer outputs nine quads, three of which are partially occluded, and | 267 // The layer outputs nine quads, three of which are partially occluded, and |
268 // three fully occluded. | 268 // three fully occluded. |
269 EXPECT_EQ(6u, impl.quad_list().size()); | 269 EXPECT_EQ(6u, impl.quad_list().size()); |
270 EXPECT_EQ(3u, partially_occluded_count); | 270 EXPECT_EQ(3u, partially_occluded_count); |
271 } | 271 } |
272 } | 272 } |
273 | 273 |
274 } // namespace | 274 } // namespace |
275 } // namespace cc | 275 } // namespace cc |
OLD | NEW |