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 12 matching lines...) Expand all Loading... |
23 namespace cc { | 23 namespace cc { |
24 namespace { | 24 namespace { |
25 | 25 |
26 gfx::Rect ToRoundedIntRect(const gfx::RectF& rect_f) { | 26 gfx::Rect ToRoundedIntRect(const gfx::RectF& rect_f) { |
27 return gfx::Rect(gfx::ToRoundedInt(rect_f.x()), | 27 return gfx::Rect(gfx::ToRoundedInt(rect_f.x()), |
28 gfx::ToRoundedInt(rect_f.y()), | 28 gfx::ToRoundedInt(rect_f.y()), |
29 gfx::ToRoundedInt(rect_f.width()), | 29 gfx::ToRoundedInt(rect_f.width()), |
30 gfx::ToRoundedInt(rect_f.height())); | 30 gfx::ToRoundedInt(rect_f.height())); |
31 } | 31 } |
32 | 32 |
33 void NinePatchLayerLayoutTest(gfx::Size bitmap_size, | 33 void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size, |
34 const gfx::Rect& aperture_rect, | 34 const gfx::Rect& aperture_rect, |
35 gfx::Size layer_size, | 35 const gfx::Size& layer_size, |
36 const gfx::Rect& border, | 36 const gfx::Rect& border, |
37 bool fill_center, | 37 bool fill_center, |
38 size_t expected_quad_size) { | 38 size_t expected_quad_size) { |
39 MockQuadCuller quad_culler; | 39 MockQuadCuller quad_culler; |
40 gfx::Rect visible_content_rect(layer_size); | 40 gfx::Rect visible_content_rect(layer_size); |
41 gfx::Rect expected_remaining(border.x(), | 41 gfx::Rect expected_remaining(border.x(), |
42 border.y(), | 42 border.y(), |
43 layer_size.width() - border.width(), | 43 layer_size.width() - border.width(), |
44 layer_size.height() - border.height()); | 44 layer_size.height() - border.height()); |
45 | 45 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 NinePatchLayerLayoutTest(bitmap_size, | 151 NinePatchLayerLayoutTest(bitmap_size, |
152 aperture_rect, | 152 aperture_rect, |
153 layer_size, | 153 layer_size, |
154 border, | 154 border, |
155 fill_center, | 155 fill_center, |
156 expected_quad_size); | 156 expected_quad_size); |
157 } | 157 } |
158 | 158 |
159 } // namespace | 159 } // namespace |
160 } // namespace cc | 160 } // namespace cc |
OLD | NEW |