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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 gfx::Rect output_rect(45, 22, 120, 13); | 72 gfx::Rect output_rect(45, 22, 120, 13); |
73 gfx::Transform transform_to_root = | 73 gfx::Transform transform_to_root = |
74 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); | 74 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); |
75 gfx::Rect damage_rect(56, 123, 19, 43); | 75 gfx::Rect damage_rect(56, 123, 19, 43); |
76 FilterOperations filters; | 76 FilterOperations filters; |
77 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); | 77 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); |
78 FilterOperations background_filters; | 78 FilterOperations background_filters; |
79 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); | 79 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); |
80 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSRGB(); | 80 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSRGB(); |
81 bool has_transparent_background = true; | 81 bool has_transparent_background = true; |
| 82 bool cache_render_pass = false; |
| 83 bool has_damage_from_contributing_content = false; |
82 | 84 |
83 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 85 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
84 pass->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root, | 86 pass->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root, |
85 filters, background_filters, color_space, | 87 filters, background_filters, color_space, |
86 has_transparent_background); | 88 has_transparent_background, cache_render_pass, |
| 89 has_damage_from_contributing_content); |
87 pass->copy_requests.push_back(viz::CopyOutputRequest::CreateEmptyRequest()); | 90 pass->copy_requests.push_back(viz::CopyOutputRequest::CreateEmptyRequest()); |
88 | 91 |
89 // Stick a quad in the pass, this should not get copied. | 92 // Stick a quad in the pass, this should not get copied. |
90 SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); | 93 SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); |
91 shared_state->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), gfx::Rect(), | 94 shared_state->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), gfx::Rect(), |
92 false, 1, SkBlendMode::kSrcOver, 0); | 95 false, 1, SkBlendMode::kSrcOver, 0); |
93 | 96 |
94 SolidColorDrawQuad* color_quad = | 97 SolidColorDrawQuad* color_quad = |
95 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 98 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
96 color_quad->SetNew(pass->shared_quad_state_list.back(), gfx::Rect(), | 99 color_quad->SetNew(pass->shared_quad_state_list.back(), gfx::Rect(), |
(...skipping 25 matching lines...) Expand all Loading... |
122 gfx::Rect output_rect(45, 22, 120, 13); | 125 gfx::Rect output_rect(45, 22, 120, 13); |
123 gfx::Transform transform_to_root = | 126 gfx::Transform transform_to_root = |
124 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); | 127 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); |
125 gfx::Rect damage_rect(56, 123, 19, 43); | 128 gfx::Rect damage_rect(56, 123, 19, 43); |
126 FilterOperations filters; | 129 FilterOperations filters; |
127 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); | 130 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); |
128 FilterOperations background_filters; | 131 FilterOperations background_filters; |
129 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); | 132 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); |
130 gfx::ColorSpace color_space = gfx::ColorSpace::CreateXYZD50(); | 133 gfx::ColorSpace color_space = gfx::ColorSpace::CreateXYZD50(); |
131 bool has_transparent_background = true; | 134 bool has_transparent_background = true; |
| 135 bool cache_render_pass = false; |
| 136 bool has_damage_from_contributing_content = false; |
132 | 137 |
133 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 138 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
134 pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters, | 139 pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters, |
135 background_filters, color_space, has_transparent_background); | 140 background_filters, color_space, has_transparent_background, |
| 141 cache_render_pass, has_damage_from_contributing_content); |
136 | 142 |
137 // Two quads using one shared state. | 143 // Two quads using one shared state. |
138 SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState(); | 144 SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState(); |
139 shared_state1->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(), | 145 shared_state1->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(), |
140 gfx::Rect(), false, 1, SkBlendMode::kSrcOver, 0); | 146 gfx::Rect(), false, 1, SkBlendMode::kSrcOver, 0); |
141 | 147 |
142 SolidColorDrawQuad* color_quad1 = | 148 SolidColorDrawQuad* color_quad1 = |
143 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 149 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
144 color_quad1->SetNew(pass->shared_quad_state_list.back(), | 150 color_quad1->SetNew(pass->shared_quad_state_list.back(), |
145 gfx::Rect(1, 1, 1, 1), gfx::Rect(1, 1, 1, 1), SkColor(), | 151 gfx::Rect(1, 1, 1, 1), gfx::Rect(1, 1, 1, 1), SkColor(), |
(...skipping 27 matching lines...) Expand all Loading... |
173 gfx::Rect contrib_output_rect(10, 15, 12, 17); | 179 gfx::Rect contrib_output_rect(10, 15, 12, 17); |
174 gfx::Transform contrib_transform_to_root = | 180 gfx::Transform contrib_transform_to_root = |
175 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); | 181 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); |
176 gfx::Rect contrib_damage_rect(11, 16, 10, 15); | 182 gfx::Rect contrib_damage_rect(11, 16, 10, 15); |
177 FilterOperations contrib_filters; | 183 FilterOperations contrib_filters; |
178 contrib_filters.Append(FilterOperation::CreateSepiaFilter(0.5)); | 184 contrib_filters.Append(FilterOperation::CreateSepiaFilter(0.5)); |
179 FilterOperations contrib_background_filters; | 185 FilterOperations contrib_background_filters; |
180 contrib_background_filters.Append(FilterOperation::CreateSaturateFilter(1)); | 186 contrib_background_filters.Append(FilterOperation::CreateSaturateFilter(1)); |
181 gfx::ColorSpace contrib_color_space = gfx::ColorSpace::CreateSCRGBLinear(); | 187 gfx::ColorSpace contrib_color_space = gfx::ColorSpace::CreateSCRGBLinear(); |
182 bool contrib_has_transparent_background = true; | 188 bool contrib_has_transparent_background = true; |
| 189 bool contrib_cache_render_pass = false; |
| 190 bool contrib_has_damage_from_contributing_content = false; |
183 | 191 |
184 std::unique_ptr<RenderPass> contrib = RenderPass::Create(); | 192 std::unique_ptr<RenderPass> contrib = RenderPass::Create(); |
185 contrib->SetAll(contrib_id, contrib_output_rect, contrib_damage_rect, | 193 contrib->SetAll(contrib_id, contrib_output_rect, contrib_damage_rect, |
186 contrib_transform_to_root, contrib_filters, | 194 contrib_transform_to_root, contrib_filters, |
187 contrib_background_filters, contrib_color_space, | 195 contrib_background_filters, contrib_color_space, |
188 contrib_has_transparent_background); | 196 contrib_has_transparent_background, contrib_cache_render_pass, |
| 197 contrib_has_damage_from_contributing_content); |
189 | 198 |
190 SharedQuadState* contrib_shared_state = | 199 SharedQuadState* contrib_shared_state = |
191 contrib->CreateAndAppendSharedQuadState(); | 200 contrib->CreateAndAppendSharedQuadState(); |
192 contrib_shared_state->SetAll(gfx::Transform(), gfx::Rect(0, 0, 2, 2), | 201 contrib_shared_state->SetAll(gfx::Transform(), gfx::Rect(0, 0, 2, 2), |
193 gfx::Rect(), gfx::Rect(), false, 1, | 202 gfx::Rect(), gfx::Rect(), false, 1, |
194 SkBlendMode::kSrcOver, 0); | 203 SkBlendMode::kSrcOver, 0); |
195 | 204 |
196 SolidColorDrawQuad* contrib_quad = | 205 SolidColorDrawQuad* contrib_quad = |
197 contrib->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 206 contrib->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
198 contrib_quad->SetNew(contrib->shared_quad_state_list.back(), | 207 contrib_quad->SetNew(contrib->shared_quad_state_list.back(), |
(...skipping 24 matching lines...) Expand all Loading... |
223 gfx::Rect output_rect(45, 22, 120, 13); | 232 gfx::Rect output_rect(45, 22, 120, 13); |
224 gfx::Transform transform_to_root = | 233 gfx::Transform transform_to_root = |
225 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); | 234 gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); |
226 gfx::Rect damage_rect(56, 123, 19, 43); | 235 gfx::Rect damage_rect(56, 123, 19, 43); |
227 FilterOperations filters; | 236 FilterOperations filters; |
228 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); | 237 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); |
229 FilterOperations background_filters; | 238 FilterOperations background_filters; |
230 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); | 239 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); |
231 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSCRGBLinear(); | 240 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSCRGBLinear(); |
232 bool has_transparent_background = true; | 241 bool has_transparent_background = true; |
| 242 bool cache_render_pass = false; |
| 243 bool has_damage_from_contributing_content = false; |
233 | 244 |
234 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 245 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
235 pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters, | 246 pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters, |
236 background_filters, color_space, has_transparent_background); | 247 background_filters, color_space, has_transparent_background, |
| 248 cache_render_pass, has_damage_from_contributing_content); |
237 | 249 |
238 // A shared state with a quad. | 250 // A shared state with a quad. |
239 SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState(); | 251 SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState(); |
240 shared_state1->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(), | 252 shared_state1->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(), |
241 gfx::Rect(), false, 1, SkBlendMode::kSrcOver, 0); | 253 gfx::Rect(), false, 1, SkBlendMode::kSrcOver, 0); |
242 | 254 |
243 SolidColorDrawQuad* color_quad1 = | 255 SolidColorDrawQuad* color_quad1 = |
244 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 256 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
245 color_quad1->SetNew(pass->shared_quad_state_list.back(), | 257 color_quad1->SetNew(pass->shared_quad_state_list.back(), |
246 gfx::Rect(1, 1, 1, 1), gfx::Rect(1, 1, 1, 1), SkColor(), | 258 gfx::Rect(1, 1, 1, 1), gfx::Rect(1, 1, 1, 1), SkColor(), |
(...skipping 24 matching lines...) Expand all Loading... |
271 | 283 |
272 // Make a copy with CopyAll(). | 284 // Make a copy with CopyAll(). |
273 RenderPassList copy_list; | 285 RenderPassList copy_list; |
274 RenderPass::CopyAll(pass_list, ©_list); | 286 RenderPass::CopyAll(pass_list, ©_list); |
275 | 287 |
276 CompareRenderPassLists(pass_list, copy_list); | 288 CompareRenderPassLists(pass_list, copy_list); |
277 } | 289 } |
278 | 290 |
279 } // namespace | 291 } // namespace |
280 } // namespace cc | 292 } // namespace cc |
OLD | NEW |