| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/layers/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
| 6 #include "cc/layers/ui_resource_layer_impl.h" | 6 #include "cc/layers/ui_resource_layer_impl.h" |
| 7 #include "cc/resources/ui_resource_bitmap.h" | 7 #include "cc/resources/ui_resource_bitmap.h" |
| 8 #include "cc/resources/ui_resource_client.h" | 8 #include "cc/resources/ui_resource_client.h" |
| 9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 UIResourceId uid) { | 27 UIResourceId uid) { |
| 28 gfx::Rect visible_content_rect(layer_size); | 28 gfx::Rect visible_content_rect(layer_size); |
| 29 scoped_ptr<UIResourceLayerImpl> layer = | 29 scoped_ptr<UIResourceLayerImpl> layer = |
| 30 UIResourceLayerImpl::Create(host_impl->active_tree(), 1); | 30 UIResourceLayerImpl::Create(host_impl->active_tree(), 1); |
| 31 layer->draw_properties().visible_content_rect = visible_content_rect; | 31 layer->draw_properties().visible_content_rect = visible_content_rect; |
| 32 layer->SetBounds(layer_size); | 32 layer->SetBounds(layer_size); |
| 33 layer->SetContentBounds(layer_size); | 33 layer->SetContentBounds(layer_size); |
| 34 layer->CreateRenderSurface(); | 34 layer->CreateRenderSurface(); |
| 35 layer->draw_properties().render_target = layer.get(); | 35 layer->draw_properties().render_target = layer.get(); |
| 36 | 36 |
| 37 SkBitmap skbitmap; | 37 UIResourceBitmap bitmap(bitmap_size.width(), bitmap_size.height(), opaque); |
| 38 skbitmap.setConfig(SkBitmap::kARGB_8888_Config, | |
| 39 bitmap_size.width(), | |
| 40 bitmap_size.height(), | |
| 41 0, | |
| 42 opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); | |
| 43 skbitmap.allocPixels(); | |
| 44 skbitmap.setImmutable(); | |
| 45 UIResourceBitmap bitmap(skbitmap); | |
| 46 | 38 |
| 47 host_impl->CreateUIResource(uid, bitmap); | 39 host_impl->CreateUIResource(uid, bitmap); |
| 48 layer->SetUIResourceId(uid); | 40 layer->SetUIResourceId(uid); |
| 49 | 41 |
| 50 return layer.Pass(); | 42 return layer.Pass(); |
| 51 } | 43 } |
| 52 | 44 |
| 53 void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer, | 45 void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer, |
| 54 size_t expected_quad_size) { | 46 size_t expected_quad_size) { |
| 55 MockQuadCuller quad_culler; | 47 MockQuadCuller quad_culler; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 135 |
| 144 layer = GenerateUIResourceLayer( | 136 layer = GenerateUIResourceLayer( |
| 145 &host_impl, bitmap_size, layer_size, skbitmap_opaque, uid); | 137 &host_impl, bitmap_size, layer_size, skbitmap_opaque, uid); |
| 146 layer->SetContentsOpaque(true); | 138 layer->SetContentsOpaque(true); |
| 147 expected_opaque_bounds = gfx::Rect(layer->bounds()); | 139 expected_opaque_bounds = gfx::Rect(layer->bounds()); |
| 148 OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds); | 140 OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds); |
| 149 } | 141 } |
| 150 | 142 |
| 151 } // namespace | 143 } // namespace |
| 152 } // namespace cc | 144 } // namespace cc |
| OLD | NEW |