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