Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: cc/quads/render_pass_unittest.cc

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittests fixed Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/quads/draw_quad_unittest.cc ('k') | cc/quads/shared_quad_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/quads/render_pass.h" 5 #include "cc/quads/render_pass.h"
6 6
7 #include "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/base/scoped_ptr_vector.h" 8 #include "cc/base/scoped_ptr_vector.h"
9 #include "cc/output/copy_output_request.h" 9 #include "cc/output/copy_output_request.h"
10 #include "cc/quads/checkerboard_draw_quad.h" 10 #include "cc/quads/checkerboard_draw_quad.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); 73 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create();
74 pass->SetAll(id, 74 pass->SetAll(id,
75 output_rect, 75 output_rect,
76 damage_rect, 76 damage_rect,
77 transform_to_root, 77 transform_to_root,
78 has_transparent_background); 78 has_transparent_background);
79 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); 79 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest());
80 80
81 // Stick a quad in the pass, this should not get copied. 81 // Stick a quad in the pass, this should not get copied.
82 scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create(); 82 scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create();
83 shared_state->SetAll( 83 shared_state->SetAll(gfx::Transform(),
84 gfx::Transform(), gfx::Size(), gfx::Rect(), gfx::Rect(), false, 1); 84 gfx::Size(),
85 gfx::Rect(),
86 gfx::Rect(),
87 false,
88 1,
89 SkXfermode::kSrcOver_Mode);
85 pass->AppendSharedQuadState(shared_state.Pass()); 90 pass->AppendSharedQuadState(shared_state.Pass());
86 91
87 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad = 92 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad =
88 CheckerboardDrawQuad::Create(); 93 CheckerboardDrawQuad::Create();
89 checkerboard_quad->SetNew( 94 checkerboard_quad->SetNew(
90 pass->shared_quad_state_list.back(), gfx::Rect(), SkColor()); 95 pass->shared_quad_state_list.back(), gfx::Rect(), SkColor());
91 pass->quad_list.push_back(checkerboard_quad.PassAs<DrawQuad>()); 96 pass->quad_list.push_back(checkerboard_quad.PassAs<DrawQuad>());
92 97
93 RenderPass::Id new_id(63, 4); 98 RenderPass::Id new_id(63, 4);
94 99
(...skipping 24 matching lines...) Expand all
119 124
120 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); 125 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create();
121 pass->SetAll(id, 126 pass->SetAll(id,
122 output_rect, 127 output_rect,
123 damage_rect, 128 damage_rect,
124 transform_to_root, 129 transform_to_root,
125 has_transparent_background); 130 has_transparent_background);
126 131
127 // Two quads using one shared state. 132 // Two quads using one shared state.
128 scoped_ptr<SharedQuadState> shared_state1 = SharedQuadState::Create(); 133 scoped_ptr<SharedQuadState> shared_state1 = SharedQuadState::Create();
129 shared_state1->SetAll( 134 shared_state1->SetAll(gfx::Transform(),
130 gfx::Transform(), gfx::Size(1, 1), gfx::Rect(), gfx::Rect(), false, 1); 135 gfx::Size(1, 1),
136 gfx::Rect(),
137 gfx::Rect(),
138 false,
139 1,
140 SkXfermode::kSrcOver_Mode);
131 pass->AppendSharedQuadState(shared_state1.Pass()); 141 pass->AppendSharedQuadState(shared_state1.Pass());
132 142
133 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad1 = 143 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad1 =
134 CheckerboardDrawQuad::Create(); 144 CheckerboardDrawQuad::Create();
135 checkerboard_quad1->SetNew( 145 checkerboard_quad1->SetNew(
136 pass->shared_quad_state_list.back(), gfx::Rect(1, 1, 1, 1), SkColor()); 146 pass->shared_quad_state_list.back(), gfx::Rect(1, 1, 1, 1), SkColor());
137 pass->quad_list.push_back(checkerboard_quad1.PassAs<DrawQuad>()); 147 pass->quad_list.push_back(checkerboard_quad1.PassAs<DrawQuad>());
138 148
139 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad2 = 149 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad2 =
140 CheckerboardDrawQuad::Create(); 150 CheckerboardDrawQuad::Create();
141 checkerboard_quad2->SetNew( 151 checkerboard_quad2->SetNew(
142 pass->shared_quad_state_list.back(), gfx::Rect(2, 2, 2, 2), SkColor()); 152 pass->shared_quad_state_list.back(), gfx::Rect(2, 2, 2, 2), SkColor());
143 pass->quad_list.push_back(checkerboard_quad2.PassAs<DrawQuad>()); 153 pass->quad_list.push_back(checkerboard_quad2.PassAs<DrawQuad>());
144 154
145 // And two quads using another shared state. 155 // And two quads using another shared state.
146 scoped_ptr<SharedQuadState> shared_state2 = SharedQuadState::Create(); 156 scoped_ptr<SharedQuadState> shared_state2 = SharedQuadState::Create();
147 shared_state2->SetAll( 157 shared_state2->SetAll(gfx::Transform(),
148 gfx::Transform(), gfx::Size(2, 2), gfx::Rect(), gfx::Rect(), false, 1); 158 gfx::Size(2, 2),
159 gfx::Rect(),
160 gfx::Rect(),
161 false,
162 1,
163 SkXfermode::kSrcOver_Mode);
149 pass->AppendSharedQuadState(shared_state2.Pass()); 164 pass->AppendSharedQuadState(shared_state2.Pass());
150 165
151 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad3 = 166 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad3 =
152 CheckerboardDrawQuad::Create(); 167 CheckerboardDrawQuad::Create();
153 checkerboard_quad3->SetNew( 168 checkerboard_quad3->SetNew(
154 pass->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor()); 169 pass->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor());
155 pass->quad_list.push_back(checkerboard_quad3.PassAs<DrawQuad>()); 170 pass->quad_list.push_back(checkerboard_quad3.PassAs<DrawQuad>());
156 171
157 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad4 = 172 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad4 =
158 CheckerboardDrawQuad::Create(); 173 CheckerboardDrawQuad::Create();
(...skipping 10 matching lines...) Expand all
169 bool contrib_has_transparent_background = true; 184 bool contrib_has_transparent_background = true;
170 185
171 scoped_ptr<TestRenderPass> contrib = TestRenderPass::Create(); 186 scoped_ptr<TestRenderPass> contrib = TestRenderPass::Create();
172 contrib->SetAll(contrib_id, 187 contrib->SetAll(contrib_id,
173 contrib_output_rect, 188 contrib_output_rect,
174 contrib_damage_rect, 189 contrib_damage_rect,
175 contrib_transform_to_root, 190 contrib_transform_to_root,
176 contrib_has_transparent_background); 191 contrib_has_transparent_background);
177 192
178 scoped_ptr<SharedQuadState> contrib_shared_state = SharedQuadState::Create(); 193 scoped_ptr<SharedQuadState> contrib_shared_state = SharedQuadState::Create();
179 contrib_shared_state->SetAll( 194 contrib_shared_state->SetAll(gfx::Transform(),
180 gfx::Transform(), gfx::Size(2, 2), gfx::Rect(), gfx::Rect(), false, 1); 195 gfx::Size(2, 2),
196 gfx::Rect(),
197 gfx::Rect(),
198 false,
199 1,
200 SkXfermode::kSrcOver_Mode);
181 contrib->AppendSharedQuadState(contrib_shared_state.Pass()); 201 contrib->AppendSharedQuadState(contrib_shared_state.Pass());
182 202
183 scoped_ptr<CheckerboardDrawQuad> contrib_quad = 203 scoped_ptr<CheckerboardDrawQuad> contrib_quad =
184 CheckerboardDrawQuad::Create(); 204 CheckerboardDrawQuad::Create();
185 contrib_quad->SetNew( 205 contrib_quad->SetNew(
186 contrib->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor()); 206 contrib->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor());
187 contrib->quad_list.push_back(contrib_quad.PassAs<DrawQuad>()); 207 contrib->quad_list.push_back(contrib_quad.PassAs<DrawQuad>());
188 208
189 // And a RenderPassDrawQuad for the contributing pass. 209 // And a RenderPassDrawQuad for the contributing pass.
190 scoped_ptr<RenderPassDrawQuad> pass_quad = RenderPassDrawQuad::Create(); 210 scoped_ptr<RenderPassDrawQuad> pass_quad = RenderPassDrawQuad::Create();
(...skipping 30 matching lines...) Expand all
221 241
222 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); 242 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create();
223 pass->SetAll(id, 243 pass->SetAll(id,
224 output_rect, 244 output_rect,
225 damage_rect, 245 damage_rect,
226 transform_to_root, 246 transform_to_root,
227 has_transparent_background); 247 has_transparent_background);
228 248
229 // A shared state with a quad. 249 // A shared state with a quad.
230 scoped_ptr<SharedQuadState> shared_state1 = SharedQuadState::Create(); 250 scoped_ptr<SharedQuadState> shared_state1 = SharedQuadState::Create();
231 shared_state1->SetAll( 251 shared_state1->SetAll(gfx::Transform(),
232 gfx::Transform(), gfx::Size(1, 1), gfx::Rect(), gfx::Rect(), false, 1); 252 gfx::Size(1, 1),
253 gfx::Rect(),
254 gfx::Rect(),
255 false,
256 1,
257 SkXfermode::kSrcOver_Mode);
233 pass->AppendSharedQuadState(shared_state1.Pass()); 258 pass->AppendSharedQuadState(shared_state1.Pass());
234 259
235 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad1 = 260 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad1 =
236 CheckerboardDrawQuad::Create(); 261 CheckerboardDrawQuad::Create();
237 checkerboard_quad1->SetNew( 262 checkerboard_quad1->SetNew(
238 pass->shared_quad_state_list.back(), gfx::Rect(1, 1, 1, 1), SkColor()); 263 pass->shared_quad_state_list.back(), gfx::Rect(1, 1, 1, 1), SkColor());
239 pass->quad_list.push_back(checkerboard_quad1.PassAs<DrawQuad>()); 264 pass->quad_list.push_back(checkerboard_quad1.PassAs<DrawQuad>());
240 265
241 // A shared state with no quads, they were culled. 266 // A shared state with no quads, they were culled.
242 scoped_ptr<SharedQuadState> shared_state2 = SharedQuadState::Create(); 267 scoped_ptr<SharedQuadState> shared_state2 = SharedQuadState::Create();
243 shared_state2->SetAll( 268 shared_state2->SetAll(gfx::Transform(),
244 gfx::Transform(), gfx::Size(2, 2), gfx::Rect(), gfx::Rect(), false, 1); 269 gfx::Size(2, 2),
270 gfx::Rect(),
271 gfx::Rect(),
272 false,
273 1,
274 SkXfermode::kSrcOver_Mode);
245 pass->AppendSharedQuadState(shared_state2.Pass()); 275 pass->AppendSharedQuadState(shared_state2.Pass());
246 276
247 // A second shared state with no quads. 277 // A second shared state with no quads.
248 scoped_ptr<SharedQuadState> shared_state3 = SharedQuadState::Create(); 278 scoped_ptr<SharedQuadState> shared_state3 = SharedQuadState::Create();
249 shared_state3->SetAll( 279 shared_state3->SetAll(gfx::Transform(),
250 gfx::Transform(), gfx::Size(2, 2), gfx::Rect(), gfx::Rect(), false, 1); 280 gfx::Size(2, 2),
281 gfx::Rect(),
282 gfx::Rect(),
283 false,
284 1,
285 SkXfermode::kSrcOver_Mode);
251 pass->AppendSharedQuadState(shared_state3.Pass()); 286 pass->AppendSharedQuadState(shared_state3.Pass());
252 287
253 // A last shared state with a quad again. 288 // A last shared state with a quad again.
254 scoped_ptr<SharedQuadState> shared_state4 = SharedQuadState::Create(); 289 scoped_ptr<SharedQuadState> shared_state4 = SharedQuadState::Create();
255 shared_state4->SetAll( 290 shared_state4->SetAll(gfx::Transform(),
256 gfx::Transform(), gfx::Size(2, 2), gfx::Rect(), gfx::Rect(), false, 1); 291 gfx::Size(2, 2),
292 gfx::Rect(),
293 gfx::Rect(),
294 false,
295 1,
296 SkXfermode::kSrcOver_Mode);
257 pass->AppendSharedQuadState(shared_state4.Pass()); 297 pass->AppendSharedQuadState(shared_state4.Pass());
258 298
259 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad2 = 299 scoped_ptr<CheckerboardDrawQuad> checkerboard_quad2 =
260 CheckerboardDrawQuad::Create(); 300 CheckerboardDrawQuad::Create();
261 checkerboard_quad2->SetNew( 301 checkerboard_quad2->SetNew(
262 pass->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor()); 302 pass->shared_quad_state_list.back(), gfx::Rect(3, 3, 3, 3), SkColor());
263 pass->quad_list.push_back(checkerboard_quad2.PassAs<DrawQuad>()); 303 pass->quad_list.push_back(checkerboard_quad2.PassAs<DrawQuad>());
264 304
265 pass_list.push_back(pass.PassAs<RenderPass>()); 305 pass_list.push_back(pass.PassAs<RenderPass>());
266 306
267 // Make a copy with CopyAll(). 307 // Make a copy with CopyAll().
268 RenderPassList copy_list; 308 RenderPassList copy_list;
269 RenderPass::CopyAll(pass_list, &copy_list); 309 RenderPass::CopyAll(pass_list, &copy_list);
270 310
271 CompareRenderPassLists(pass_list, copy_list); 311 CompareRenderPassLists(pass_list, copy_list);
272 } 312 }
273 313
274 } // namespace 314 } // namespace
275 } // namespace cc 315 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/draw_quad_unittest.cc ('k') | cc/quads/shared_quad_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698