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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 SubmitFrame(passes, arraysize(passes), root_surface_id_); | 154 SubmitFrame(passes, arraysize(passes), root_surface_id_); |
155 | 155 |
156 SurfaceId ids[] = {root_surface_id_}; | 156 SurfaceId ids[] = {root_surface_id_}; |
157 AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids)); | 157 AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids)); |
158 } | 158 } |
159 | 159 |
160 TEST_F(SurfaceAggregatorValidSurfaceTest, OpacityCopied) { | 160 TEST_F(SurfaceAggregatorValidSurfaceTest, OpacityCopied) { |
161 SurfaceId embedded_surface_id = allocator_.GenerateId(); | 161 SurfaceId embedded_surface_id = allocator_.GenerateId(); |
162 factory_.Create(embedded_surface_id); | 162 factory_.Create(embedded_surface_id); |
163 | 163 |
164 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; | 164 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), |
| 165 test::Quad::SolidColorQuad(SK_ColorBLUE)}; |
165 test::Pass embedded_passes[] = { | 166 test::Pass embedded_passes[] = { |
166 test::Pass(embedded_quads, arraysize(embedded_quads))}; | 167 test::Pass(embedded_quads, arraysize(embedded_quads))}; |
167 | 168 |
168 SubmitFrame(embedded_passes, arraysize(embedded_passes), embedded_surface_id); | 169 SubmitFrame(embedded_passes, arraysize(embedded_passes), embedded_surface_id); |
169 | 170 |
170 test::Quad quads[] = {test::Quad::SurfaceQuad(embedded_surface_id, .5f)}; | 171 test::Quad quads[] = {test::Quad::SurfaceQuad(embedded_surface_id, .5f)}; |
171 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; | 172 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; |
172 | 173 |
173 SubmitFrame(passes, arraysize(passes), root_surface_id_); | 174 SubmitFrame(passes, arraysize(passes), root_surface_id_); |
174 | 175 |
175 scoped_ptr<CompositorFrame> aggregated_frame = | 176 scoped_ptr<CompositorFrame> aggregated_frame = |
176 aggregator_.Aggregate(root_surface_id_); | 177 aggregator_.Aggregate(root_surface_id_); |
177 | 178 |
178 ASSERT_TRUE(aggregated_frame); | 179 ASSERT_TRUE(aggregated_frame); |
179 ASSERT_TRUE(aggregated_frame->delegated_frame_data); | 180 ASSERT_TRUE(aggregated_frame->delegated_frame_data); |
180 | 181 |
181 DelegatedFrameData* frame_data = aggregated_frame->delegated_frame_data.get(); | 182 DelegatedFrameData* frame_data = aggregated_frame->delegated_frame_data.get(); |
182 | 183 |
183 RenderPassList& render_pass_list(frame_data->render_pass_list); | 184 RenderPassList& render_pass_list(frame_data->render_pass_list); |
184 ASSERT_EQ(1u, render_pass_list.size()); | 185 ASSERT_EQ(2u, render_pass_list.size()); |
185 SharedQuadStateList& shared_quad_state_list( | 186 SharedQuadStateList& shared_quad_state_list( |
186 render_pass_list[0]->shared_quad_state_list); | 187 render_pass_list[0]->shared_quad_state_list); |
187 ASSERT_EQ(1u, shared_quad_state_list.size()); | 188 ASSERT_EQ(2u, shared_quad_state_list.size()); |
188 EXPECT_EQ(.5f, shared_quad_state_list.ElementAt(0)->opacity); | 189 EXPECT_EQ(1.f, shared_quad_state_list.ElementAt(0)->opacity); |
| 190 EXPECT_EQ(1.f, shared_quad_state_list.ElementAt(1)->opacity); |
| 191 |
| 192 SharedQuadStateList& shared_quad_state_list2( |
| 193 render_pass_list[1]->shared_quad_state_list); |
| 194 ASSERT_EQ(1u, shared_quad_state_list2.size()); |
| 195 EXPECT_EQ(.5f, shared_quad_state_list2.ElementAt(0)->opacity); |
189 | 196 |
190 factory_.Destroy(embedded_surface_id); | 197 factory_.Destroy(embedded_surface_id); |
191 } | 198 } |
192 | 199 |
193 TEST_F(SurfaceAggregatorValidSurfaceTest, OpacityCombinedWithNesting) { | |
194 SurfaceId surface_id1 = allocator_.GenerateId(); | |
195 factory_.Create(surface_id1); | |
196 SurfaceId surface_id2 = allocator_.GenerateId(); | |
197 factory_.Create(surface_id2); | |
198 | |
199 // |surface_id1| is color quad. | |
200 { | |
201 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; | |
202 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; | |
203 SubmitFrame(passes, arraysize(passes), surface_id1); | |
204 } | |
205 | |
206 // |surface_id2| has a color quad and a surface quad using |surface_id1| at .5 | |
207 // opacity. | |
208 { | |
209 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorBLUE), | |
210 test::Quad::SurfaceQuad(surface_id1, .5f)}; | |
211 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; | |
212 SubmitFrame(passes, arraysize(passes), surface_id2); | |
213 } | |
214 | |
215 // Another frame with a surface referencing |surface_id2| @ .6 opacity. | |
216 { | |
217 test::Quad quads[] = {test::Quad::SurfaceQuad(surface_id2, .6f)}; | |
218 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; | |
219 SubmitFrame(passes, arraysize(passes), root_surface_id_); | |
220 } | |
221 | |
222 scoped_ptr<CompositorFrame> aggregated_frame = | |
223 aggregator_.Aggregate(root_surface_id_); | |
224 | |
225 ASSERT_TRUE(aggregated_frame); | |
226 ASSERT_TRUE(aggregated_frame->delegated_frame_data); | |
227 | |
228 DelegatedFrameData* frame_data = aggregated_frame->delegated_frame_data.get(); | |
229 | |
230 RenderPassList& render_pass_list(frame_data->render_pass_list); | |
231 ASSERT_EQ(1u, render_pass_list.size()); | |
232 SharedQuadStateList& shared_quad_state_list( | |
233 render_pass_list[0]->shared_quad_state_list); | |
234 ASSERT_EQ(2u, shared_quad_state_list.size()); | |
235 EXPECT_EQ(.6f, shared_quad_state_list.ElementAt(0)->opacity); | |
236 EXPECT_EQ(.3f, shared_quad_state_list.ElementAt(1)->opacity); | |
237 | |
238 factory_.Destroy(surface_id1); | |
239 factory_.Destroy(surface_id2); | |
240 } | |
241 | |
242 TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSimpleFrame) { | 200 TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSimpleFrame) { |
243 test::Quad quads[][2] = {{test::Quad::SolidColorQuad(SK_ColorWHITE), | 201 test::Quad quads[][2] = {{test::Quad::SolidColorQuad(SK_ColorWHITE), |
244 test::Quad::SolidColorQuad(SK_ColorLTGRAY)}, | 202 test::Quad::SolidColorQuad(SK_ColorLTGRAY)}, |
245 {test::Quad::SolidColorQuad(SK_ColorGRAY), | 203 {test::Quad::SolidColorQuad(SK_ColorGRAY), |
246 test::Quad::SolidColorQuad(SK_ColorDKGRAY)}}; | 204 test::Quad::SolidColorQuad(SK_ColorDKGRAY)}}; |
247 test::Pass passes[] = { | 205 test::Pass passes[] = { |
248 test::Pass(quads[0], arraysize(quads[0]), RenderPassId(1, 1)), | 206 test::Pass(quads[0], arraysize(quads[0]), RenderPassId(1, 1)), |
249 test::Pass(quads[1], arraysize(quads[1]), RenderPassId(1, 2))}; | 207 test::Pass(quads[1], arraysize(quads[1]), RenderPassId(1, 2))}; |
250 | 208 |
251 SubmitFrame(passes, arraysize(passes), root_surface_id_); | 209 SubmitFrame(passes, arraysize(passes), root_surface_id_); |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 factory_.Destroy(grandchild_surface_id); | 847 factory_.Destroy(grandchild_surface_id); |
890 } | 848 } |
891 | 849 |
892 // This tests that when aggregating a frame with multiple render passes that we | 850 // This tests that when aggregating a frame with multiple render passes that we |
893 // map the transforms for the root pass but do not modify the transform on child | 851 // map the transforms for the root pass but do not modify the transform on child |
894 // passes. | 852 // passes. |
895 // | 853 // |
896 // The root surface has one pass with a surface quad transformed by +10 in the y | 854 // The root surface has one pass with a surface quad transformed by +10 in the y |
897 // direction. | 855 // direction. |
898 // | 856 // |
| 857 // The middle surface has one pass with a surface quad scaled by 2 in the x |
| 858 // and 3 in the y directions. |
| 859 // |
899 // The child surface has two passes. The first pass has a quad with a transform | 860 // The child surface has two passes. The first pass has a quad with a transform |
900 // of +5 in the x direction. The second pass has a reference to the first pass' | 861 // of +5 in the x direction. The second pass has a reference to the first pass' |
901 // pass id and a transform of +8 in the x direction. | 862 // pass id and a transform of +8 in the x direction. |
902 // | 863 // |
903 // After aggregation, the child surface's root pass quad should have both | 864 // After aggregation, the child surface's root pass quad should have all |
904 // transforms concatenated for a total transform of +8 x, +10 y. The | 865 // transforms concatenated for a total transform of +23 x, +10 y. The |
905 // contributing render pass' transform in the aggregate frame should not be | 866 // contributing render pass' transform in the aggregate frame should not be |
906 // affected. | 867 // affected. |
907 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) { | 868 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) { |
| 869 // Innermost child surface. |
908 SurfaceId child_surface_id = allocator_.GenerateId(); | 870 SurfaceId child_surface_id = allocator_.GenerateId(); |
909 factory_.Create(child_surface_id); | 871 { |
910 RenderPassId child_pass_id[] = {RenderPassId(1, 1), RenderPassId(1, 2)}; | 872 factory_.Create(child_surface_id); |
911 test::Quad child_quads[][1] = { | 873 RenderPassId child_pass_id[] = {RenderPassId(1, 1), RenderPassId(1, 2)}; |
912 {test::Quad::SolidColorQuad(SK_ColorGREEN)}, | 874 test::Quad child_quads[][1] = { |
913 {test::Quad::RenderPassQuad(child_pass_id[0])}}; | 875 {test::Quad::SolidColorQuad(SK_ColorGREEN)}, |
914 test::Pass child_passes[] = { | 876 {test::Quad::RenderPassQuad(child_pass_id[0])}, |
915 test::Pass(child_quads[0], arraysize(child_quads[0]), child_pass_id[0]), | 877 }; |
916 test::Pass(child_quads[1], arraysize(child_quads[1]), child_pass_id[1])}; | 878 test::Pass child_passes[] = { |
| 879 test::Pass(child_quads[0], arraysize(child_quads[0]), child_pass_id[0]), |
| 880 test::Pass(child_quads[1], arraysize(child_quads[1]), |
| 881 child_pass_id[1])}; |
917 | 882 |
918 RenderPassList child_pass_list; | 883 RenderPassList child_pass_list; |
919 AddPasses(&child_pass_list, | 884 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes, |
920 gfx::Rect(SurfaceSize()), | 885 arraysize(child_passes)); |
921 child_passes, | |
922 arraysize(child_passes)); | |
923 | 886 |
924 RenderPass* child_nonroot_pass = child_pass_list.at(0u); | 887 RenderPass* child_nonroot_pass = child_pass_list.at(0u); |
925 child_nonroot_pass->transform_to_root_target.Translate(8, 0); | 888 child_nonroot_pass->transform_to_root_target.Translate(8, 0); |
926 SharedQuadState* child_nonroot_pass_sqs = | 889 SharedQuadState* child_nonroot_pass_sqs = |
927 child_nonroot_pass->shared_quad_state_list.front(); | 890 child_nonroot_pass->shared_quad_state_list.front(); |
928 child_nonroot_pass_sqs->content_to_target_transform.Translate(5, 0); | 891 child_nonroot_pass_sqs->content_to_target_transform.Translate(5, 0); |
929 | 892 |
930 RenderPass* child_root_pass = child_pass_list.at(1u); | 893 RenderPass* child_root_pass = child_pass_list.at(1u); |
931 SharedQuadState* child_root_pass_sqs = | 894 SharedQuadState* child_root_pass_sqs = |
932 child_root_pass->shared_quad_state_list.front(); | 895 child_root_pass->shared_quad_state_list.front(); |
933 child_root_pass_sqs->content_to_target_transform.Translate(8, 0); | 896 child_root_pass_sqs->content_to_target_transform.Translate(8, 0); |
934 child_root_pass_sqs->is_clipped = true; | 897 child_root_pass_sqs->is_clipped = true; |
935 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); | 898 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); |
936 | 899 |
937 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); | 900 scoped_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); |
938 child_pass_list.swap(child_frame_data->render_pass_list); | 901 child_pass_list.swap(child_frame_data->render_pass_list); |
939 | 902 |
940 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 903 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
941 child_frame->delegated_frame_data = child_frame_data.Pass(); | 904 child_frame->delegated_frame_data = child_frame_data.Pass(); |
942 | 905 |
943 factory_.SubmitFrame(child_surface_id, child_frame.Pass(), | 906 factory_.SubmitFrame(child_surface_id, child_frame.Pass(), |
944 SurfaceFactory::DrawCallback()); | 907 SurfaceFactory::DrawCallback()); |
| 908 } |
945 | 909 |
| 910 // Middle child surface. |
| 911 SurfaceId middle_surface_id = allocator_.GenerateId(); |
| 912 { |
| 913 factory_.Create(middle_surface_id); |
| 914 test::Quad middle_quads[] = { |
| 915 test::Quad::SurfaceQuad(child_surface_id, 1.f)}; |
| 916 test::Pass middle_passes[] = { |
| 917 test::Pass(middle_quads, arraysize(middle_quads)), |
| 918 }; |
| 919 |
| 920 RenderPassList middle_pass_list; |
| 921 AddPasses(&middle_pass_list, gfx::Rect(SurfaceSize()), middle_passes, |
| 922 arraysize(middle_passes)); |
| 923 |
| 924 RenderPass* middle_root_pass = middle_pass_list.at(0u); |
| 925 middle_root_pass->quad_list.ElementAt(0)->visible_rect = |
| 926 gfx::Rect(0, 1, 100, 7); |
| 927 SharedQuadState* middle_root_pass_sqs = |
| 928 middle_root_pass->shared_quad_state_list.front(); |
| 929 middle_root_pass_sqs->content_to_target_transform.Scale(2, 3); |
| 930 |
| 931 scoped_ptr<DelegatedFrameData> middle_frame_data(new DelegatedFrameData); |
| 932 middle_pass_list.swap(middle_frame_data->render_pass_list); |
| 933 |
| 934 scoped_ptr<CompositorFrame> middle_frame(new CompositorFrame); |
| 935 middle_frame->delegated_frame_data = middle_frame_data.Pass(); |
| 936 |
| 937 factory_.SubmitFrame(middle_surface_id, middle_frame.Pass(), |
| 938 SurfaceFactory::DrawCallback()); |
| 939 } |
| 940 |
| 941 // Root surface. |
946 test::Quad root_quads[] = {test::Quad::SolidColorQuad(1), | 942 test::Quad root_quads[] = {test::Quad::SolidColorQuad(1), |
947 test::Quad::SurfaceQuad(child_surface_id, 1.f)}; | 943 test::Quad::SurfaceQuad(middle_surface_id, 1.f)}; |
948 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; | 944 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; |
949 | 945 |
950 RenderPassList root_pass_list; | 946 RenderPassList root_pass_list; |
951 AddPasses(&root_pass_list, | 947 AddPasses(&root_pass_list, |
952 gfx::Rect(SurfaceSize()), | 948 gfx::Rect(SurfaceSize()), |
953 root_passes, | 949 root_passes, |
954 arraysize(root_passes)); | 950 arraysize(root_passes)); |
955 | 951 |
956 root_pass_list.at(0) | 952 root_pass_list.at(0) |
957 ->shared_quad_state_list.front() | 953 ->shared_quad_state_list.front() |
958 ->content_to_target_transform.Translate(0, 7); | 954 ->content_to_target_transform.Translate(0, 7); |
959 root_pass_list.at(0) | 955 root_pass_list.at(0) |
960 ->shared_quad_state_list.ElementAt(1) | 956 ->shared_quad_state_list.ElementAt(1) |
961 ->content_to_target_transform.Translate(0, 10); | 957 ->content_to_target_transform.Translate(0, 10); |
| 958 root_pass_list.at(0)->quad_list.ElementAt(1)->visible_rect = |
| 959 gfx::Rect(0, 0, 8, 100); |
962 | 960 |
963 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); | 961 scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); |
964 root_pass_list.swap(root_frame_data->render_pass_list); | 962 root_pass_list.swap(root_frame_data->render_pass_list); |
965 | 963 |
966 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 964 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
967 root_frame->delegated_frame_data = root_frame_data.Pass(); | 965 root_frame->delegated_frame_data = root_frame_data.Pass(); |
968 | 966 |
969 factory_.SubmitFrame(root_surface_id_, root_frame.Pass(), | 967 factory_.SubmitFrame(root_surface_id_, root_frame.Pass(), |
970 SurfaceFactory::DrawCallback()); | 968 SurfaceFactory::DrawCallback()); |
971 | 969 |
(...skipping 24 matching lines...) Expand all Loading... |
996 // The first pass's transform should be unaffected by the embedding and still | 994 // The first pass's transform should be unaffected by the embedding and still |
997 // be a translation by +5 in the x direction. | 995 // be a translation by +5 in the x direction. |
998 gfx::Transform expected_aggregated_first_pass_sqs_transform; | 996 gfx::Transform expected_aggregated_first_pass_sqs_transform; |
999 expected_aggregated_first_pass_sqs_transform.Translate(5, 0); | 997 expected_aggregated_first_pass_sqs_transform.Translate(5, 0); |
1000 EXPECT_EQ(expected_aggregated_first_pass_sqs_transform.ToString(), | 998 EXPECT_EQ(expected_aggregated_first_pass_sqs_transform.ToString(), |
1001 aggregated_first_pass_sqs->content_to_target_transform.ToString()); | 999 aggregated_first_pass_sqs->content_to_target_transform.ToString()); |
1002 | 1000 |
1003 // The first pass's transform to the root target should include the aggregated | 1001 // The first pass's transform to the root target should include the aggregated |
1004 // transform. | 1002 // transform. |
1005 gfx::Transform expected_first_pass_transform_to_root_target; | 1003 gfx::Transform expected_first_pass_transform_to_root_target; |
1006 expected_first_pass_transform_to_root_target.Translate(8, 10); | 1004 expected_first_pass_transform_to_root_target.Translate(0, 10); |
| 1005 expected_first_pass_transform_to_root_target.Scale(2, 3); |
| 1006 expected_first_pass_transform_to_root_target.Translate(8, 0); |
1007 EXPECT_EQ(expected_first_pass_transform_to_root_target.ToString(), | 1007 EXPECT_EQ(expected_first_pass_transform_to_root_target.ToString(), |
1008 aggregated_pass_list[0]->transform_to_root_target.ToString()); | 1008 aggregated_pass_list[0]->transform_to_root_target.ToString()); |
1009 | 1009 |
1010 ASSERT_EQ(2u, aggregated_pass_list[1]->quad_list.size()); | 1010 ASSERT_EQ(2u, aggregated_pass_list[1]->quad_list.size()); |
1011 | 1011 |
1012 gfx::Transform expected_root_pass_quad_transforms[2]; | 1012 gfx::Transform expected_root_pass_quad_transforms[2]; |
1013 // The first quad in the root pass is the solid color quad from the original | 1013 // The first quad in the root pass is the solid color quad from the original |
1014 // root surface. Its transform should be unaffected by the aggregation and | 1014 // root surface. Its transform should be unaffected by the aggregation and |
1015 // still be +7 in the y direction. | 1015 // still be +7 in the y direction. |
1016 expected_root_pass_quad_transforms[0].Translate(0, 7); | 1016 expected_root_pass_quad_transforms[0].Translate(0, 7); |
1017 // The second quad in the root pass is aggregated from the child surface so | 1017 // The second quad in the root pass is aggregated from the child surface so |
1018 // its transform should be the combination of its original translation (0, 10) | 1018 // its transform should be the combination of its original translation |
1019 // and the child surface draw quad's translation (8, 0). | 1019 // (0, 10), the middle surface draw quad's scale of (2, 3), and the |
1020 expected_root_pass_quad_transforms[1].Translate(8, 10); | 1020 // child surface draw quad's translation (8, 0). |
| 1021 expected_root_pass_quad_transforms[1].Translate(0, 10); |
| 1022 expected_root_pass_quad_transforms[1].Scale(2, 3); |
| 1023 expected_root_pass_quad_transforms[1].Translate(8, 0); |
1021 | 1024 |
1022 for (auto iter = aggregated_pass_list[1]->quad_list.cbegin(); | 1025 for (auto iter = aggregated_pass_list[1]->quad_list.cbegin(); |
1023 iter != aggregated_pass_list[1]->quad_list.cend(); | 1026 iter != aggregated_pass_list[1]->quad_list.cend(); |
1024 ++iter) { | 1027 ++iter) { |
1025 EXPECT_EQ(expected_root_pass_quad_transforms[iter.index()].ToString(), | 1028 EXPECT_EQ(expected_root_pass_quad_transforms[iter.index()].ToString(), |
1026 iter->quadTransform().ToString()) | 1029 iter->quadTransform().ToString()) |
1027 << iter.index(); | 1030 << iter.index(); |
1028 } | 1031 } |
1029 | 1032 |
1030 EXPECT_TRUE( | 1033 EXPECT_TRUE( |
1031 aggregated_pass_list[1]->shared_quad_state_list.ElementAt(1)->is_clipped); | 1034 aggregated_pass_list[1]->shared_quad_state_list.ElementAt(1)->is_clipped); |
1032 | 1035 |
1033 // The second quad in the root pass is aggregated from the child, so its | 1036 // The second quad in the root pass is aggregated from the child, so its |
1034 // clip rect must be transformed by the child's translation. | 1037 // clip rect must be transformed by the child's translation/scale and |
1035 EXPECT_EQ(gfx::Rect(0, 10, 5, 5).ToString(), | 1038 // clipped be the visible_rects for both children. |
| 1039 EXPECT_EQ(gfx::Rect(0, 13, 8, 12).ToString(), |
1036 aggregated_pass_list[1] | 1040 aggregated_pass_list[1] |
1037 ->shared_quad_state_list.ElementAt(1) | 1041 ->shared_quad_state_list.ElementAt(1) |
1038 ->clip_rect.ToString()); | 1042 ->clip_rect.ToString()); |
1039 | 1043 |
| 1044 factory_.Destroy(middle_surface_id); |
1040 factory_.Destroy(child_surface_id); | 1045 factory_.Destroy(child_surface_id); |
1041 } | 1046 } |
1042 | 1047 |
1043 // Tests that damage rects are aggregated correctly when surfaces change. | 1048 // Tests that damage rects are aggregated correctly when surfaces change. |
1044 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) { | 1049 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) { |
1045 SurfaceId child_surface_id = allocator_.GenerateId(); | 1050 SurfaceId child_surface_id = allocator_.GenerateId(); |
1046 factory_.Create(child_surface_id); | 1051 factory_.Create(child_surface_id); |
1047 RenderPassId child_pass_id = RenderPassId(1, 1); | 1052 RenderPassId child_pass_id = RenderPassId(1, 1); |
1048 test::Quad child_quads[] = {test::Quad::RenderPassQuad(child_pass_id)}; | 1053 test::Quad child_quads[] = {test::Quad::RenderPassQuad(child_pass_id)}; |
1049 test::Pass child_passes[] = { | 1054 test::Pass child_passes[] = { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 EXPECT_THAT(returned_ids, | 1373 EXPECT_THAT(returned_ids, |
1369 testing::WhenSorted(testing::ElementsAreArray(ids))); | 1374 testing::WhenSorted(testing::ElementsAreArray(ids))); |
1370 EXPECT_EQ(3u, resource_provider_->num_resources()); | 1375 EXPECT_EQ(3u, resource_provider_->num_resources()); |
1371 factory.Destroy(surface_id); | 1376 factory.Destroy(surface_id); |
1372 factory.Destroy(surface_id2); | 1377 factory.Destroy(surface_id2); |
1373 } | 1378 } |
1374 | 1379 |
1375 } // namespace | 1380 } // namespace |
1376 } // namespace cc | 1381 } // namespace cc |
1377 | 1382 |
OLD | NEW |