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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 uid = 0; | 82 uid = 0; |
83 layer = GenerateUIResourceLayer(&host_impl, | 83 layer = GenerateUIResourceLayer(&host_impl, |
84 bitmap_size, | 84 bitmap_size, |
85 layer_size, | 85 layer_size, |
86 opaque, | 86 opaque, |
87 uid); | 87 uid); |
88 QuadSizeTest(layer.Pass(), expected_quad_size); | 88 QuadSizeTest(layer.Pass(), expected_quad_size); |
89 } | 89 } |
90 | 90 |
91 void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, | 91 void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, |
92 gfx::Rect expected_opaque_bounds) { | 92 const gfx::Rect& expected_opaque_bounds) { |
93 MockQuadCuller quad_culler; | 93 MockQuadCuller quad_culler; |
94 AppendQuadsData data; | 94 AppendQuadsData data; |
95 layer->AppendQuads(&quad_culler, &data); | 95 layer->AppendQuads(&quad_culler, &data); |
96 | 96 |
97 // Verify quad rects | 97 // Verify quad rects |
98 const QuadList& quads = quad_culler.quad_list(); | 98 const QuadList& quads = quad_culler.quad_list(); |
99 EXPECT_GE(quads.size(), (size_t)0); | 99 EXPECT_GE(quads.size(), (size_t)0); |
100 gfx::Rect opaque_rect = quads.at(0)->opaque_rect; | 100 gfx::Rect opaque_rect = quads.at(0)->opaque_rect; |
101 EXPECT_EQ(expected_opaque_bounds, opaque_rect); | 101 EXPECT_EQ(expected_opaque_bounds, opaque_rect); |
102 } | 102 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 layer = GenerateUIResourceLayer( | 144 layer = GenerateUIResourceLayer( |
145 &host_impl, bitmap_size, layer_size, skbitmap_opaque, uid); | 145 &host_impl, bitmap_size, layer_size, skbitmap_opaque, uid); |
146 layer->SetContentsOpaque(true); | 146 layer->SetContentsOpaque(true); |
147 expected_opaque_bounds = gfx::Rect(layer->bounds()); | 147 expected_opaque_bounds = gfx::Rect(layer->bounds()); |
148 OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds); | 148 OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds); |
149 } | 149 } |
150 | 150 |
151 } // namespace | 151 } // namespace |
152 } // namespace cc | 152 } // namespace cc |
OLD | NEW |