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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 FakeUIResourceLayerTreeHostImpl host_impl(&proxy); | 47 FakeUIResourceLayerTreeHostImpl host_impl(&proxy); |
48 scoped_ptr<NinePatchLayerImpl> layer = | 48 scoped_ptr<NinePatchLayerImpl> layer = |
49 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); | 49 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); |
50 layer->draw_properties().visible_content_rect = visible_content_rect; | 50 layer->draw_properties().visible_content_rect = visible_content_rect; |
51 layer->SetBounds(layer_size); | 51 layer->SetBounds(layer_size); |
52 layer->SetContentBounds(layer_size); | 52 layer->SetContentBounds(layer_size); |
53 layer->CreateRenderSurface(); | 53 layer->CreateRenderSurface(); |
54 layer->draw_properties().render_target = layer.get(); | 54 layer->draw_properties().render_target = layer.get(); |
55 | 55 |
56 UIResourceId uid = 1; | 56 UIResourceId uid = 1; |
57 SkBitmap skbitmap; | 57 UIResourceBitmap bitmap(bitmap_size.width(), bitmap_size.height()); |
58 skbitmap.setConfig( | |
59 SkBitmap::kARGB_8888_Config, bitmap_size.width(), bitmap_size.height()); | |
60 skbitmap.allocPixels(); | |
61 skbitmap.setImmutable(); | |
62 UIResourceBitmap bitmap(skbitmap); | |
63 | 58 |
64 host_impl.CreateUIResource(uid, bitmap); | 59 host_impl.CreateUIResource(uid, bitmap); |
65 layer->SetUIResourceId(uid); | 60 layer->SetUIResourceId(uid); |
66 layer->SetImageBounds(bitmap_size); | 61 layer->SetImageBounds(bitmap_size); |
67 layer->SetLayout(aperture_rect, border, fill_center); | 62 layer->SetLayout(aperture_rect, border, fill_center); |
68 AppendQuadsData data; | 63 AppendQuadsData data; |
69 layer->AppendQuads(&quad_culler, &data); | 64 layer->AppendQuads(&quad_culler, &data); |
70 | 65 |
71 // Verify quad rects | 66 // Verify quad rects |
72 const QuadList& quads = quad_culler.quad_list(); | 67 const QuadList& quads = quad_culler.quad_list(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 NinePatchLayerLayoutTest(bitmap_size, | 146 NinePatchLayerLayoutTest(bitmap_size, |
152 aperture_rect, | 147 aperture_rect, |
153 layer_size, | 148 layer_size, |
154 border, | 149 border, |
155 fill_center, | 150 fill_center, |
156 expected_quad_size); | 151 expected_quad_size); |
157 } | 152 } |
158 | 153 |
159 } // namespace | 154 } // namespace |
160 } // namespace cc | 155 } // namespace cc |
OLD | NEW |