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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->CreateRenderSurface(); |
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 SkBitmap skbitmap; | 58 bool is_opaque = false; |
59 skbitmap.setConfig( | 59 UIResourceBitmap bitmap(bitmap_size, is_opaque); |
60 SkBitmap::kARGB_8888_Config, bitmap_size.width(), bitmap_size.height()); | |
61 skbitmap.allocPixels(); | |
62 skbitmap.setImmutable(); | |
63 UIResourceBitmap bitmap(skbitmap); | |
64 | 60 |
65 host_impl.CreateUIResource(uid, bitmap); | 61 host_impl.CreateUIResource(uid, bitmap); |
66 layer->SetUIResourceId(uid); | 62 layer->SetUIResourceId(uid); |
67 layer->SetImageBounds(bitmap_size); | 63 layer->SetImageBounds(bitmap_size); |
68 layer->SetLayout(aperture_rect, border, fill_center); | 64 layer->SetLayout(aperture_rect, border, fill_center); |
69 AppendQuadsData data; | 65 AppendQuadsData data; |
70 layer->AppendQuads(&quad_culler, &data); | 66 layer->AppendQuads(&quad_culler, &data); |
71 | 67 |
72 // Verify quad rects | 68 // Verify quad rects |
73 const QuadList& quads = quad_culler.quad_list(); | 69 const QuadList& quads = quad_culler.quad_list(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 NinePatchLayerLayoutTest(bitmap_size, | 148 NinePatchLayerLayoutTest(bitmap_size, |
153 aperture_rect, | 149 aperture_rect, |
154 layer_size, | 150 layer_size, |
155 border, | 151 border, |
156 fill_center, | 152 fill_center, |
157 expected_quad_size); | 153 expected_quad_size); |
158 } | 154 } |
159 | 155 |
160 } // namespace | 156 } // namespace |
161 } // namespace cc | 157 } // namespace cc |
OLD | NEW |