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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 EXPECT_EQ(actual_index, actual.size()); | 68 EXPECT_EQ(actual_index, actual.size()); |
69 return actual_index == actual.size(); | 69 return actual_index == actual.size(); |
70 } | 70 } |
71 | 71 |
72 #define EXPECT_RESOURCES(expected, actual) \ | 72 #define EXPECT_RESOURCES(expected, actual) \ |
73 EXPECT_TRUE(ResourcesMatch(actual, expected, arraysize(expected))); | 73 EXPECT_TRUE(ResourcesMatch(actual, expected, arraysize(expected))); |
74 | 74 |
75 // These tests deal with delegated renderer layers. | 75 // These tests deal with delegated renderer layers. |
76 class LayerTreeHostDelegatedTest : public LayerTreeTest { | 76 class LayerTreeHostDelegatedTest : public LayerTreeTest { |
77 protected: | 77 protected: |
78 scoped_ptr<DelegatedFrameData> CreateFrameData(gfx::Rect root_output_rect, | 78 scoped_ptr<DelegatedFrameData> CreateFrameData( |
79 gfx::Rect root_damage_rect) { | 79 const gfx::Rect& root_output_rect, |
| 80 const gfx::Rect& root_damage_rect) { |
80 scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); | 81 scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); |
81 | 82 |
82 scoped_ptr<RenderPass> root_pass(RenderPass::Create()); | 83 scoped_ptr<RenderPass> root_pass(RenderPass::Create()); |
83 root_pass->SetNew(RenderPass::Id(1, 1), | 84 root_pass->SetNew(RenderPass::Id(1, 1), |
84 root_output_rect, | 85 root_output_rect, |
85 root_damage_rect, | 86 root_damage_rect, |
86 gfx::Transform()); | 87 gfx::Transform()); |
87 frame->render_pass_list.push_back(root_pass.Pass()); | 88 frame->render_pass_list.push_back(root_pass.Pass()); |
88 return frame.Pass(); | 89 return frame.Pass(); |
89 } | 90 } |
90 | 91 |
91 scoped_ptr<DelegatedFrameData> CreateInvalidFrameData( | 92 scoped_ptr<DelegatedFrameData> CreateInvalidFrameData( |
92 gfx::Rect root_output_rect, | 93 const gfx::Rect& root_output_rect, |
93 gfx::Rect root_damage_rect) { | 94 const gfx::Rect& root_damage_rect) { |
94 scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); | 95 scoped_ptr<DelegatedFrameData> frame(new DelegatedFrameData); |
95 | 96 |
96 scoped_ptr<RenderPass> root_pass(RenderPass::Create()); | 97 scoped_ptr<RenderPass> root_pass(RenderPass::Create()); |
97 root_pass->SetNew(RenderPass::Id(1, 1), | 98 root_pass->SetNew(RenderPass::Id(1, 1), |
98 root_output_rect, | 99 root_output_rect, |
99 root_damage_rect, | 100 root_damage_rect, |
100 gfx::Transform()); | 101 gfx::Transform()); |
101 | 102 |
102 scoped_ptr<SharedQuadState> shared_quad_state = SharedQuadState::Create(); | 103 scoped_ptr<SharedQuadState> shared_quad_state = SharedQuadState::Create(); |
103 | 104 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 gfx::PointF(1.f, 1.f), | 154 gfx::PointF(1.f, 1.f), |
154 SK_ColorTRANSPARENT, | 155 SK_ColorTRANSPARENT, |
155 vertex_opacity, | 156 vertex_opacity, |
156 false); | 157 false); |
157 frame->render_pass_list[0]->shared_quad_state_list.push_back(sqs.Pass()); | 158 frame->render_pass_list[0]->shared_quad_state_list.push_back(sqs.Pass()); |
158 frame->render_pass_list[0]->quad_list.push_back(quad.PassAs<DrawQuad>()); | 159 frame->render_pass_list[0]->quad_list.push_back(quad.PassAs<DrawQuad>()); |
159 } | 160 } |
160 | 161 |
161 void AddRenderPass(DelegatedFrameData* frame, | 162 void AddRenderPass(DelegatedFrameData* frame, |
162 RenderPass::Id id, | 163 RenderPass::Id id, |
163 gfx::Rect output_rect, | 164 const gfx::Rect& output_rect, |
164 gfx::Rect damage_rect, | 165 const gfx::Rect& damage_rect, |
165 const FilterOperations& filters, | 166 const FilterOperations& filters, |
166 const FilterOperations& background_filters) { | 167 const FilterOperations& background_filters) { |
167 for (size_t i = 0; i < frame->render_pass_list.size(); ++i) | 168 for (size_t i = 0; i < frame->render_pass_list.size(); ++i) |
168 DCHECK(id != frame->render_pass_list[i]->id); | 169 DCHECK(id != frame->render_pass_list[i]->id); |
169 | 170 |
170 scoped_ptr<RenderPass> pass(RenderPass::Create()); | 171 scoped_ptr<RenderPass> pass(RenderPass::Create()); |
171 pass->SetNew(id, | 172 pass->SetNew(id, |
172 output_rect, | 173 output_rect, |
173 damage_rect, | 174 damage_rect, |
174 gfx::Transform()); | 175 gfx::Transform()); |
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 } | 2359 } |
2359 | 2360 |
2360 scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 2361 scoped_refptr<DelegatedRendererLayer> delegated_thief_; |
2361 }; | 2362 }; |
2362 | 2363 |
2363 SINGLE_AND_MULTI_THREAD_TEST_F( | 2364 SINGLE_AND_MULTI_THREAD_TEST_F( |
2364 LayerTreeHostDelegatedTestRemoveAndChangeResources); | 2365 LayerTreeHostDelegatedTestRemoveAndChangeResources); |
2365 | 2366 |
2366 } // namespace | 2367 } // namespace |
2367 } // namespace cc | 2368 } // namespace cc |
OLD | NEW |