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

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

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: c Created 3 years, 7 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/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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); 1100 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
1101 std::unique_ptr<CompositorFrameSinkSupport> child_two_support = 1101 std::unique_ptr<CompositorFrameSinkSupport> child_two_support =
1102 CompositorFrameSinkSupport::Create( 1102 CompositorFrameSinkSupport::Create(
1103 nullptr, &manager_, kArbitraryFrameSinkId3, kChildIsRoot, 1103 nullptr, &manager_, kArbitraryFrameSinkId3, kChildIsRoot,
1104 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); 1104 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
1105 int pass_id = 1; 1105 int pass_id = 1;
1106 LocalSurfaceId grandchild_local_surface_id = allocator_.GenerateId(); 1106 LocalSurfaceId grandchild_local_surface_id = allocator_.GenerateId();
1107 SurfaceId grandchild_surface_id(grandchild_support->frame_sink_id(), 1107 SurfaceId grandchild_surface_id(grandchild_support->frame_sink_id(),
1108 grandchild_local_surface_id); 1108 grandchild_local_surface_id);
1109 1109
1110 grandchild_support->SubmitCompositorFrame(grandchild_local_surface_id,
1111 test::MakeCompositorFrame());
1112 std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create(); 1110 std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create();
1113 gfx::Rect output_rect(SurfaceSize()); 1111 gfx::Rect output_rect(SurfaceSize());
1114 gfx::Rect damage_rect(SurfaceSize()); 1112 gfx::Rect damage_rect(SurfaceSize());
1115 gfx::Transform transform_to_root_target; 1113 gfx::Transform transform_to_root_target;
1116 grandchild_pass->SetNew(pass_id, output_rect, damage_rect, 1114 grandchild_pass->SetNew(pass_id, output_rect, damage_rect,
1117 transform_to_root_target); 1115 transform_to_root_target);
1118 AddSolidColorQuadWithBlendMode( 1116 AddSolidColorQuadWithBlendMode(
1119 SurfaceSize(), grandchild_pass.get(), blend_modes[2]); 1117 SurfaceSize(), grandchild_pass.get(), blend_modes[2]);
1120 QueuePassAsFrame(std::move(grandchild_pass), grandchild_local_surface_id, 1118 QueuePassAsFrame(std::move(grandchild_pass), grandchild_local_surface_id,
1121 grandchild_support.get()); 1119 grandchild_support.get());
1122 1120
1123 LocalSurfaceId child_one_local_surface_id = allocator_.GenerateId(); 1121 LocalSurfaceId child_one_local_surface_id = allocator_.GenerateId();
1124 SurfaceId child_one_surface_id(child_one_support->frame_sink_id(), 1122 SurfaceId child_one_surface_id(child_one_support->frame_sink_id(),
1125 child_one_local_surface_id); 1123 child_one_local_surface_id);
1126 child_one_support->SubmitCompositorFrame(child_one_local_surface_id,
1127 test::MakeCompositorFrame());
1128 1124
1129 std::unique_ptr<RenderPass> child_one_pass = RenderPass::Create(); 1125 std::unique_ptr<RenderPass> child_one_pass = RenderPass::Create();
1130 child_one_pass->SetNew(pass_id, output_rect, damage_rect, 1126 child_one_pass->SetNew(pass_id, output_rect, damage_rect,
1131 transform_to_root_target); 1127 transform_to_root_target);
1132 AddSolidColorQuadWithBlendMode( 1128 AddSolidColorQuadWithBlendMode(
1133 SurfaceSize(), child_one_pass.get(), blend_modes[1]); 1129 SurfaceSize(), child_one_pass.get(), blend_modes[1]);
1134 SurfaceDrawQuad* grandchild_surface_quad = 1130 SurfaceDrawQuad* grandchild_surface_quad =
1135 child_one_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); 1131 child_one_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>();
1136 grandchild_surface_quad->SetNew( 1132 grandchild_surface_quad->SetNew(
1137 child_one_pass->shared_quad_state_list.back(), gfx::Rect(SurfaceSize()), 1133 child_one_pass->shared_quad_state_list.back(), gfx::Rect(SurfaceSize()),
1138 gfx::Rect(SurfaceSize()), grandchild_surface_id, 1134 gfx::Rect(SurfaceSize()), grandchild_surface_id,
1139 SurfaceDrawQuadType::PRIMARY, nullptr); 1135 SurfaceDrawQuadType::PRIMARY, nullptr);
1140 AddSolidColorQuadWithBlendMode( 1136 AddSolidColorQuadWithBlendMode(
1141 SurfaceSize(), child_one_pass.get(), blend_modes[3]); 1137 SurfaceSize(), child_one_pass.get(), blend_modes[3]);
1142 QueuePassAsFrame(std::move(child_one_pass), child_one_local_surface_id, 1138 QueuePassAsFrame(std::move(child_one_pass), child_one_local_surface_id,
1143 child_one_support.get()); 1139 child_one_support.get());
1144 1140
1145 LocalSurfaceId child_two_local_surface_id = allocator_.GenerateId(); 1141 LocalSurfaceId child_two_local_surface_id = allocator_.GenerateId();
1146 SurfaceId child_two_surface_id(child_two_support->frame_sink_id(), 1142 SurfaceId child_two_surface_id(child_two_support->frame_sink_id(),
1147 child_two_local_surface_id); 1143 child_two_local_surface_id);
1148 child_two_support->SubmitCompositorFrame(child_two_local_surface_id,
1149 test::MakeCompositorFrame());
1150 1144
1151 std::unique_ptr<RenderPass> child_two_pass = RenderPass::Create(); 1145 std::unique_ptr<RenderPass> child_two_pass = RenderPass::Create();
1152 child_two_pass->SetNew(pass_id, output_rect, damage_rect, 1146 child_two_pass->SetNew(pass_id, output_rect, damage_rect,
1153 transform_to_root_target); 1147 transform_to_root_target);
1154 AddSolidColorQuadWithBlendMode( 1148 AddSolidColorQuadWithBlendMode(
1155 SurfaceSize(), child_two_pass.get(), blend_modes[5]); 1149 SurfaceSize(), child_two_pass.get(), blend_modes[5]);
1156 QueuePassAsFrame(std::move(child_two_pass), child_two_local_surface_id, 1150 QueuePassAsFrame(std::move(child_two_pass), child_two_local_surface_id,
1157 child_two_support.get()); 1151 child_two_support.get());
1158 1152
1159 std::unique_ptr<RenderPass> root_pass = RenderPass::Create(); 1153 std::unique_ptr<RenderPass> root_pass = RenderPass::Create();
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 aggregated_frame = aggregator_.Aggregate(surface_id); 2273 aggregated_frame = aggregator_.Aggregate(surface_id);
2280 EXPECT_EQ(3u, aggregated_frame.render_pass_list.size()); 2274 EXPECT_EQ(3u, aggregated_frame.render_pass_list.size());
2281 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[0]->color_space); 2275 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[0]->color_space);
2282 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[1]->color_space); 2276 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[1]->color_space);
2283 EXPECT_EQ(color_space3, aggregated_frame.render_pass_list[2]->color_space); 2277 EXPECT_EQ(color_space3, aggregated_frame.render_pass_list[2]->color_space);
2284 } 2278 }
2285 2279
2286 } // namespace 2280 } // namespace
2287 } // namespace cc 2281 } // namespace cc
2288 2282
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698