| 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/surfaces/surface_aggregator.h" | 5 #include "cc/surfaces/surface_aggregator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 EXPECT_TRUE( | 136 EXPECT_TRUE( |
| 137 aggregator_.previous_contained_surfaces().find(surface_ids[i]) != | 137 aggregator_.previous_contained_surfaces().find(surface_ids[i]) != |
| 138 aggregator_.previous_contained_surfaces().end()); | 138 aggregator_.previous_contained_surfaces().end()); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 void SubmitPassListAsFrame(SurfaceId surface_id, RenderPassList* pass_list) { | 142 void SubmitPassListAsFrame(SurfaceId surface_id, RenderPassList* pass_list) { |
| 143 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 143 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
| 144 pass_list->swap(frame_data->render_pass_list); | 144 pass_list->swap(frame_data->render_pass_list); |
| 145 | 145 |
| 146 std::unique_ptr<CompositorFrame> frame(new CompositorFrame); | 146 std::unique_ptr<CompositorFrame> frame(CompositorFrame::Create()); |
| 147 frame->delegated_frame_data = std::move(frame_data); | 147 frame->delegated_frame_data = std::move(frame_data); |
| 148 | 148 |
| 149 factory_.SubmitCompositorFrame(surface_id, std::move(frame), | 149 factory_.SubmitCompositorFrame(surface_id, std::move(frame), |
| 150 SurfaceFactory::DrawCallback()); | 150 SurfaceFactory::DrawCallback()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void SubmitCompositorFrame(test::Pass* passes, | 153 void SubmitCompositorFrame(test::Pass* passes, |
| 154 size_t pass_count, | 154 size_t pass_count, |
| 155 SurfaceId surface_id) { | 155 SurfaceId surface_id) { |
| 156 RenderPassList pass_list; | 156 RenderPassList pass_list; |
| 157 AddPasses(&pass_list, gfx::Rect(SurfaceSize()), passes, pass_count); | 157 AddPasses(&pass_list, gfx::Rect(SurfaceSize()), passes, pass_count); |
| 158 SubmitPassListAsFrame(surface_id, &pass_list); | 158 SubmitPassListAsFrame(surface_id, &pass_list); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void QueuePassAsFrame(std::unique_ptr<RenderPass> pass, | 161 void QueuePassAsFrame(std::unique_ptr<RenderPass> pass, |
| 162 SurfaceId surface_id) { | 162 SurfaceId surface_id) { |
| 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(surface_id, std::move(child_frame), | 170 factory_.SubmitCompositorFrame(surface_id, std::move(child_frame), |
| 171 SurfaceFactory::DrawCallback()); | 171 SurfaceFactory::DrawCallback()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 protected: | 174 protected: |
| 175 SurfaceId root_surface_id_; | 175 SurfaceId root_surface_id_; |
| 176 Surface* root_surface_; | 176 Surface* root_surface_; |
| 177 SurfaceIdAllocator allocator_; | 177 SurfaceIdAllocator allocator_; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 AddPasses(&pass_list, | 374 AddPasses(&pass_list, |
| 375 gfx::Rect(SurfaceSize()), | 375 gfx::Rect(SurfaceSize()), |
| 376 root_passes, | 376 root_passes, |
| 377 arraysize(root_passes)); | 377 arraysize(root_passes)); |
| 378 pass_list[0]->copy_requests.push_back(std::move(copy_request)); | 378 pass_list[0]->copy_requests.push_back(std::move(copy_request)); |
| 379 pass_list[1]->copy_requests.push_back(std::move(copy_request2)); | 379 pass_list[1]->copy_requests.push_back(std::move(copy_request2)); |
| 380 | 380 |
| 381 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 381 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
| 382 pass_list.swap(frame_data->render_pass_list); | 382 pass_list.swap(frame_data->render_pass_list); |
| 383 | 383 |
| 384 std::unique_ptr<CompositorFrame> frame(new CompositorFrame); | 384 std::unique_ptr<CompositorFrame> frame(CompositorFrame::Create()); |
| 385 frame->delegated_frame_data = std::move(frame_data); | 385 frame->delegated_frame_data = std::move(frame_data); |
| 386 | 386 |
| 387 factory_.SubmitCompositorFrame(root_surface_id_, std::move(frame), | 387 factory_.SubmitCompositorFrame(root_surface_id_, std::move(frame), |
| 388 SurfaceFactory::DrawCallback()); | 388 SurfaceFactory::DrawCallback()); |
| 389 } | 389 } |
| 390 | 390 |
| 391 std::unique_ptr<CompositorFrame> aggregated_frame = | 391 std::unique_ptr<CompositorFrame> aggregated_frame = |
| 392 aggregator_.Aggregate(root_surface_id_); | 392 aggregator_.Aggregate(root_surface_id_); |
| 393 | 393 |
| 394 ASSERT_TRUE(aggregated_frame); | 394 ASSERT_TRUE(aggregated_frame); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 test::Quad::SurfaceQuad(embedded_surface_id, 1.f), | 458 test::Quad::SurfaceQuad(embedded_surface_id, 1.f), |
| 459 test::Quad::SolidColorQuad(SK_ColorBLACK)}; | 459 test::Quad::SolidColorQuad(SK_ColorBLACK)}; |
| 460 test::Pass parent_passes[] = { | 460 test::Pass parent_passes[] = { |
| 461 test::Pass(parent_quads, arraysize(parent_quads))}; | 461 test::Pass(parent_quads, arraysize(parent_quads))}; |
| 462 | 462 |
| 463 { | 463 { |
| 464 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 464 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
| 465 AddPasses(&frame_data->render_pass_list, gfx::Rect(SurfaceSize()), | 465 AddPasses(&frame_data->render_pass_list, gfx::Rect(SurfaceSize()), |
| 466 parent_passes, arraysize(parent_passes)); | 466 parent_passes, arraysize(parent_passes)); |
| 467 | 467 |
| 468 std::unique_ptr<CompositorFrame> frame(new CompositorFrame); | 468 std::unique_ptr<CompositorFrame> frame(CompositorFrame::Create()); |
| 469 frame->delegated_frame_data = std::move(frame_data); | 469 frame->delegated_frame_data = std::move(frame_data); |
| 470 frame->metadata.referenced_surfaces.push_back(embedded_surface_id); | 470 frame->metadata.referenced_surfaces.push_back(embedded_surface_id); |
| 471 | 471 |
| 472 factory_.SubmitCompositorFrame(parent_surface_id, std::move(frame), | 472 factory_.SubmitCompositorFrame(parent_surface_id, std::move(frame), |
| 473 SurfaceFactory::DrawCallback()); | 473 SurfaceFactory::DrawCallback()); |
| 474 } | 474 } |
| 475 | 475 |
| 476 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), | 476 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), |
| 477 test::Quad::SolidColorQuad(SK_ColorBLACK)}; | 477 test::Quad::SolidColorQuad(SK_ColorBLACK)}; |
| 478 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; | 478 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; |
| 479 | 479 |
| 480 { | 480 { |
| 481 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 481 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
| 482 AddPasses(&frame_data->render_pass_list, gfx::Rect(SurfaceSize()), | 482 AddPasses(&frame_data->render_pass_list, gfx::Rect(SurfaceSize()), |
| 483 root_passes, arraysize(root_passes)); | 483 root_passes, arraysize(root_passes)); |
| 484 | 484 |
| 485 std::unique_ptr<CompositorFrame> frame(new CompositorFrame); | 485 std::unique_ptr<CompositorFrame> frame(CompositorFrame::Create()); |
| 486 frame->delegated_frame_data = std::move(frame_data); | 486 frame->delegated_frame_data = std::move(frame_data); |
| 487 frame->metadata.referenced_surfaces.push_back(parent_surface_id); | 487 frame->metadata.referenced_surfaces.push_back(parent_surface_id); |
| 488 // Reference to Surface ID of a Surface that doesn't exist should be | 488 // Reference to Surface ID of a Surface that doesn't exist should be |
| 489 // included in previous_contained_surfaces, but otherwise ignored. | 489 // included in previous_contained_surfaces, but otherwise ignored. |
| 490 frame->metadata.referenced_surfaces.push_back(nonexistent_surface_id); | 490 frame->metadata.referenced_surfaces.push_back(nonexistent_surface_id); |
| 491 | 491 |
| 492 factory_.SubmitCompositorFrame(root_surface_id_, std::move(frame), | 492 factory_.SubmitCompositorFrame(root_surface_id_, std::move(frame), |
| 493 SurfaceFactory::DrawCallback()); | 493 SurfaceFactory::DrawCallback()); |
| 494 } | 494 } |
| 495 | 495 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 SharedQuadState* child_root_pass_sqs = | 1034 SharedQuadState* child_root_pass_sqs = |
| 1035 child_root_pass->shared_quad_state_list.front(); | 1035 child_root_pass->shared_quad_state_list.front(); |
| 1036 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); | 1036 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); |
| 1037 child_root_pass_sqs->is_clipped = true; | 1037 child_root_pass_sqs->is_clipped = true; |
| 1038 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); | 1038 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); |
| 1039 | 1039 |
| 1040 std::unique_ptr<DelegatedFrameData> child_frame_data( | 1040 std::unique_ptr<DelegatedFrameData> child_frame_data( |
| 1041 new DelegatedFrameData); | 1041 new DelegatedFrameData); |
| 1042 child_pass_list.swap(child_frame_data->render_pass_list); | 1042 child_pass_list.swap(child_frame_data->render_pass_list); |
| 1043 | 1043 |
| 1044 std::unique_ptr<CompositorFrame> child_frame(new CompositorFrame); | 1044 std::unique_ptr<CompositorFrame> child_frame(CompositorFrame::Create()); |
| 1045 child_frame->delegated_frame_data = std::move(child_frame_data); | 1045 child_frame->delegated_frame_data = std::move(child_frame_data); |
| 1046 | 1046 |
| 1047 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), | 1047 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), |
| 1048 SurfaceFactory::DrawCallback()); | 1048 SurfaceFactory::DrawCallback()); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 // Middle child surface. | 1051 // Middle child surface. |
| 1052 SurfaceId middle_surface_id = allocator_.GenerateId(); | 1052 SurfaceId middle_surface_id = allocator_.GenerateId(); |
| 1053 factory_.Create(middle_surface_id); | 1053 factory_.Create(middle_surface_id); |
| 1054 { | 1054 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1066 middle_root_pass->quad_list.ElementAt(0)->visible_rect = | 1066 middle_root_pass->quad_list.ElementAt(0)->visible_rect = |
| 1067 gfx::Rect(0, 1, 100, 7); | 1067 gfx::Rect(0, 1, 100, 7); |
| 1068 SharedQuadState* middle_root_pass_sqs = | 1068 SharedQuadState* middle_root_pass_sqs = |
| 1069 middle_root_pass->shared_quad_state_list.front(); | 1069 middle_root_pass->shared_quad_state_list.front(); |
| 1070 middle_root_pass_sqs->quad_to_target_transform.Scale(2, 3); | 1070 middle_root_pass_sqs->quad_to_target_transform.Scale(2, 3); |
| 1071 | 1071 |
| 1072 std::unique_ptr<DelegatedFrameData> middle_frame_data( | 1072 std::unique_ptr<DelegatedFrameData> middle_frame_data( |
| 1073 new DelegatedFrameData); | 1073 new DelegatedFrameData); |
| 1074 middle_pass_list.swap(middle_frame_data->render_pass_list); | 1074 middle_pass_list.swap(middle_frame_data->render_pass_list); |
| 1075 | 1075 |
| 1076 std::unique_ptr<CompositorFrame> middle_frame(new CompositorFrame); | 1076 std::unique_ptr<CompositorFrame> middle_frame(CompositorFrame::Create()); |
| 1077 middle_frame->delegated_frame_data = std::move(middle_frame_data); | 1077 middle_frame->delegated_frame_data = std::move(middle_frame_data); |
| 1078 | 1078 |
| 1079 factory_.SubmitCompositorFrame(middle_surface_id, std::move(middle_frame), | 1079 factory_.SubmitCompositorFrame(middle_surface_id, std::move(middle_frame), |
| 1080 SurfaceFactory::DrawCallback()); | 1080 SurfaceFactory::DrawCallback()); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 // Root surface. | 1083 // Root surface. |
| 1084 test::Quad secondary_quads[] = { | 1084 test::Quad secondary_quads[] = { |
| 1085 test::Quad::SolidColorQuad(1), | 1085 test::Quad::SolidColorQuad(1), |
| 1086 test::Quad::SurfaceQuad(middle_surface_id, 1.f)}; | 1086 test::Quad::SurfaceQuad(middle_surface_id, 1.f)}; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1102 ->shared_quad_state_list.ElementAt(1) | 1102 ->shared_quad_state_list.ElementAt(1) |
| 1103 ->quad_to_target_transform.Translate(0, 10); | 1103 ->quad_to_target_transform.Translate(0, 10); |
| 1104 root_pass_list[0]->quad_list.ElementAt(1)->visible_rect = | 1104 root_pass_list[0]->quad_list.ElementAt(1)->visible_rect = |
| 1105 gfx::Rect(0, 0, 8, 100); | 1105 gfx::Rect(0, 0, 8, 100); |
| 1106 | 1106 |
| 1107 root_pass_list[0]->transform_to_root_target.Translate(10, 5); | 1107 root_pass_list[0]->transform_to_root_target.Translate(10, 5); |
| 1108 | 1108 |
| 1109 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1109 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1110 root_pass_list.swap(root_frame_data->render_pass_list); | 1110 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1111 | 1111 |
| 1112 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1112 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create()); |
| 1113 root_frame->delegated_frame_data = std::move(root_frame_data); | 1113 root_frame->delegated_frame_data = std::move(root_frame_data); |
| 1114 | 1114 |
| 1115 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), | 1115 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), |
| 1116 SurfaceFactory::DrawCallback()); | 1116 SurfaceFactory::DrawCallback()); |
| 1117 | 1117 |
| 1118 std::unique_ptr<CompositorFrame> aggregated_frame = | 1118 std::unique_ptr<CompositorFrame> aggregated_frame = |
| 1119 aggregator_.Aggregate(root_surface_id_); | 1119 aggregator_.Aggregate(root_surface_id_); |
| 1120 | 1120 |
| 1121 ASSERT_TRUE(aggregated_frame); | 1121 ASSERT_TRUE(aggregated_frame); |
| 1122 ASSERT_TRUE(aggregated_frame->delegated_frame_data); | 1122 ASSERT_TRUE(aggregated_frame->delegated_frame_data); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 arraysize(child_passes)); | 1209 arraysize(child_passes)); |
| 1210 | 1210 |
| 1211 RenderPass* child_root_pass = child_pass_list[0].get(); | 1211 RenderPass* child_root_pass = child_pass_list[0].get(); |
| 1212 SharedQuadState* child_root_pass_sqs = | 1212 SharedQuadState* child_root_pass_sqs = |
| 1213 child_root_pass->shared_quad_state_list.front(); | 1213 child_root_pass->shared_quad_state_list.front(); |
| 1214 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); | 1214 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); |
| 1215 | 1215 |
| 1216 std::unique_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); | 1216 std::unique_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); |
| 1217 child_pass_list.swap(child_frame_data->render_pass_list); | 1217 child_pass_list.swap(child_frame_data->render_pass_list); |
| 1218 | 1218 |
| 1219 std::unique_ptr<CompositorFrame> child_frame(new CompositorFrame); | 1219 std::unique_ptr<CompositorFrame> child_frame(CompositorFrame::Create()); |
| 1220 child_frame->delegated_frame_data = std::move(child_frame_data); | 1220 child_frame->delegated_frame_data = std::move(child_frame_data); |
| 1221 | 1221 |
| 1222 SurfaceId child_surface_id = allocator_.GenerateId(); | 1222 SurfaceId child_surface_id = allocator_.GenerateId(); |
| 1223 factory_.Create(child_surface_id); | 1223 factory_.Create(child_surface_id); |
| 1224 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), | 1224 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), |
| 1225 SurfaceFactory::DrawCallback()); | 1225 SurfaceFactory::DrawCallback()); |
| 1226 | 1226 |
| 1227 test::Quad parent_surface_quads[] = { | 1227 test::Quad parent_surface_quads[] = { |
| 1228 test::Quad::SurfaceQuad(child_surface_id, 1.f)}; | 1228 test::Quad::SurfaceQuad(child_surface_id, 1.f)}; |
| 1229 test::Pass parent_surface_passes[] = { | 1229 test::Pass parent_surface_passes[] = { |
| 1230 test::Pass(parent_surface_quads, arraysize(parent_surface_quads), | 1230 test::Pass(parent_surface_quads, arraysize(parent_surface_quads), |
| 1231 RenderPassId(1, 1))}; | 1231 RenderPassId(1, 1))}; |
| 1232 | 1232 |
| 1233 RenderPassList parent_surface_pass_list; | 1233 RenderPassList parent_surface_pass_list; |
| 1234 AddPasses(&parent_surface_pass_list, | 1234 AddPasses(&parent_surface_pass_list, |
| 1235 gfx::Rect(SurfaceSize()), | 1235 gfx::Rect(SurfaceSize()), |
| 1236 parent_surface_passes, | 1236 parent_surface_passes, |
| 1237 arraysize(parent_surface_passes)); | 1237 arraysize(parent_surface_passes)); |
| 1238 | 1238 |
| 1239 // Parent surface is only used to test if the transform is applied correctly | 1239 // Parent surface is only used to test if the transform is applied correctly |
| 1240 // to the child surface's damage. | 1240 // to the child surface's damage. |
| 1241 std::unique_ptr<DelegatedFrameData> parent_surface_frame_data( | 1241 std::unique_ptr<DelegatedFrameData> parent_surface_frame_data( |
| 1242 new DelegatedFrameData); | 1242 new DelegatedFrameData); |
| 1243 parent_surface_pass_list.swap(parent_surface_frame_data->render_pass_list); | 1243 parent_surface_pass_list.swap(parent_surface_frame_data->render_pass_list); |
| 1244 | 1244 |
| 1245 std::unique_ptr<CompositorFrame> parent_surface_frame(new CompositorFrame); | 1245 std::unique_ptr<CompositorFrame> parent_surface_frame( |
| 1246 CompositorFrame::Create()); |
| 1246 parent_surface_frame->delegated_frame_data = | 1247 parent_surface_frame->delegated_frame_data = |
| 1247 std::move(parent_surface_frame_data); | 1248 std::move(parent_surface_frame_data); |
| 1248 | 1249 |
| 1249 SurfaceId parent_surface_id = allocator_.GenerateId(); | 1250 SurfaceId parent_surface_id = allocator_.GenerateId(); |
| 1250 factory_.Create(parent_surface_id); | 1251 factory_.Create(parent_surface_id); |
| 1251 factory_.SubmitCompositorFrame(parent_surface_id, | 1252 factory_.SubmitCompositorFrame(parent_surface_id, |
| 1252 std::move(parent_surface_frame), | 1253 std::move(parent_surface_frame), |
| 1253 SurfaceFactory::DrawCallback()); | 1254 SurfaceFactory::DrawCallback()); |
| 1254 | 1255 |
| 1255 test::Quad root_surface_quads[] = { | 1256 test::Quad root_surface_quads[] = { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1271 | 1272 |
| 1272 root_pass_list[0] | 1273 root_pass_list[0] |
| 1273 ->shared_quad_state_list.front() | 1274 ->shared_quad_state_list.front() |
| 1274 ->quad_to_target_transform.Translate(0, 10); | 1275 ->quad_to_target_transform.Translate(0, 10); |
| 1275 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 10, 10); | 1276 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 10, 10); |
| 1276 root_pass_list[1]->damage_rect = gfx::Rect(5, 5, 100, 100); | 1277 root_pass_list[1]->damage_rect = gfx::Rect(5, 5, 100, 100); |
| 1277 | 1278 |
| 1278 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1279 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1279 root_pass_list.swap(root_frame_data->render_pass_list); | 1280 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1280 | 1281 |
| 1281 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1282 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create()); |
| 1282 root_frame->delegated_frame_data = std::move(root_frame_data); | 1283 root_frame->delegated_frame_data = std::move(root_frame_data); |
| 1283 | 1284 |
| 1284 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), | 1285 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), |
| 1285 SurfaceFactory::DrawCallback()); | 1286 SurfaceFactory::DrawCallback()); |
| 1286 | 1287 |
| 1287 std::unique_ptr<CompositorFrame> aggregated_frame = | 1288 std::unique_ptr<CompositorFrame> aggregated_frame = |
| 1288 aggregator_.Aggregate(root_surface_id_); | 1289 aggregator_.Aggregate(root_surface_id_); |
| 1289 | 1290 |
| 1290 ASSERT_TRUE(aggregated_frame); | 1291 ASSERT_TRUE(aggregated_frame); |
| 1291 ASSERT_TRUE(aggregated_frame->delegated_frame_data); | 1292 ASSERT_TRUE(aggregated_frame->delegated_frame_data); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1309 RenderPass* child_root_pass = child_pass_list[0].get(); | 1310 RenderPass* child_root_pass = child_pass_list[0].get(); |
| 1310 SharedQuadState* child_root_pass_sqs = | 1311 SharedQuadState* child_root_pass_sqs = |
| 1311 child_root_pass->shared_quad_state_list.front(); | 1312 child_root_pass->shared_quad_state_list.front(); |
| 1312 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); | 1313 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); |
| 1313 child_root_pass->damage_rect = gfx::Rect(10, 10, 10, 10); | 1314 child_root_pass->damage_rect = gfx::Rect(10, 10, 10, 10); |
| 1314 | 1315 |
| 1315 std::unique_ptr<DelegatedFrameData> child_frame_data( | 1316 std::unique_ptr<DelegatedFrameData> child_frame_data( |
| 1316 new DelegatedFrameData); | 1317 new DelegatedFrameData); |
| 1317 child_pass_list.swap(child_frame_data->render_pass_list); | 1318 child_pass_list.swap(child_frame_data->render_pass_list); |
| 1318 | 1319 |
| 1319 std::unique_ptr<CompositorFrame> child_frame(new CompositorFrame); | 1320 std::unique_ptr<CompositorFrame> child_frame(CompositorFrame::Create()); |
| 1320 child_frame->delegated_frame_data = std::move(child_frame_data); | 1321 child_frame->delegated_frame_data = std::move(child_frame_data); |
| 1321 | 1322 |
| 1322 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), | 1323 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), |
| 1323 SurfaceFactory::DrawCallback()); | 1324 SurfaceFactory::DrawCallback()); |
| 1324 | 1325 |
| 1325 std::unique_ptr<CompositorFrame> aggregated_frame = | 1326 std::unique_ptr<CompositorFrame> aggregated_frame = |
| 1326 aggregator_.Aggregate(root_surface_id_); | 1327 aggregator_.Aggregate(root_surface_id_); |
| 1327 | 1328 |
| 1328 ASSERT_TRUE(aggregated_frame); | 1329 ASSERT_TRUE(aggregated_frame); |
| 1329 ASSERT_TRUE(aggregated_frame->delegated_frame_data); | 1330 ASSERT_TRUE(aggregated_frame->delegated_frame_data); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1349 arraysize(root_passes)); | 1350 arraysize(root_passes)); |
| 1350 | 1351 |
| 1351 root_pass_list[0] | 1352 root_pass_list[0] |
| 1352 ->shared_quad_state_list.front() | 1353 ->shared_quad_state_list.front() |
| 1353 ->quad_to_target_transform.Translate(0, 10); | 1354 ->quad_to_target_transform.Translate(0, 10); |
| 1354 root_pass_list[0]->damage_rect = gfx::Rect(0, 0, 1, 1); | 1355 root_pass_list[0]->damage_rect = gfx::Rect(0, 0, 1, 1); |
| 1355 | 1356 |
| 1356 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1357 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1357 root_pass_list.swap(root_frame_data->render_pass_list); | 1358 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1358 | 1359 |
| 1359 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1360 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create()); |
| 1360 root_frame->delegated_frame_data = std::move(root_frame_data); | 1361 root_frame->delegated_frame_data = std::move(root_frame_data); |
| 1361 | 1362 |
| 1362 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), | 1363 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), |
| 1363 SurfaceFactory::DrawCallback()); | 1364 SurfaceFactory::DrawCallback()); |
| 1364 } | 1365 } |
| 1365 | 1366 |
| 1366 { | 1367 { |
| 1367 RenderPassList root_pass_list; | 1368 RenderPassList root_pass_list; |
| 1368 AddPasses(&root_pass_list, | 1369 AddPasses(&root_pass_list, |
| 1369 gfx::Rect(SurfaceSize()), | 1370 gfx::Rect(SurfaceSize()), |
| 1370 root_passes, | 1371 root_passes, |
| 1371 arraysize(root_passes)); | 1372 arraysize(root_passes)); |
| 1372 | 1373 |
| 1373 root_pass_list[0] | 1374 root_pass_list[0] |
| 1374 ->shared_quad_state_list.front() | 1375 ->shared_quad_state_list.front() |
| 1375 ->quad_to_target_transform.Translate(0, 10); | 1376 ->quad_to_target_transform.Translate(0, 10); |
| 1376 root_pass_list[0]->damage_rect = gfx::Rect(1, 1, 1, 1); | 1377 root_pass_list[0]->damage_rect = gfx::Rect(1, 1, 1, 1); |
| 1377 | 1378 |
| 1378 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1379 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1379 root_pass_list.swap(root_frame_data->render_pass_list); | 1380 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1380 | 1381 |
| 1381 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1382 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create()); |
| 1382 root_frame->delegated_frame_data = std::move(root_frame_data); | 1383 root_frame->delegated_frame_data = std::move(root_frame_data); |
| 1383 | 1384 |
| 1384 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), | 1385 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), |
| 1385 SurfaceFactory::DrawCallback()); | 1386 SurfaceFactory::DrawCallback()); |
| 1386 | 1387 |
| 1387 std::unique_ptr<CompositorFrame> aggregated_frame = | 1388 std::unique_ptr<CompositorFrame> aggregated_frame = |
| 1388 aggregator_.Aggregate(root_surface_id_); | 1389 aggregator_.Aggregate(root_surface_id_); |
| 1389 | 1390 |
| 1390 ASSERT_TRUE(aggregated_frame); | 1391 ASSERT_TRUE(aggregated_frame); |
| 1391 ASSERT_TRUE(aggregated_frame->delegated_frame_data); | 1392 ASSERT_TRUE(aggregated_frame->delegated_frame_data); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 | 1457 |
| 1457 RenderPassList root_pass_list; | 1458 RenderPassList root_pass_list; |
| 1458 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, | 1459 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, |
| 1459 arraysize(root_passes)); | 1460 arraysize(root_passes)); |
| 1460 | 1461 |
| 1461 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 100, 100); | 1462 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 100, 100); |
| 1462 | 1463 |
| 1463 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1464 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1464 root_pass_list.swap(root_frame_data->render_pass_list); | 1465 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1465 | 1466 |
| 1466 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1467 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create()); |
| 1467 root_frame->delegated_frame_data = std::move(root_frame_data); | 1468 root_frame->delegated_frame_data = std::move(root_frame_data); |
| 1468 | 1469 |
| 1469 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), | 1470 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), |
| 1470 SurfaceFactory::DrawCallback()); | 1471 SurfaceFactory::DrawCallback()); |
| 1471 | 1472 |
| 1472 { | 1473 { |
| 1473 std::unique_ptr<CompositorFrame> aggregated_frame = | 1474 std::unique_ptr<CompositorFrame> aggregated_frame = |
| 1474 aggregator_.Aggregate(root_surface_id_); | 1475 aggregator_.Aggregate(root_surface_id_); |
| 1475 | 1476 |
| 1476 ASSERT_TRUE(aggregated_frame); | 1477 ASSERT_TRUE(aggregated_frame); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1498 | 1499 |
| 1499 RenderPassList root_pass_list; | 1500 RenderPassList root_pass_list; |
| 1500 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, | 1501 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, |
| 1501 arraysize(root_passes)); | 1502 arraysize(root_passes)); |
| 1502 | 1503 |
| 1503 root_pass_list[0]->damage_rect = gfx::Rect(1, 2, 3, 4); | 1504 root_pass_list[0]->damage_rect = gfx::Rect(1, 2, 3, 4); |
| 1504 | 1505 |
| 1505 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 1506 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
| 1506 root_pass_list.swap(root_frame_data->render_pass_list); | 1507 root_pass_list.swap(root_frame_data->render_pass_list); |
| 1507 | 1508 |
| 1508 std::unique_ptr<CompositorFrame> root_frame(new CompositorFrame); | 1509 std::unique_ptr<CompositorFrame> root_frame(CompositorFrame::Create()); |
| 1509 root_frame->delegated_frame_data = std::move(root_frame_data); | 1510 root_frame->delegated_frame_data = std::move(root_frame_data); |
| 1510 | 1511 |
| 1511 factory_.Create(second_root_surface_id); | 1512 factory_.Create(second_root_surface_id); |
| 1512 factory_.SubmitCompositorFrame(second_root_surface_id, | 1513 factory_.SubmitCompositorFrame(second_root_surface_id, |
| 1513 std::move(root_frame), | 1514 std::move(root_frame), |
| 1514 SurfaceFactory::DrawCallback()); | 1515 SurfaceFactory::DrawCallback()); |
| 1515 factory_.SetPreviousFrameSurface(second_root_surface_id, root_surface_id_); | 1516 factory_.SetPreviousFrameSurface(second_root_surface_id, root_surface_id_); |
| 1516 } | 1517 } |
| 1517 { | 1518 { |
| 1518 std::unique_ptr<CompositorFrame> aggregated_frame = | 1519 std::unique_ptr<CompositorFrame> aggregated_frame = |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 const float vertex_opacity[4] = {0.f, 0.f, 1.f, 1.f}; | 1945 const float vertex_opacity[4] = {0.f, 0.f, 1.f, 1.f}; |
| 1945 bool flipped = false; | 1946 bool flipped = false; |
| 1946 bool nearest_neighbor = false; | 1947 bool nearest_neighbor = false; |
| 1947 bool secure_output_only = true; | 1948 bool secure_output_only = true; |
| 1948 quad->SetAll(sqs, rect, opaque_rect, visible_rect, needs_blending, | 1949 quad->SetAll(sqs, rect, opaque_rect, visible_rect, needs_blending, |
| 1949 resource_ids[i], gfx::Size(), premultiplied_alpha, uv_top_left, | 1950 resource_ids[i], gfx::Size(), premultiplied_alpha, uv_top_left, |
| 1950 uv_bottom_right, background_color, vertex_opacity, flipped, | 1951 uv_bottom_right, background_color, vertex_opacity, flipped, |
| 1951 nearest_neighbor, secure_output_only); | 1952 nearest_neighbor, secure_output_only); |
| 1952 } | 1953 } |
| 1953 frame_data->render_pass_list.push_back(std::move(pass)); | 1954 frame_data->render_pass_list.push_back(std::move(pass)); |
| 1954 std::unique_ptr<CompositorFrame> frame(new CompositorFrame); | 1955 std::unique_ptr<CompositorFrame> frame(CompositorFrame::Create()); |
| 1955 frame->delegated_frame_data = std::move(frame_data); | 1956 frame->delegated_frame_data = std::move(frame_data); |
| 1956 factory->SubmitCompositorFrame(surface_id, std::move(frame), | 1957 factory->SubmitCompositorFrame(surface_id, std::move(frame), |
| 1957 SurfaceFactory::DrawCallback()); | 1958 SurfaceFactory::DrawCallback()); |
| 1958 } | 1959 } |
| 1959 | 1960 |
| 1960 TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) { | 1961 TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) { |
| 1961 ResourceTrackingSurfaceFactoryClient client; | 1962 ResourceTrackingSurfaceFactoryClient client; |
| 1962 SurfaceFactory factory(&manager_, &client); | 1963 SurfaceFactory factory(&manager_, &client); |
| 1963 SurfaceId surface_id(0, 7u, 0); | 1964 SurfaceId surface_id(0, 7u, 0); |
| 1964 factory.Create(surface_id); | 1965 factory.Create(surface_id); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 1997 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
| 1997 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 1998 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
| 1998 pass->id = RenderPassId(1, 1); | 1999 pass->id = RenderPassId(1, 1); |
| 1999 TransferableResource resource; | 2000 TransferableResource resource; |
| 2000 resource.id = 11; | 2001 resource.id = 11; |
| 2001 // ResourceProvider is software but resource is not, so it should be | 2002 // ResourceProvider is software but resource is not, so it should be |
| 2002 // ignored. | 2003 // ignored. |
| 2003 resource.is_software = false; | 2004 resource.is_software = false; |
| 2004 frame_data->resource_list.push_back(resource); | 2005 frame_data->resource_list.push_back(resource); |
| 2005 frame_data->render_pass_list.push_back(std::move(pass)); | 2006 frame_data->render_pass_list.push_back(std::move(pass)); |
| 2006 std::unique_ptr<CompositorFrame> frame(new CompositorFrame); | 2007 std::unique_ptr<CompositorFrame> frame(CompositorFrame::Create()); |
| 2007 frame->delegated_frame_data = std::move(frame_data); | 2008 frame->delegated_frame_data = std::move(frame_data); |
| 2008 factory.SubmitCompositorFrame(surface_id, std::move(frame), | 2009 factory.SubmitCompositorFrame(surface_id, std::move(frame), |
| 2009 SurfaceFactory::DrawCallback()); | 2010 SurfaceFactory::DrawCallback()); |
| 2010 | 2011 |
| 2011 std::unique_ptr<CompositorFrame> returned_frame = | 2012 std::unique_ptr<CompositorFrame> returned_frame = |
| 2012 aggregator_->Aggregate(surface_id); | 2013 aggregator_->Aggregate(surface_id); |
| 2013 | 2014 |
| 2014 // Nothing should be available to be returned yet. | 2015 // Nothing should be available to be returned yet. |
| 2015 EXPECT_TRUE(client.returned_resources().empty()); | 2016 EXPECT_TRUE(client.returned_resources().empty()); |
| 2016 | 2017 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 pass->id = RenderPassId(1, 1); | 2138 pass->id = RenderPassId(1, 1); |
| 2138 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); | 2139 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); |
| 2139 sqs->opacity = 1.f; | 2140 sqs->opacity = 1.f; |
| 2140 SurfaceDrawQuad* surface_quad = | 2141 SurfaceDrawQuad* surface_quad = |
| 2141 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); | 2142 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); |
| 2142 surface_quad->SetNew(sqs, gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), | 2143 surface_quad->SetNew(sqs, gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), |
| 2143 surface1_id); | 2144 surface1_id); |
| 2144 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); | 2145 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); |
| 2145 | 2146 |
| 2146 frame_data->render_pass_list.push_back(std::move(pass)); | 2147 frame_data->render_pass_list.push_back(std::move(pass)); |
| 2147 std::unique_ptr<CompositorFrame> frame(new CompositorFrame); | 2148 std::unique_ptr<CompositorFrame> frame(CompositorFrame::Create()); |
| 2148 frame->delegated_frame_data = std::move(frame_data); | 2149 frame->delegated_frame_data = std::move(frame_data); |
| 2149 factory.SubmitCompositorFrame(surface2_id, std::move(frame), | 2150 factory.SubmitCompositorFrame(surface2_id, std::move(frame), |
| 2150 SurfaceFactory::DrawCallback()); | 2151 SurfaceFactory::DrawCallback()); |
| 2151 } | 2152 } |
| 2152 | 2153 |
| 2153 frame = aggregator_->Aggregate(surface2_id); | 2154 frame = aggregator_->Aggregate(surface2_id); |
| 2154 EXPECT_EQ(1u, frame->delegated_frame_data->render_pass_list.size()); | 2155 EXPECT_EQ(1u, frame->delegated_frame_data->render_pass_list.size()); |
| 2155 render_pass = frame->delegated_frame_data->render_pass_list.front().get(); | 2156 render_pass = frame->delegated_frame_data->render_pass_list.front().get(); |
| 2156 | 2157 |
| 2157 // Parent has copy request, so texture should not be drawn. | 2158 // Parent has copy request, so texture should not be drawn. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2173 // Output is insecure, so texture should be drawn. | 2174 // Output is insecure, so texture should be drawn. |
| 2174 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material); | 2175 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material); |
| 2175 | 2176 |
| 2176 factory.Destroy(surface1_id); | 2177 factory.Destroy(surface1_id); |
| 2177 factory.Destroy(surface2_id); | 2178 factory.Destroy(surface2_id); |
| 2178 } | 2179 } |
| 2179 | 2180 |
| 2180 } // namespace | 2181 } // namespace |
| 2181 } // namespace cc | 2182 } // namespace cc |
| 2182 | 2183 |
| OLD | NEW |