OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/quads/render_pass.h" | 5 #include "cc/quads/render_pass.h" |
6 | 6 |
7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
8 #include "cc/base/scoped_ptr_vector.h" | |
9 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 9 #include "cc/quads/render_pass_draw_quad.h" |
11 #include "cc/quads/solid_color_draw_quad.h" | 10 #include "cc/quads/solid_color_draw_quad.h" |
12 #include "cc/test/geometry_test_utils.h" | 11 #include "cc/test/geometry_test_utils.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 13 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
15 #include "ui/gfx/transform.h" | 14 #include "ui/gfx/transform.h" |
16 | 15 |
17 namespace cc { | 16 namespace cc { |
18 namespace { | 17 namespace { |
19 | 18 |
20 struct RenderPassSize { | 19 struct RenderPassSize { |
21 // If you add a new field to this class, make sure to add it to the | 20 // If you add a new field to this class, make sure to add it to the |
22 // Copy() tests. | 21 // Copy() tests. |
23 RenderPassId id; | 22 RenderPassId id; |
24 QuadList quad_list; | 23 QuadList quad_list; |
25 SharedQuadStateList shared_quad_state_list; | 24 SharedQuadStateList shared_quad_state_list; |
26 gfx::Transform transform_to_root_target; | 25 gfx::Transform transform_to_root_target; |
27 gfx::Rect output_rect; | 26 gfx::Rect output_rect; |
28 gfx::Rect damage_rect; | 27 gfx::Rect damage_rect; |
29 bool has_transparent_background; | 28 bool has_transparent_background; |
30 std::vector<SurfaceId> referenced_surfaces; | 29 std::vector<SurfaceId> referenced_surfaces; |
31 ScopedPtrVector<CopyOutputRequest> copy_callbacks; | 30 std::vector<scoped_ptr<CopyOutputRequest>> copy_callbacks; |
32 }; | 31 }; |
33 | 32 |
34 static void CompareRenderPassLists(const RenderPassList& expected_list, | 33 static void CompareRenderPassLists(const RenderPassList& expected_list, |
35 const RenderPassList& actual_list) { | 34 const RenderPassList& actual_list) { |
36 EXPECT_EQ(expected_list.size(), actual_list.size()); | 35 EXPECT_EQ(expected_list.size(), actual_list.size()); |
37 for (size_t i = 0; i < actual_list.size(); ++i) { | 36 for (size_t i = 0; i < actual_list.size(); ++i) { |
38 RenderPass* expected = expected_list[i]; | 37 RenderPass* expected = expected_list[i].get(); |
39 RenderPass* actual = actual_list[i]; | 38 RenderPass* actual = actual_list[i].get(); |
40 | 39 |
41 EXPECT_EQ(expected->id, actual->id); | 40 EXPECT_EQ(expected->id, actual->id); |
42 EXPECT_EQ(expected->output_rect, actual->output_rect); | 41 EXPECT_EQ(expected->output_rect, actual->output_rect); |
43 EXPECT_EQ(expected->transform_to_root_target, | 42 EXPECT_EQ(expected->transform_to_root_target, |
44 actual->transform_to_root_target); | 43 actual->transform_to_root_target); |
45 EXPECT_EQ(expected->damage_rect, actual->damage_rect); | 44 EXPECT_EQ(expected->damage_rect, actual->damage_rect); |
46 EXPECT_EQ(expected->has_transparent_background, | 45 EXPECT_EQ(expected->has_transparent_background, |
47 actual->has_transparent_background); | 46 actual->has_transparent_background); |
48 | 47 |
49 EXPECT_EQ(expected->shared_quad_state_list.size(), | 48 EXPECT_EQ(expected->shared_quad_state_list.size(), |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 307 |
309 // Make a copy with CopyAll(). | 308 // Make a copy with CopyAll(). |
310 RenderPassList copy_list; | 309 RenderPassList copy_list; |
311 RenderPass::CopyAll(pass_list, ©_list); | 310 RenderPass::CopyAll(pass_list, ©_list); |
312 | 311 |
313 CompareRenderPassLists(pass_list, copy_list); | 312 CompareRenderPassLists(pass_list, copy_list); |
314 } | 313 } |
315 | 314 |
316 } // namespace | 315 } // namespace |
317 } // namespace cc | 316 } // namespace cc |
OLD | NEW |