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

Side by Side Diff: cc/surfaces/surfaces_pixeltest.cc

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix reflector Created 4 years, 5 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/output/compositor_frame.h" 5 #include "cc/output/compositor_frame.h"
6 #include "cc/quads/render_pass.h" 6 #include "cc/quads/render_pass.h"
7 #include "cc/quads/solid_color_draw_quad.h" 7 #include "cc/quads/solid_color_draw_quad.h"
8 #include "cc/quads/surface_draw_quad.h" 8 #include "cc/quads/surface_draw_quad.h"
9 #include "cc/surfaces/surface.h" 9 #include "cc/surfaces/surface.h"
10 #include "cc/surfaces/surface_aggregator.h" 10 #include "cc/surfaces/surface_aggregator.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 color_quad->SetNew(pass->shared_quad_state_list.back(), 70 color_quad->SetNew(pass->shared_quad_state_list.back(),
71 rect, 71 rect,
72 rect, 72 rect,
73 SK_ColorGREEN, 73 SK_ColorGREEN,
74 force_anti_aliasing_off); 74 force_anti_aliasing_off);
75 75
76 std::unique_ptr<DelegatedFrameData> delegated_frame_data( 76 std::unique_ptr<DelegatedFrameData> delegated_frame_data(
77 new DelegatedFrameData); 77 new DelegatedFrameData);
78 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 78 delegated_frame_data->render_pass_list.push_back(std::move(pass));
79 79
80 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); 80 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create());
81 root_frame->delegated_frame_data = std::move(delegated_frame_data); 81 root_frame->delegated_frame_data = std::move(delegated_frame_data);
82 82
83 SurfaceId root_surface_id = allocator_.GenerateId(); 83 SurfaceId root_surface_id = allocator_.GenerateId();
84 factory_.Create(root_surface_id); 84 factory_.Create(root_surface_id);
85 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame), 85 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
86 SurfaceFactory::DrawCallback()); 86 SurfaceFactory::DrawCallback());
87 87
88 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); 88 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
89 std::unique_ptr<CompositorFrame> aggregated_frame = 89 std::unique_ptr<CompositorFrame> aggregated_frame =
90 aggregator.Aggregate(root_surface_id); 90 aggregator.Aggregate(root_surface_id);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 color_quad->SetNew(pass->shared_quad_state_list.back(), 128 color_quad->SetNew(pass->shared_quad_state_list.back(),
129 rect, 129 rect,
130 rect, 130 rect,
131 SK_ColorYELLOW, 131 SK_ColorYELLOW,
132 force_anti_aliasing_off); 132 force_anti_aliasing_off);
133 133
134 std::unique_ptr<DelegatedFrameData> delegated_frame_data( 134 std::unique_ptr<DelegatedFrameData> delegated_frame_data(
135 new DelegatedFrameData); 135 new DelegatedFrameData);
136 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 136 delegated_frame_data->render_pass_list.push_back(std::move(pass));
137 137
138 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); 138 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create());
139 root_frame->delegated_frame_data = std::move(delegated_frame_data); 139 root_frame->delegated_frame_data = std::move(delegated_frame_data);
140 140
141 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame), 141 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
142 SurfaceFactory::DrawCallback()); 142 SurfaceFactory::DrawCallback());
143 } 143 }
144 144
145 { 145 {
146 gfx::Rect rect(child_size); 146 gfx::Rect rect(child_size);
147 RenderPassId id(1, 1); 147 RenderPassId id(1, 1);
148 std::unique_ptr<RenderPass> pass = RenderPass::Create(); 148 std::unique_ptr<RenderPass> pass = RenderPass::Create();
149 pass->SetNew(id, rect, rect, gfx::Transform()); 149 pass->SetNew(id, rect, rect, gfx::Transform());
150 150
151 CreateAndAppendTestSharedQuadState( 151 CreateAndAppendTestSharedQuadState(
152 pass.get(), gfx::Transform(), child_size); 152 pass.get(), gfx::Transform(), child_size);
153 153
154 SolidColorDrawQuad* color_quad = 154 SolidColorDrawQuad* color_quad =
155 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); 155 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
156 bool force_anti_aliasing_off = false; 156 bool force_anti_aliasing_off = false;
157 color_quad->SetNew(pass->shared_quad_state_list.back(), 157 color_quad->SetNew(pass->shared_quad_state_list.back(),
158 rect, 158 rect,
159 rect, 159 rect,
160 SK_ColorBLUE, 160 SK_ColorBLUE,
161 force_anti_aliasing_off); 161 force_anti_aliasing_off);
162 162
163 std::unique_ptr<DelegatedFrameData> delegated_frame_data( 163 std::unique_ptr<DelegatedFrameData> delegated_frame_data(
164 new DelegatedFrameData); 164 new DelegatedFrameData);
165 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 165 delegated_frame_data->render_pass_list.push_back(std::move(pass));
166 166
167 std::unique_ptr<CompositorFrame> child_frame(new CompositorFrame); 167 std::unique_ptr<CompositorFrame> child_frame(CompositorFrame::Create());
168 child_frame->delegated_frame_data = std::move(delegated_frame_data); 168 child_frame->delegated_frame_data = std::move(delegated_frame_data);
169 169
170 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), 170 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame),
171 SurfaceFactory::DrawCallback()); 171 SurfaceFactory::DrawCallback());
172 } 172 }
173 173
174 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); 174 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
175 std::unique_ptr<CompositorFrame> aggregated_frame = 175 std::unique_ptr<CompositorFrame> aggregated_frame =
176 aggregator.Aggregate(root_surface_id); 176 aggregator.Aggregate(root_surface_id);
177 177
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); 229 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>();
230 right_surface_quad->SetNew(pass->shared_quad_state_list.back(), 230 right_surface_quad->SetNew(pass->shared_quad_state_list.back(),
231 gfx::Rect(child_size), 231 gfx::Rect(child_size),
232 gfx::Rect(child_size), 232 gfx::Rect(child_size),
233 right_child_id); 233 right_child_id);
234 234
235 std::unique_ptr<DelegatedFrameData> delegated_frame_data( 235 std::unique_ptr<DelegatedFrameData> delegated_frame_data(
236 new DelegatedFrameData); 236 new DelegatedFrameData);
237 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 237 delegated_frame_data->render_pass_list.push_back(std::move(pass));
238 238
239 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); 239 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create());
240 root_frame->delegated_frame_data = std::move(delegated_frame_data); 240 root_frame->delegated_frame_data = std::move(delegated_frame_data);
241 241
242 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame), 242 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
243 SurfaceFactory::DrawCallback()); 243 SurfaceFactory::DrawCallback());
244 } 244 }
245 245
246 { 246 {
247 gfx::Rect rect(child_size); 247 gfx::Rect rect(child_size);
248 RenderPassId id(1, 1); 248 RenderPassId id(1, 1);
249 std::unique_ptr<RenderPass> pass = RenderPass::Create(); 249 std::unique_ptr<RenderPass> pass = RenderPass::Create();
(...skipping 16 matching lines...) Expand all
266 bottom_color_quad->SetNew(pass->shared_quad_state_list.back(), 266 bottom_color_quad->SetNew(pass->shared_quad_state_list.back(),
267 gfx::Rect(0, 100, 100, 100), 267 gfx::Rect(0, 100, 100, 100),
268 gfx::Rect(0, 100, 100, 100), 268 gfx::Rect(0, 100, 100, 100),
269 SK_ColorBLUE, 269 SK_ColorBLUE,
270 force_anti_aliasing_off); 270 force_anti_aliasing_off);
271 271
272 std::unique_ptr<DelegatedFrameData> delegated_frame_data( 272 std::unique_ptr<DelegatedFrameData> delegated_frame_data(
273 new DelegatedFrameData); 273 new DelegatedFrameData);
274 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 274 delegated_frame_data->render_pass_list.push_back(std::move(pass));
275 275
276 std::unique_ptr<CompositorFrame> child_frame(new CompositorFrame); 276 std::unique_ptr<CompositorFrame> child_frame(CompositorFrame::Create());
277 child_frame->delegated_frame_data = std::move(delegated_frame_data); 277 child_frame->delegated_frame_data = std::move(delegated_frame_data);
278 278
279 factory_.SubmitCompositorFrame(left_child_id, std::move(child_frame), 279 factory_.SubmitCompositorFrame(left_child_id, std::move(child_frame),
280 SurfaceFactory::DrawCallback()); 280 SurfaceFactory::DrawCallback());
281 } 281 }
282 282
283 { 283 {
284 gfx::Rect rect(child_size); 284 gfx::Rect rect(child_size);
285 RenderPassId id(1, 1); 285 RenderPassId id(1, 1);
286 std::unique_ptr<RenderPass> pass = RenderPass::Create(); 286 std::unique_ptr<RenderPass> pass = RenderPass::Create();
(...skipping 16 matching lines...) Expand all
303 bottom_color_quad->SetNew(pass->shared_quad_state_list.back(), 303 bottom_color_quad->SetNew(pass->shared_quad_state_list.back(),
304 gfx::Rect(0, 100, 100, 100), 304 gfx::Rect(0, 100, 100, 100),
305 gfx::Rect(0, 100, 100, 100), 305 gfx::Rect(0, 100, 100, 100),
306 SK_ColorGREEN, 306 SK_ColorGREEN,
307 force_anti_aliasing_off); 307 force_anti_aliasing_off);
308 308
309 std::unique_ptr<DelegatedFrameData> delegated_frame_data( 309 std::unique_ptr<DelegatedFrameData> delegated_frame_data(
310 new DelegatedFrameData); 310 new DelegatedFrameData);
311 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 311 delegated_frame_data->render_pass_list.push_back(std::move(pass));
312 312
313 std::unique_ptr<CompositorFrame> child_frame(new CompositorFrame); 313 std::unique_ptr<CompositorFrame> child_frame(CompositorFrame::Create());
314 child_frame->delegated_frame_data = std::move(delegated_frame_data); 314 child_frame->delegated_frame_data = std::move(delegated_frame_data);
315 315
316 factory_.SubmitCompositorFrame(right_child_id, std::move(child_frame), 316 factory_.SubmitCompositorFrame(right_child_id, std::move(child_frame),
317 SurfaceFactory::DrawCallback()); 317 SurfaceFactory::DrawCallback());
318 } 318 }
319 319
320 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); 320 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
321 std::unique_ptr<CompositorFrame> aggregated_frame = 321 std::unique_ptr<CompositorFrame> aggregated_frame =
322 aggregator.Aggregate(root_surface_id); 322 aggregator.Aggregate(root_surface_id);
323 323
324 bool discard_alpha = false; 324 bool discard_alpha = false;
325 ExactPixelComparator pixel_comparator(discard_alpha); 325 ExactPixelComparator pixel_comparator(discard_alpha);
326 RenderPassList* pass_list = 326 RenderPassList* pass_list =
327 &aggregated_frame->delegated_frame_data->render_pass_list; 327 &aggregated_frame->delegated_frame_data->render_pass_list;
328 EXPECT_TRUE(RunPixelTest( 328 EXPECT_TRUE(RunPixelTest(
329 pass_list, 329 pass_list,
330 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), 330 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
331 pixel_comparator)); 331 pixel_comparator));
332 332
333 factory_.Destroy(root_surface_id); 333 factory_.Destroy(root_surface_id);
334 factory_.Destroy(left_child_id); 334 factory_.Destroy(left_child_id);
335 factory_.Destroy(right_child_id); 335 factory_.Destroy(right_child_id);
336 } 336 }
337 337
338 } // namespace 338 } // namespace
339 } // namespace cc 339 } // namespace cc
340 340
341 #endif // !defined(OS_ANDROID) 341 #endif // !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698