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> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "cc/output/compositor_frame.h" | 14 #include "cc/output/compositor_frame.h" |
15 #include "cc/quads/render_pass.h" | 15 #include "cc/quads/render_pass.h" |
16 #include "cc/quads/render_pass_draw_quad.h" | 16 #include "cc/quads/render_pass_draw_quad.h" |
17 #include "cc/quads/solid_color_draw_quad.h" | 17 #include "cc/quads/solid_color_draw_quad.h" |
18 #include "cc/quads/surface_draw_quad.h" | 18 #include "cc/quads/surface_draw_quad.h" |
19 #include "cc/quads/texture_draw_quad.h" | 19 #include "cc/quads/texture_draw_quad.h" |
20 #include "cc/resources/shared_bitmap_manager.h" | 20 #include "cc/resources/shared_bitmap_manager.h" |
| 21 #include "cc/surfaces/local_surface_id_allocator.h" |
21 #include "cc/surfaces/surface.h" | 22 #include "cc/surfaces/surface.h" |
22 #include "cc/surfaces/surface_factory.h" | 23 #include "cc/surfaces/surface_factory.h" |
23 #include "cc/surfaces/surface_factory_client.h" | 24 #include "cc/surfaces/surface_factory_client.h" |
24 #include "cc/surfaces/surface_id_allocator.h" | |
25 #include "cc/surfaces/surface_manager.h" | 25 #include "cc/surfaces/surface_manager.h" |
26 #include "cc/test/fake_resource_provider.h" | 26 #include "cc/test/fake_resource_provider.h" |
27 #include "cc/test/render_pass_test_utils.h" | 27 #include "cc/test/render_pass_test_utils.h" |
28 #include "cc/test/surface_aggregator_test_helpers.h" | 28 #include "cc/test/surface_aggregator_test_helpers.h" |
29 #include "cc/test/test_shared_bitmap_manager.h" | 29 #include "cc/test/test_shared_bitmap_manager.h" |
30 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
32 #include "third_party/skia/include/core/SkColor.h" | 32 #include "third_party/skia/include/core/SkColor.h" |
33 | 33 |
34 namespace cc { | 34 namespace cc { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 CompositorFrame child_frame; | 169 CompositorFrame child_frame; |
170 child_frame.render_pass_list.push_back(std::move(pass)); | 170 child_frame.render_pass_list.push_back(std::move(pass)); |
171 | 171 |
172 factory->SubmitCompositorFrame(local_surface_id, std::move(child_frame), | 172 factory->SubmitCompositorFrame(local_surface_id, std::move(child_frame), |
173 SurfaceFactory::DrawCallback()); | 173 SurfaceFactory::DrawCallback()); |
174 } | 174 } |
175 | 175 |
176 protected: | 176 protected: |
177 LocalSurfaceId root_local_surface_id_; | 177 LocalSurfaceId root_local_surface_id_; |
178 Surface* root_surface_; | 178 Surface* root_surface_; |
179 SurfaceIdAllocator allocator_; | 179 LocalSurfaceIdAllocator allocator_; |
180 EmptySurfaceFactoryClient empty_child_client_; | 180 EmptySurfaceFactoryClient empty_child_client_; |
181 SurfaceFactory child_factory_; | 181 SurfaceFactory child_factory_; |
182 SurfaceIdAllocator child_allocator_; | 182 LocalSurfaceIdAllocator child_allocator_; |
183 }; | 183 }; |
184 | 184 |
185 // Tests that a very simple frame containing only two solid color quads makes it | 185 // Tests that a very simple frame containing only two solid color quads makes it |
186 // through the aggregator correctly. | 186 // through the aggregator correctly. |
187 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleFrame) { | 187 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleFrame) { |
188 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorRED), | 188 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorRED), |
189 test::Quad::SolidColorQuad(SK_ColorBLUE)}; | 189 test::Quad::SolidColorQuad(SK_ColorBLUE)}; |
190 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; | 190 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; |
191 | 191 |
192 SubmitCompositorFrame(&factory_, passes, arraysize(passes), | 192 SubmitCompositorFrame(&factory_, passes, arraysize(passes), |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2197 aggregator_.SetOutputColorSpace(color_space2); | 2197 aggregator_.SetOutputColorSpace(color_space2); |
2198 aggregated_frame = aggregator_.Aggregate(surface_id); | 2198 aggregated_frame = aggregator_.Aggregate(surface_id); |
2199 EXPECT_EQ(2u, aggregated_frame.render_pass_list.size()); | 2199 EXPECT_EQ(2u, aggregated_frame.render_pass_list.size()); |
2200 EXPECT_EQ(color_space2, aggregated_frame.render_pass_list[0]->color_space); | 2200 EXPECT_EQ(color_space2, aggregated_frame.render_pass_list[0]->color_space); |
2201 EXPECT_EQ(color_space2, aggregated_frame.render_pass_list[1]->color_space); | 2201 EXPECT_EQ(color_space2, aggregated_frame.render_pass_list[1]->color_space); |
2202 } | 2202 } |
2203 | 2203 |
2204 } // namespace | 2204 } // namespace |
2205 } // namespace cc | 2205 } // namespace cc |
2206 | 2206 |
OLD | NEW |