Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/output/delegated_frame_data.h" | 6 #include "cc/output/delegated_frame_data.h" |
| 7 #include "cc/quads/render_pass.h" | 7 #include "cc/quads/render_pass.h" |
| 8 #include "cc/quads/render_pass_draw_quad.h" | 8 #include "cc/quads/render_pass_draw_quad.h" |
| 9 #include "cc/quads/solid_color_draw_quad.h" | 9 #include "cc/quads/solid_color_draw_quad.h" |
| 10 #include "cc/quads/surface_draw_quad.h" | 10 #include "cc/quads/surface_draw_quad.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 ASSERT_TRUE(aggregated_frame->delegated_frame_data); | 132 ASSERT_TRUE(aggregated_frame->delegated_frame_data); |
| 133 | 133 |
| 134 DelegatedFrameData* frame_data = | 134 DelegatedFrameData* frame_data = |
| 135 aggregated_frame->delegated_frame_data.get(); | 135 aggregated_frame->delegated_frame_data.get(); |
| 136 | 136 |
| 137 TestPassesMatchExpectations( | 137 TestPassesMatchExpectations( |
| 138 expected_passes, expected_pass_count, &frame_data->render_pass_list); | 138 expected_passes, expected_pass_count, &frame_data->render_pass_list); |
| 139 | 139 |
| 140 // Ensure no duplicate pass ids output. | 140 // Ensure no duplicate pass ids output. |
| 141 std::set<RenderPassId> used_passes; | 141 std::set<RenderPassId> used_passes; |
| 142 for (auto* pass : frame_data->render_pass_list) { | 142 for (const scoped_ptr<RenderPass>& pass : frame_data->render_pass_list) { |
|
danakj
2015/11/17 01:12:17
auto
| |
| 143 EXPECT_TRUE(used_passes.insert(pass->id).second); | 143 EXPECT_TRUE(used_passes.insert(pass->id).second); |
| 144 } | 144 } |
| 145 | 145 |
| 146 EXPECT_EQ(expected_surface_count, | 146 EXPECT_EQ(expected_surface_count, |
| 147 aggregator_.previous_contained_surfaces().size()); | 147 aggregator_.previous_contained_surfaces().size()); |
| 148 for (size_t i = 0; i < expected_surface_count; i++) { | 148 for (size_t i = 0; i < expected_surface_count; i++) { |
| 149 EXPECT_TRUE( | 149 EXPECT_TRUE( |
| 150 aggregator_.previous_contained_surfaces().find(surface_ids[i]) != | 150 aggregator_.previous_contained_surfaces().find(surface_ids[i]) != |
| 151 aggregator_.previous_contained_surfaces().end()); | 151 aggregator_.previous_contained_surfaces().end()); |
| 152 } | 152 } |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 for (size_t i = 0; i < 5; ++i) { | 535 for (size_t i = 0; i < 5; ++i) { |
| 536 for (size_t j = 0; j < i; ++j) { | 536 for (size_t j = 0; j < i; ++j) { |
| 537 EXPECT_NE(actual_pass_ids[i], actual_pass_ids[j]); | 537 EXPECT_NE(actual_pass_ids[i], actual_pass_ids[j]); |
| 538 } | 538 } |
| 539 } | 539 } |
| 540 | 540 |
| 541 { | 541 { |
| 542 SCOPED_TRACE("First pass"); | 542 SCOPED_TRACE("First pass"); |
| 543 // The first pass will just be the first pass from the root surfaces quad | 543 // The first pass will just be the first pass from the root surfaces quad |
| 544 // with no render pass quads to remap. | 544 // with no render pass quads to remap. |
| 545 TestPassMatchesExpectations(root_passes[0], aggregated_pass_list[0]); | 545 TestPassMatchesExpectations(root_passes[0], aggregated_pass_list[0].get()); |
| 546 } | 546 } |
| 547 | 547 |
| 548 { | 548 { |
| 549 SCOPED_TRACE("Second pass"); | 549 SCOPED_TRACE("Second pass"); |
| 550 // The next two passes will be from the embedded surface since we have to | 550 // The next two passes will be from the embedded surface since we have to |
| 551 // draw those passes before they are referenced from the render pass draw | 551 // draw those passes before they are referenced from the render pass draw |
| 552 // quad embedded into the root surface's second pass. | 552 // quad embedded into the root surface's second pass. |
| 553 // First, there's the first embedded pass which doesn't reference anything | 553 // First, there's the first embedded pass which doesn't reference anything |
| 554 // else. | 554 // else. |
| 555 TestPassMatchesExpectations(embedded_passes[0], aggregated_pass_list[1]); | 555 TestPassMatchesExpectations(embedded_passes[0], |
| 556 aggregated_pass_list[1].get()); | |
| 556 } | 557 } |
| 557 | 558 |
| 558 { | 559 { |
| 559 SCOPED_TRACE("Third pass"); | 560 SCOPED_TRACE("Third pass"); |
| 560 const QuadList& third_pass_quad_list = aggregated_pass_list[2]->quad_list; | 561 const QuadList& third_pass_quad_list = aggregated_pass_list[2]->quad_list; |
| 561 ASSERT_EQ(2u, third_pass_quad_list.size()); | 562 ASSERT_EQ(2u, third_pass_quad_list.size()); |
| 562 TestQuadMatchesExpectations(embedded_quads[1][0], | 563 TestQuadMatchesExpectations(embedded_quads[1][0], |
| 563 third_pass_quad_list.ElementAt(0)); | 564 third_pass_quad_list.ElementAt(0)); |
| 564 | 565 |
| 565 // This render pass pass quad will reference the first pass from the | 566 // This render pass pass quad will reference the first pass from the |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1014 }; | 1015 }; |
| 1015 test::Pass child_passes[] = { | 1016 test::Pass child_passes[] = { |
| 1016 test::Pass(child_quads[0], arraysize(child_quads[0]), child_pass_id[0]), | 1017 test::Pass(child_quads[0], arraysize(child_quads[0]), child_pass_id[0]), |
| 1017 test::Pass(child_quads[1], arraysize(child_quads[1]), | 1018 test::Pass(child_quads[1], arraysize(child_quads[1]), |
| 1018 child_pass_id[1])}; | 1019 child_pass_id[1])}; |
| 1019 | 1020 |
| 1020 RenderPassList child_pass_list; | 1021 RenderPassList child_pass_list; |
| 1021 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes, | 1022 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes, |
| 1022 arraysize(child_passes)); | 1023 arraysize(child_passes)); |
| 1023 | 1024 |
| 1024 RenderPass* child_nonroot_pass = child_pass_list.at(0u); | 1025 RenderPass* child_nonroot_pass = child_pass_list[0].get(); |
| 1025 child_nonroot_pass->transform_to_root_target.Translate(8, 0); | 1026 child_nonroot_pass->transform_to_root_target.Translate(8, 0); |
| 1026 SharedQuadState* child_nonroot_pass_sqs = | 1027 SharedQuadState* child_nonroot_pass_sqs = |
| 1027 child_nonroot_pass->shared_quad_state_list.front(); | 1028 child_nonroot_pass->shared_quad_state_list.front(); |
| 1028 child_nonroot_pass_sqs->quad_to_target_transform.Translate(5, 0); | 1029 child_nonroot_pass_sqs->quad_to_target_transform.Translate(5, 0); |
| 1029 | 1030 |
| 1030 RenderPass* child_root_pass = child_pass_list.at(1u); | 1031 RenderPass* child_root_pass = child_pass_list[1].get(); |
| 1031 SharedQuadState* child_root_pass_sqs = | 1032 SharedQuadState* child_root_pass_sqs = |
| 1032 child_root_pass->shared_quad_state_list.front(); | 1033 child_root_pass->shared_quad_state_list.front(); |
| 1033 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); | 1034 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); |
| 1034 child_root_pass_sqs->is_clipped = true; | 1035 child_root_pass_sqs->is_clipped = true; |
| 1035 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); | 1036 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); |
| 1036 | 1037 |
| 1037 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); | 1038 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); |
| 1038 child_pass_list.swap(child_frame_data->render_pass_list); | 1039 child_pass_list.swap(child_frame_data->render_pass_list); |
| 1039 | 1040 |
| 1040 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 1041 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1053 test::Quad middle_quads[] = { | 1054 test::Quad middle_quads[] = { |
| 1054 test::Quad::SurfaceQuad(child_surface_id, 1.f)}; | 1055 test::Quad::SurfaceQuad(child_surface_id, 1.f)}; |
| 1055 test::Pass middle_passes[] = { | 1056 test::Pass middle_passes[] = { |
| 1056 test::Pass(middle_quads, arraysize(middle_quads)), | 1057 test::Pass(middle_quads, arraysize(middle_quads)), |
| 1057 }; | 1058 }; |
| 1058 | 1059 |
| 1059 RenderPassList middle_pass_list; | 1060 RenderPassList middle_pass_list; |
| 1060 AddPasses(&middle_pass_list, gfx::Rect(SurfaceSize()), middle_passes, | 1061 AddPasses(&middle_pass_list, gfx::Rect(SurfaceSize()), middle_passes, |
| 1061 arraysize(middle_passes)); | 1062 arraysize(middle_passes)); |
| 1062 | 1063 |
| 1063 RenderPass* middle_root_pass = middle_pass_list.at(0u); | 1064 RenderPass* middle_root_pass = middle_pass_list[0].get(); |
| 1064 middle_root_pass->quad_list.ElementAt(0)->visible_rect = | 1065 middle_root_pass->quad_list.ElementAt(0)->visible_rect = |
| 1065 gfx::Rect(0, 1, 100, 7); | 1066 gfx::Rect(0, 1, 100, 7); |
| 1066 SharedQuadState* middle_root_pass_sqs = | 1067 SharedQuadState* middle_root_pass_sqs = |
| 1067 middle_root_pass->shared_quad_state_list.front(); | 1068 middle_root_pass->shared_quad_state_list.front(); |
| 1068 middle_root_pass_sqs->quad_to_target_transform.Scale(2, 3); | 1069 middle_root_pass_sqs->quad_to_target_transform.Scale(2, 3); |
| 1069 | 1070 |
| 1070 scoped_ptr<DelegatedFrameData> middle_frame_data(new DelegatedFrameData); | 1071 scoped_ptr<DelegatedFrameData> middle_frame_data(new DelegatedFrameData); |
| 1071 middle_pass_list.swap(middle_frame_data->render_pass_list); | 1072 middle_pass_list.swap(middle_frame_data->render_pass_list); |
| 1072 | 1073 |
| 1073 scoped_ptr<CompositorFrame> middle_frame(new CompositorFrame); | 1074 scoped_ptr<CompositorFrame> middle_frame(new CompositorFrame); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1085 test::Pass root_passes[] = { | 1086 test::Pass root_passes[] = { |
| 1086 test::Pass(secondary_quads, arraysize(secondary_quads)), | 1087 test::Pass(secondary_quads, arraysize(secondary_quads)), |
| 1087 test::Pass(root_quads, arraysize(root_quads))}; | 1088 test::Pass(root_quads, arraysize(root_quads))}; |
| 1088 | 1089 |
| 1089 RenderPassList root_pass_list; | 1090 RenderPassList root_pass_list; |
| 1090 AddPasses(&root_pass_list, | 1091 AddPasses(&root_pass_list, |
| 1091 gfx::Rect(SurfaceSize()), | 1092 gfx::Rect(SurfaceSize()), |
| 1092 root_passes, | 1093 root_passes, |
| 1093 arraysize(root_passes)); | 1094 arraysize(root_passes)); |
| 1094 | 1095 |
| 1095 root_pass_list.at(0) | 1096 root_pass_list[0] |
| 1096 ->shared_quad_state_list.front() | 1097 ->shared_quad_state_list.front() |
| 1097 ->quad_to_target_transform.Translate(0, 7); | 1098 ->quad_to_target_transform.Translate(0, 7); |
| 1098 root_pass_list.at(0) | 1099 root_pass_list[0] |
| 1099 ->shared_quad_state_list.ElementAt(1) | 1100 ->shared_quad_state_list.ElementAt(1) |
| 1100 ->quad_to_target_transform.Translate(0, 10); | 1101 ->quad_to_target_transform.Translate(0, 10); |
| 1101 root_pass_list.at(0)->quad_list.ElementAt(1)->visible_rect = | 1102 root_pass_list[0]->quad_list.ElementAt(1)->visible_rect = |
| 1102 gfx::Rect(0, 0, 8, 100); | 1103 gfx::Rect(0, 0, 8, 100); |
| 1103 | 1104 |
| 1104 root_pass_list[0]->transform_to_root_target.Translate(10, 5); | 1105 root_pass_list[0]->transform_to_root_target.Translate(10, 5); |
| 1105 | 1106 |
| 1106 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1107 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1107 root_pass_list.swap(root_frame_data->render_pass_list); | 1108 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1108 | 1109 |
| 1109 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1110 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
| 1110 root_frame->delegated_frame_data = root_frame_data.Pass(); | 1111 root_frame->delegated_frame_data = root_frame_data.Pass(); |
| 1111 | 1112 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1206 test::Quad child_quads[] = {test::Quad::RenderPassQuad(RenderPassId(1, 1))}; | 1207 test::Quad child_quads[] = {test::Quad::RenderPassQuad(RenderPassId(1, 1))}; |
| 1207 test::Pass child_passes[] = { | 1208 test::Pass child_passes[] = { |
| 1208 test::Pass(child_quads, arraysize(child_quads), RenderPassId(1, 1))}; | 1209 test::Pass(child_quads, arraysize(child_quads), RenderPassId(1, 1))}; |
| 1209 | 1210 |
| 1210 RenderPassList child_pass_list; | 1211 RenderPassList child_pass_list; |
| 1211 AddPasses(&child_pass_list, | 1212 AddPasses(&child_pass_list, |
| 1212 gfx::Rect(SurfaceSize()), | 1213 gfx::Rect(SurfaceSize()), |
| 1213 child_passes, | 1214 child_passes, |
| 1214 arraysize(child_passes)); | 1215 arraysize(child_passes)); |
| 1215 | 1216 |
| 1216 RenderPass* child_root_pass = child_pass_list.at(0u); | 1217 RenderPass* child_root_pass = child_pass_list[0].get(); |
| 1217 SharedQuadState* child_root_pass_sqs = | 1218 SharedQuadState* child_root_pass_sqs = |
| 1218 child_root_pass->shared_quad_state_list.front(); | 1219 child_root_pass->shared_quad_state_list.front(); |
| 1219 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); | 1220 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); |
| 1220 | 1221 |
| 1221 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); | 1222 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); |
| 1222 child_pass_list.swap(child_frame_data->render_pass_list); | 1223 child_pass_list.swap(child_frame_data->render_pass_list); |
| 1223 | 1224 |
| 1224 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 1225 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| 1225 child_frame->delegated_frame_data = child_frame_data.Pass(); | 1226 child_frame->delegated_frame_data = child_frame_data.Pass(); |
| 1226 | 1227 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1267 RenderPassId(1, 1)), | 1268 RenderPassId(1, 1)), |
| 1268 test::Pass(root_render_pass_quads, arraysize(root_render_pass_quads), | 1269 test::Pass(root_render_pass_quads, arraysize(root_render_pass_quads), |
| 1269 RenderPassId(2, 1))}; | 1270 RenderPassId(2, 1))}; |
| 1270 | 1271 |
| 1271 RenderPassList root_pass_list; | 1272 RenderPassList root_pass_list; |
| 1272 AddPasses(&root_pass_list, | 1273 AddPasses(&root_pass_list, |
| 1273 gfx::Rect(SurfaceSize()), | 1274 gfx::Rect(SurfaceSize()), |
| 1274 root_passes, | 1275 root_passes, |
| 1275 arraysize(root_passes)); | 1276 arraysize(root_passes)); |
| 1276 | 1277 |
| 1277 root_pass_list.at(0) | 1278 root_pass_list[0] |
| 1278 ->shared_quad_state_list.front() | 1279 ->shared_quad_state_list.front() |
| 1279 ->quad_to_target_transform.Translate(0, 10); | 1280 ->quad_to_target_transform.Translate(0, 10); |
| 1280 root_pass_list.at(0)->damage_rect = gfx::Rect(5, 5, 10, 10); | 1281 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 10, 10); |
| 1281 root_pass_list.at(1)->damage_rect = gfx::Rect(5, 5, 100, 100); | 1282 root_pass_list[1]->damage_rect = gfx::Rect(5, 5, 100, 100); |
| 1282 | 1283 |
| 1283 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1284 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1284 root_pass_list.swap(root_frame_data->render_pass_list); | 1285 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1285 | 1286 |
| 1286 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1287 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
| 1287 root_frame->delegated_frame_data = root_frame_data.Pass(); | 1288 root_frame->delegated_frame_data = root_frame_data.Pass(); |
| 1288 | 1289 |
| 1289 factory_.SubmitCompositorFrame(root_surface_id_, root_frame.Pass(), | 1290 factory_.SubmitCompositorFrame(root_surface_id_, root_frame.Pass(), |
| 1290 SurfaceFactory::DrawCallback()); | 1291 SurfaceFactory::DrawCallback()); |
| 1291 | 1292 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1312 // Damage rect for first aggregation should contain entire root surface. | 1313 // Damage rect for first aggregation should contain entire root surface. |
| 1313 EXPECT_TRUE( | 1314 EXPECT_TRUE( |
| 1314 aggregated_pass_list[1]->damage_rect.Contains(gfx::Rect(SurfaceSize()))); | 1315 aggregated_pass_list[1]->damage_rect.Contains(gfx::Rect(SurfaceSize()))); |
| 1315 | 1316 |
| 1316 { | 1317 { |
| 1317 AddPasses(&child_pass_list, | 1318 AddPasses(&child_pass_list, |
| 1318 gfx::Rect(SurfaceSize()), | 1319 gfx::Rect(SurfaceSize()), |
| 1319 child_passes, | 1320 child_passes, |
| 1320 arraysize(child_passes)); | 1321 arraysize(child_passes)); |
| 1321 | 1322 |
| 1322 RenderPass* child_root_pass = child_pass_list.at(0u); | 1323 RenderPass* child_root_pass = child_pass_list[0].get(); |
| 1323 SharedQuadState* child_root_pass_sqs = | 1324 SharedQuadState* child_root_pass_sqs = |
| 1324 child_root_pass->shared_quad_state_list.front(); | 1325 child_root_pass->shared_quad_state_list.front(); |
| 1325 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); | 1326 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); |
| 1326 child_root_pass->damage_rect = gfx::Rect(10, 10, 10, 10); | 1327 child_root_pass->damage_rect = gfx::Rect(10, 10, 10, 10); |
| 1327 | 1328 |
| 1328 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); | 1329 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); |
| 1329 child_pass_list.swap(child_frame_data->render_pass_list); | 1330 child_pass_list.swap(child_frame_data->render_pass_list); |
| 1330 | 1331 |
| 1331 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 1332 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| 1332 child_frame->delegated_frame_data = child_frame_data.Pass(); | 1333 child_frame->delegated_frame_data = child_frame_data.Pass(); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 1361 aggregated_pass_list[1]->damage_rect.ToString()); | 1362 aggregated_pass_list[1]->damage_rect.ToString()); |
| 1362 } | 1363 } |
| 1363 | 1364 |
| 1364 { | 1365 { |
| 1365 RenderPassList root_pass_list; | 1366 RenderPassList root_pass_list; |
| 1366 AddPasses(&root_pass_list, | 1367 AddPasses(&root_pass_list, |
| 1367 gfx::Rect(SurfaceSize()), | 1368 gfx::Rect(SurfaceSize()), |
| 1368 root_passes, | 1369 root_passes, |
| 1369 arraysize(root_passes)); | 1370 arraysize(root_passes)); |
| 1370 | 1371 |
| 1371 root_pass_list.at(0) | 1372 root_pass_list[0] |
| 1372 ->shared_quad_state_list.front() | 1373 ->shared_quad_state_list.front() |
| 1373 ->quad_to_target_transform.Translate(0, 10); | 1374 ->quad_to_target_transform.Translate(0, 10); |
| 1374 root_pass_list.at(0)->damage_rect = gfx::Rect(0, 0, 1, 1); | 1375 root_pass_list[0]->damage_rect = gfx::Rect(0, 0, 1, 1); |
| 1375 | 1376 |
| 1376 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1377 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1377 root_pass_list.swap(root_frame_data->render_pass_list); | 1378 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1378 | 1379 |
| 1379 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1380 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
| 1380 root_frame->delegated_frame_data = root_frame_data.Pass(); | 1381 root_frame->delegated_frame_data = root_frame_data.Pass(); |
| 1381 | 1382 |
| 1382 factory_.SubmitCompositorFrame(root_surface_id_, root_frame.Pass(), | 1383 factory_.SubmitCompositorFrame(root_surface_id_, root_frame.Pass(), |
| 1383 SurfaceFactory::DrawCallback()); | 1384 SurfaceFactory::DrawCallback()); |
| 1384 } | 1385 } |
| 1385 | 1386 |
| 1386 { | 1387 { |
| 1387 RenderPassList root_pass_list; | 1388 RenderPassList root_pass_list; |
| 1388 AddPasses(&root_pass_list, | 1389 AddPasses(&root_pass_list, |
| 1389 gfx::Rect(SurfaceSize()), | 1390 gfx::Rect(SurfaceSize()), |
| 1390 root_passes, | 1391 root_passes, |
| 1391 arraysize(root_passes)); | 1392 arraysize(root_passes)); |
| 1392 | 1393 |
| 1393 root_pass_list.at(0) | 1394 root_pass_list[0] |
| 1394 ->shared_quad_state_list.front() | 1395 ->shared_quad_state_list.front() |
| 1395 ->quad_to_target_transform.Translate(0, 10); | 1396 ->quad_to_target_transform.Translate(0, 10); |
| 1396 root_pass_list.at(0)->damage_rect = gfx::Rect(1, 1, 1, 1); | 1397 root_pass_list[0]->damage_rect = gfx::Rect(1, 1, 1, 1); |
| 1397 | 1398 |
| 1398 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1399 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1399 root_pass_list.swap(root_frame_data->render_pass_list); | 1400 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1400 | 1401 |
| 1401 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1402 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
| 1402 root_frame->delegated_frame_data = root_frame_data.Pass(); | 1403 root_frame->delegated_frame_data = root_frame_data.Pass(); |
| 1403 | 1404 |
| 1404 factory_.SubmitCompositorFrame(root_surface_id_, root_frame.Pass(), | 1405 factory_.SubmitCompositorFrame(root_surface_id_, root_frame.Pass(), |
| 1405 SurfaceFactory::DrawCallback()); | 1406 SurfaceFactory::DrawCallback()); |
| 1406 | 1407 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1509 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)}; | 1510 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)}; |
| 1510 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)}; | 1511 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)}; |
| 1511 test::Pass child_passes[] = { | 1512 test::Pass child_passes[] = { |
| 1512 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id), | 1513 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id), |
| 1513 test::Pass(child_quads2, arraysize(child_quads2), child_pass_id)}; | 1514 test::Pass(child_quads2, arraysize(child_quads2), child_pass_id)}; |
| 1514 | 1515 |
| 1515 RenderPassList child_pass_list; | 1516 RenderPassList child_pass_list; |
| 1516 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes, | 1517 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes, |
| 1517 arraysize(child_passes)); | 1518 arraysize(child_passes)); |
| 1518 | 1519 |
| 1519 child_pass_list.at(0u)->quad_list.ElementAt(0)->visible_rect = | 1520 child_pass_list[0]->quad_list.ElementAt(0)->visible_rect = |
| 1520 gfx::Rect(1, 1, 2, 2); | 1521 gfx::Rect(1, 1, 2, 2); |
| 1521 SharedQuadState* child_sqs = | 1522 SharedQuadState* child_sqs = |
| 1522 child_pass_list.at(0u)->shared_quad_state_list.ElementAt(0u); | 1523 child_pass_list[0]->shared_quad_state_list.ElementAt(0u); |
| 1523 child_sqs->quad_to_target_transform.Translate(1, 1); | 1524 child_sqs->quad_to_target_transform.Translate(1, 1); |
| 1524 child_sqs->quad_to_target_transform.Scale(2, 2); | 1525 child_sqs->quad_to_target_transform.Scale(2, 2); |
| 1525 | 1526 |
| 1526 child_pass_list.at(1u)->quad_list.ElementAt(0)->visible_rect = | 1527 child_pass_list[1]->quad_list.ElementAt(0)->visible_rect = |
| 1527 gfx::Rect(0, 0, 2, 2); | 1528 gfx::Rect(0, 0, 2, 2); |
| 1528 | 1529 |
| 1529 SubmitPassListAsFrame(child_surface_id, &child_pass_list); | 1530 SubmitPassListAsFrame(child_surface_id, &child_pass_list); |
| 1530 } | 1531 } |
| 1531 | 1532 |
| 1532 { | 1533 { |
| 1533 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; | 1534 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; |
| 1534 | 1535 |
| 1535 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; | 1536 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; |
| 1536 | 1537 |
| 1537 RenderPassList root_pass_list; | 1538 RenderPassList root_pass_list; |
| 1538 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, | 1539 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, |
| 1539 arraysize(root_passes)); | 1540 arraysize(root_passes)); |
| 1540 | 1541 |
| 1541 RenderPass* root_pass = root_pass_list.at(0u); | 1542 RenderPass* root_pass = root_pass_list[0].get(); |
| 1542 root_pass->shared_quad_state_list.front() | 1543 root_pass->shared_quad_state_list.front() |
| 1543 ->quad_to_target_transform.Translate(10, 10); | 1544 ->quad_to_target_transform.Translate(10, 10); |
| 1544 root_pass->damage_rect = gfx::Rect(0, 0, 1, 1); | 1545 root_pass->damage_rect = gfx::Rect(0, 0, 1, 1); |
| 1545 | 1546 |
| 1546 SubmitPassListAsFrame(root_surface_id_, &root_pass_list); | 1547 SubmitPassListAsFrame(root_surface_id_, &root_pass_list); |
| 1547 } | 1548 } |
| 1548 | 1549 |
| 1549 EXPECT_FALSE(surface_aggregator_client_.HasSurface(root_surface_)); | 1550 EXPECT_FALSE(surface_aggregator_client_.HasSurface(root_surface_)); |
| 1550 EXPECT_FALSE(surface_aggregator_client_.HasSurface(child_surface)); | 1551 EXPECT_FALSE(surface_aggregator_client_.HasSurface(child_surface)); |
| 1551 | 1552 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1572 // Create a root surface with a smaller damage rect. | 1573 // Create a root surface with a smaller damage rect. |
| 1573 { | 1574 { |
| 1574 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; | 1575 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; |
| 1575 | 1576 |
| 1576 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; | 1577 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; |
| 1577 | 1578 |
| 1578 RenderPassList root_pass_list; | 1579 RenderPassList root_pass_list; |
| 1579 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, | 1580 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, |
| 1580 arraysize(root_passes)); | 1581 arraysize(root_passes)); |
| 1581 | 1582 |
| 1582 RenderPass* root_pass = root_pass_list.at(0u); | 1583 RenderPass* root_pass = root_pass_list[0].get(); |
| 1583 root_pass->shared_quad_state_list.front() | 1584 root_pass->shared_quad_state_list.front() |
| 1584 ->quad_to_target_transform.Translate(10, 10); | 1585 ->quad_to_target_transform.Translate(10, 10); |
| 1585 root_pass->damage_rect = gfx::Rect(10, 10, 2, 2); | 1586 root_pass->damage_rect = gfx::Rect(10, 10, 2, 2); |
| 1586 SubmitPassListAsFrame(root_surface_id_, &root_pass_list); | 1587 SubmitPassListAsFrame(root_surface_id_, &root_pass_list); |
| 1587 } | 1588 } |
| 1588 | 1589 |
| 1589 { | 1590 { |
| 1590 EXPECT_TRUE(surface_aggregator_client_.HasSurface(root_surface_)); | 1591 EXPECT_TRUE(surface_aggregator_client_.HasSurface(root_surface_)); |
| 1591 EXPECT_TRUE(surface_aggregator_client_.HasSurface(child_surface)); | 1592 EXPECT_TRUE(surface_aggregator_client_.HasSurface(child_surface)); |
| 1592 | 1593 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1622 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)}; | 1623 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)}; |
| 1623 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)}; | 1624 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)}; |
| 1624 test::Pass child_passes[] = { | 1625 test::Pass child_passes[] = { |
| 1625 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id), | 1626 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id), |
| 1626 test::Pass(child_quads2, arraysize(child_quads2), child_pass_id)}; | 1627 test::Pass(child_quads2, arraysize(child_quads2), child_pass_id)}; |
| 1627 | 1628 |
| 1628 RenderPassList child_pass_list; | 1629 RenderPassList child_pass_list; |
| 1629 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes, | 1630 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes, |
| 1630 arraysize(child_passes)); | 1631 arraysize(child_passes)); |
| 1631 | 1632 |
| 1632 child_pass_list.at(0u)->quad_list.ElementAt(0)->visible_rect = | 1633 child_pass_list[0]->quad_list.ElementAt(0)->visible_rect = |
| 1633 gfx::Rect(1, 1, 2, 2); | 1634 gfx::Rect(1, 1, 2, 2); |
| 1634 SharedQuadState* child_sqs = | 1635 SharedQuadState* child_sqs = |
| 1635 child_pass_list.at(0u)->shared_quad_state_list.ElementAt(0u); | 1636 child_pass_list[0]->shared_quad_state_list.ElementAt(0u); |
| 1636 child_sqs->quad_to_target_transform.Translate(1, 1); | 1637 child_sqs->quad_to_target_transform.Translate(1, 1); |
| 1637 child_sqs->quad_to_target_transform.Scale(2, 2); | 1638 child_sqs->quad_to_target_transform.Scale(2, 2); |
| 1638 | 1639 |
| 1639 child_pass_list.at(1u)->quad_list.ElementAt(0)->visible_rect = | 1640 child_pass_list[1]->quad_list.ElementAt(0)->visible_rect = |
| 1640 gfx::Rect(0, 0, 2, 2); | 1641 gfx::Rect(0, 0, 2, 2); |
| 1641 | 1642 |
| 1642 RenderPass* child_root_pass = child_pass_list.at(1u); | 1643 RenderPass* child_root_pass = child_pass_list[1].get(); |
| 1643 | 1644 |
| 1644 child_root_pass->copy_requests.push_back( | 1645 child_root_pass->copy_requests.push_back( |
| 1645 CopyOutputRequest::CreateEmptyRequest()); | 1646 CopyOutputRequest::CreateEmptyRequest()); |
| 1646 child_root_pass->damage_rect = gfx::Rect(); | 1647 child_root_pass->damage_rect = gfx::Rect(); |
| 1647 SubmitPassListAsFrame(child_surface_id, &child_pass_list); | 1648 SubmitPassListAsFrame(child_surface_id, &child_pass_list); |
| 1648 } | 1649 } |
| 1649 | 1650 |
| 1650 { | 1651 { |
| 1651 EXPECT_TRUE(surface_aggregator_client_.HasSurface(root_surface_)); | 1652 EXPECT_TRUE(surface_aggregator_client_.HasSurface(root_surface_)); |
| 1652 EXPECT_TRUE(surface_aggregator_client_.HasSurface(child_surface)); | 1653 EXPECT_TRUE(surface_aggregator_client_.HasSurface(child_surface)); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1997 EXPECT_EQ(9u, pass_list->back()->quad_list.size()); | 1998 EXPECT_EQ(9u, pass_list->back()->quad_list.size()); |
| 1998 | 1999 |
| 1999 factory.Destroy(root_surface_id); | 2000 factory.Destroy(root_surface_id); |
| 2000 factory.Destroy(child_surface_id); | 2001 factory.Destroy(child_surface_id); |
| 2001 factory.Destroy(middle_surface_id); | 2002 factory.Destroy(middle_surface_id); |
| 2002 } | 2003 } |
| 2003 | 2004 |
| 2004 } // namespace | 2005 } // namespace |
| 2005 } // namespace cc | 2006 } // namespace cc |
| 2006 | 2007 |
| OLD | NEW |