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 17 matching lines...) Expand all Loading... |
28 UIResourceId uid) { | 28 UIResourceId uid) { |
29 gfx::Rect visible_content_rect(layer_size); | 29 gfx::Rect visible_content_rect(layer_size); |
30 scoped_ptr<UIResourceLayerImpl> layer = | 30 scoped_ptr<UIResourceLayerImpl> layer = |
31 UIResourceLayerImpl::Create(host_impl->active_tree(), 1); | 31 UIResourceLayerImpl::Create(host_impl->active_tree(), 1); |
32 layer->draw_properties().visible_content_rect = visible_content_rect; | 32 layer->draw_properties().visible_content_rect = visible_content_rect; |
33 layer->SetBounds(layer_size); | 33 layer->SetBounds(layer_size); |
34 layer->SetContentBounds(layer_size); | 34 layer->SetContentBounds(layer_size); |
35 layer->CreateRenderSurface(); | 35 layer->CreateRenderSurface(); |
36 layer->draw_properties().render_target = layer.get(); | 36 layer->draw_properties().render_target = layer.get(); |
37 | 37 |
38 SkBitmap skbitmap; | 38 UIResourceBitmap bitmap(bitmap_size, opaque); |
39 skbitmap.setConfig(SkBitmap::kARGB_8888_Config, | |
40 bitmap_size.width(), | |
41 bitmap_size.height(), | |
42 0, | |
43 opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); | |
44 skbitmap.allocPixels(); | |
45 skbitmap.setImmutable(); | |
46 UIResourceBitmap bitmap(skbitmap); | |
47 | 39 |
48 host_impl->CreateUIResource(uid, bitmap); | 40 host_impl->CreateUIResource(uid, bitmap); |
49 layer->SetUIResourceId(uid); | 41 layer->SetUIResourceId(uid); |
50 | 42 |
51 return layer.Pass(); | 43 return layer.Pass(); |
52 } | 44 } |
53 | 45 |
54 void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer, | 46 void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer, |
55 size_t expected_quad_size) { | 47 size_t expected_quad_size) { |
56 MockQuadCuller quad_culler; | 48 MockQuadCuller quad_culler; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 occluded, | 198 occluded, |
207 &partially_occluded_count); | 199 &partially_occluded_count); |
208 // The layer outputs one quad, which is partially occluded. | 200 // The layer outputs one quad, which is partially occluded. |
209 EXPECT_EQ(1u, impl.quad_list().size()); | 201 EXPECT_EQ(1u, impl.quad_list().size()); |
210 EXPECT_EQ(1u, partially_occluded_count); | 202 EXPECT_EQ(1u, partially_occluded_count); |
211 } | 203 } |
212 } | 204 } |
213 | 205 |
214 } // namespace | 206 } // namespace |
215 } // namespace cc | 207 } // namespace cc |
OLD | NEW |