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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 layer_size.height() - border.height()); | 44 layer_size.height() - border.height()); |
45 | 45 |
46 FakeImplProxy proxy; | 46 FakeImplProxy proxy; |
47 TestSharedBitmapManager shared_bitmap_manager; | 47 TestSharedBitmapManager shared_bitmap_manager; |
48 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 48 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); |
49 scoped_ptr<NinePatchLayerImpl> layer = | 49 scoped_ptr<NinePatchLayerImpl> layer = |
50 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); | 50 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); |
51 layer->draw_properties().visible_content_rect = visible_content_rect; | 51 layer->draw_properties().visible_content_rect = visible_content_rect; |
52 layer->SetBounds(layer_size); | 52 layer->SetBounds(layer_size); |
53 layer->SetContentBounds(layer_size); | 53 layer->SetContentBounds(layer_size); |
54 layer->CreateRenderSurface(); | 54 layer->SetHasRenderSurface(true); |
55 layer->draw_properties().render_target = layer.get(); | 55 layer->draw_properties().render_target = layer.get(); |
56 | 56 |
57 UIResourceId uid = 1; | 57 UIResourceId uid = 1; |
58 bool is_opaque = false; | 58 bool is_opaque = false; |
59 UIResourceBitmap bitmap(bitmap_size, is_opaque); | 59 UIResourceBitmap bitmap(bitmap_size, is_opaque); |
60 | 60 |
61 host_impl.CreateUIResource(uid, bitmap); | 61 host_impl.CreateUIResource(uid, bitmap); |
62 layer->SetUIResourceId(uid); | 62 layer->SetUIResourceId(uid); |
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); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 &partially_occluded_count); | 272 &partially_occluded_count); |
273 // The layer outputs nine quads, three of which are partially occluded, and | 273 // The layer outputs nine quads, three of which are partially occluded, and |
274 // three fully occluded. | 274 // three fully occluded. |
275 EXPECT_EQ(6u, impl.quad_list().size()); | 275 EXPECT_EQ(6u, impl.quad_list().size()); |
276 EXPECT_EQ(3u, partially_occluded_count); | 276 EXPECT_EQ(3u, partially_occluded_count); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 } // namespace | 280 } // namespace |
281 } // namespace cc | 281 } // namespace cc |
OLD | NEW |