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/draw_quad.h" | 5 #include "cc/quads/draw_quad.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 scoped_ptr<SharedQuadState> shared_state(CreateSharedQuadState()); \ | 97 scoped_ptr<SharedQuadState> shared_state(CreateSharedQuadState()); \ |
98 scoped_ptr<SharedQuadState> copy_shared_state(new SharedQuadState); \ | 98 scoped_ptr<SharedQuadState> copy_shared_state(new SharedQuadState); \ |
99 copy_shared_state->CopyFrom(shared_state.get()); | 99 copy_shared_state->CopyFrom(shared_state.get()); |
100 | 100 |
101 #define QUAD_DATA \ | 101 #define QUAD_DATA \ |
102 gfx::Rect quad_rect(30, 40, 50, 60); \ | 102 gfx::Rect quad_rect(30, 40, 50, 60); \ |
103 gfx::Rect quad_visible_rect(40, 50, 30, 20); \ | 103 gfx::Rect quad_visible_rect(40, 50, 30, 20); \ |
104 gfx::Rect ALLOW_UNUSED quad_opaque_rect(60, 55, 10, 10); \ | 104 gfx::Rect ALLOW_UNUSED quad_opaque_rect(60, 55, 10, 10); \ |
105 bool ALLOW_UNUSED needs_blending = true; | 105 bool ALLOW_UNUSED needs_blending = true; |
106 | 106 |
107 #define SETUP_AND_COPY_QUAD_NEW(Type, quad) \ | 107 #define SETUP_AND_COPY_QUAD_NEW(Type, quad) \ |
108 scoped_ptr<DrawQuad> copy_new(quad_new->Copy(copy_shared_state.get())); \ | 108 scoped_ptr<Type> copy_new(new Type(*quad_new)); \ |
danakj
2014/07/09 22:36:17
This was meant to test the Copy() method on DrawQu
| |
109 CompareDrawQuad(quad_new.get(), copy_new.get(), copy_shared_state.get()); \ | 109 copy_new->shared_quad_state = copy_shared_state.get(); \ |
110 const Type* ALLOW_UNUSED copy_quad = Type::MaterialCast(copy_new.get()); | 110 CompareDrawQuad(quad_new.get(), copy_new.get(), copy_shared_state.get()); \ |
111 const Type* ALLOW_UNUSED copy_quad = copy_new.get(); | |
111 | 112 |
112 #define SETUP_AND_COPY_QUAD_ALL(Type, quad) \ | 113 #define SETUP_AND_COPY_QUAD_ALL(Type, quad) \ |
113 scoped_ptr<DrawQuad> copy_all(quad_all->Copy(copy_shared_state.get())); \ | 114 scoped_ptr<Type> copy_all(new Type(*quad_all)); \ |
114 CompareDrawQuad(quad_all.get(), copy_all.get(), copy_shared_state.get()); \ | 115 copy_all->shared_quad_state = copy_shared_state.get(); \ |
115 copy_quad = Type::MaterialCast(copy_all.get()); | 116 CompareDrawQuad(quad_all.get(), copy_all.get(), copy_shared_state.get()); \ |
117 copy_quad = copy_all.get(); | |
116 | 118 |
117 #define SETUP_AND_COPY_QUAD_NEW_1(Type, quad, a) \ | 119 // By moving the Copy function to RenderPass, this unit test has to make copy |
118 scoped_ptr<DrawQuad> copy_new(quad_new->Copy(copy_shared_state.get(), a)); \ | 120 // on its own. The only case when a copy function takes in an extra parameter |
119 CompareDrawQuad(quad_new.get(), copy_new.get(), copy_shared_state.get()); \ | 121 // is RenderPassDrawQuad copy where extra parameter is RenderPass::Id. |
120 const Type* ALLOW_UNUSED copy_quad = Type::MaterialCast(copy_new.get()); | 122 #define SETUP_AND_COPY_QUAD_NEW_1(Type, quad, a) \ |
123 scoped_ptr<Type> copy_new(new Type(*quad_new)); \ | |
124 copy_new->shared_quad_state = copy_shared_state.get(); \ | |
125 copy_new->render_pass_id = a; \ | |
126 CompareDrawQuad(quad_new.get(), copy_new.get(), copy_shared_state.get()); \ | |
127 const Type* ALLOW_UNUSED copy_quad = copy_new.get(); | |
121 | 128 |
122 #define SETUP_AND_COPY_QUAD_ALL_1(Type, quad, a) \ | 129 #define SETUP_AND_COPY_QUAD_ALL_1(Type, quad, a) \ |
123 scoped_ptr<DrawQuad> copy_all(quad_all->Copy(copy_shared_state.get(), a)); \ | 130 scoped_ptr<Type> copy_all(new Type(*quad_all)); \ |
124 CompareDrawQuad(quad_all.get(), copy_all.get(), copy_shared_state.get()); \ | 131 copy_all->shared_quad_state = copy_shared_state.get(); \ |
125 copy_quad = Type::MaterialCast(copy_all.get()); | 132 copy_all->render_pass_id = a; \ |
133 CompareDrawQuad(quad_all.get(), copy_all.get(), copy_shared_state.get()); \ | |
134 copy_quad = copy_all.get(); | |
126 | 135 |
127 #define CREATE_QUAD_1_NEW(Type, a) \ | 136 #define CREATE_QUAD_1_NEW(Type, a) \ |
128 scoped_ptr<Type> quad_new(Type::Create()); \ | 137 scoped_ptr<Type> quad_new(Type::Create()); \ |
129 { \ | 138 { \ |
130 QUAD_DATA \ | 139 QUAD_DATA \ |
131 quad_new->SetNew(shared_state.get(), quad_rect, a); \ | 140 quad_new->SetNew(shared_state.get(), quad_rect, a); \ |
132 } \ | 141 } \ |
133 SETUP_AND_COPY_QUAD_NEW(Type, quad_new); | 142 SETUP_AND_COPY_QUAD_NEW(Type, quad_new); |
134 | 143 |
135 #define CREATE_QUAD_1_ALL(Type, a) \ | 144 #define CREATE_QUAD_1_ALL(Type, a) \ |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
908 texture_size, | 917 texture_size, |
909 texture_format, | 918 texture_format, |
910 content_rect, | 919 content_rect, |
911 contents_scale, | 920 contents_scale, |
912 picture_pile); | 921 picture_pile); |
913 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 922 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
914 } | 923 } |
915 | 924 |
916 } // namespace | 925 } // namespace |
917 } // namespace cc | 926 } // namespace cc |
OLD | NEW |