OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 RenderPass::RenderPass() | 64 RenderPass::RenderPass() |
65 : quad_list(kDefaultNumQuadsToReserve), | 65 : quad_list(kDefaultNumQuadsToReserve), |
66 shared_quad_state_list(ALIGNOF(SharedQuadState), | 66 shared_quad_state_list(ALIGNOF(SharedQuadState), |
67 sizeof(SharedQuadState), | 67 sizeof(SharedQuadState), |
68 kDefaultNumSharedQuadStatesToReserve) {} | 68 kDefaultNumSharedQuadStatesToReserve) {} |
69 | 69 |
70 // Each layer usually produces one shared quad state, so the number of layers | 70 // Each layer usually produces one shared quad state, so the number of layers |
71 // is a good hint for what to reserve here. | 71 // is a good hint for what to reserve here. |
72 RenderPass::RenderPass(size_t num_layers) | 72 RenderPass::RenderPass(size_t num_layers) |
73 : has_transparent_background(true), | 73 : has_transparent_background(true), |
| 74 force_render_surface(false), |
| 75 has_property_change_on_contributing_render_surface(false), |
| 76 has_damage_on_surface_quad(false), |
74 quad_list(kDefaultNumQuadsToReserve), | 77 quad_list(kDefaultNumQuadsToReserve), |
75 shared_quad_state_list(ALIGNOF(SharedQuadState), | 78 shared_quad_state_list(ALIGNOF(SharedQuadState), |
76 sizeof(SharedQuadState), | 79 sizeof(SharedQuadState), |
77 num_layers) {} | 80 num_layers) {} |
78 | 81 |
79 RenderPass::RenderPass(size_t shared_quad_state_list_size, | 82 RenderPass::RenderPass(size_t shared_quad_state_list_size, |
80 size_t quad_list_size) | 83 size_t quad_list_size) |
81 : has_transparent_background(true), | 84 : has_transparent_background(true), |
| 85 force_render_surface(false), |
| 86 has_property_change_on_contributing_render_surface(false), |
| 87 has_damage_on_surface_quad(false), |
82 quad_list(quad_list_size), | 88 quad_list(quad_list_size), |
83 shared_quad_state_list(ALIGNOF(SharedQuadState), | 89 shared_quad_state_list(ALIGNOF(SharedQuadState), |
84 sizeof(SharedQuadState), | 90 sizeof(SharedQuadState), |
85 shared_quad_state_list_size) {} | 91 shared_quad_state_list_size) {} |
86 | 92 |
87 RenderPass::~RenderPass() { | 93 RenderPass::~RenderPass() { |
88 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 94 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
89 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), "cc::RenderPass", | 95 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), "cc::RenderPass", |
90 reinterpret_cast<void*>(id)); | 96 reinterpret_cast<void*>(id)); |
91 } | 97 } |
92 | 98 |
93 std::unique_ptr<RenderPass> RenderPass::Copy(int new_id) const { | 99 std::unique_ptr<RenderPass> RenderPass::Copy(int new_id) const { |
94 std::unique_ptr<RenderPass> copy_pass( | 100 std::unique_ptr<RenderPass> copy_pass( |
95 Create(shared_quad_state_list.size(), quad_list.size())); | 101 Create(shared_quad_state_list.size(), quad_list.size())); |
96 copy_pass->SetAll(new_id, output_rect, damage_rect, transform_to_root_target, | 102 copy_pass->SetAll(new_id, output_rect, damage_rect, transform_to_root_target, |
97 filters, background_filters, color_space, | 103 filters, background_filters, color_space, |
98 has_transparent_background); | 104 has_transparent_background, force_render_surface, |
| 105 has_property_change_on_contributing_render_surface, |
| 106 has_damage_on_surface_quad); |
99 return copy_pass; | 107 return copy_pass; |
100 } | 108 } |
101 | 109 |
102 std::unique_ptr<RenderPass> RenderPass::DeepCopy() const { | 110 std::unique_ptr<RenderPass> RenderPass::DeepCopy() const { |
103 // Since we can't copy these, it's wrong to use DeepCopy in a situation where | 111 // Since we can't copy these, it's wrong to use DeepCopy in a situation where |
104 // you may have copy_requests present. | 112 // you may have copy_requests present. |
105 DCHECK_EQ(copy_requests.size(), 0u); | 113 DCHECK_EQ(copy_requests.size(), 0u); |
106 | 114 |
107 std::unique_ptr<RenderPass> copy_pass( | 115 std::unique_ptr<RenderPass> copy_pass( |
108 Create(shared_quad_state_list.size(), quad_list.size())); | 116 Create(shared_quad_state_list.size(), quad_list.size())); |
109 copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target, | 117 copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target, |
110 filters, background_filters, color_space, | 118 filters, background_filters, color_space, |
111 has_transparent_background); | 119 has_transparent_background, force_render_surface, |
| 120 has_property_change_on_contributing_render_surface, |
| 121 has_damage_on_surface_quad); |
112 for (auto* shared_quad_state : shared_quad_state_list) { | 122 for (auto* shared_quad_state : shared_quad_state_list) { |
113 SharedQuadState* copy_shared_quad_state = | 123 SharedQuadState* copy_shared_quad_state = |
114 copy_pass->CreateAndAppendSharedQuadState(); | 124 copy_pass->CreateAndAppendSharedQuadState(); |
115 *copy_shared_quad_state = *shared_quad_state; | 125 *copy_shared_quad_state = *shared_quad_state; |
116 } | 126 } |
117 SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin(); | 127 SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin(); |
118 SharedQuadStateList::Iterator copy_sqs_iter = | 128 SharedQuadStateList::Iterator copy_sqs_iter = |
119 copy_pass->shared_quad_state_list.begin(); | 129 copy_pass->shared_quad_state_list.begin(); |
120 for (auto* quad : quad_list) { | 130 for (auto* quad : quad_list) { |
121 while (quad->shared_quad_state != *sqs_iter) { | 131 while (quad->shared_quad_state != *sqs_iter) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 DCHECK(shared_quad_state_list.empty()); | 174 DCHECK(shared_quad_state_list.empty()); |
165 } | 175 } |
166 | 176 |
167 void RenderPass::SetAll(int id, | 177 void RenderPass::SetAll(int id, |
168 const gfx::Rect& output_rect, | 178 const gfx::Rect& output_rect, |
169 const gfx::Rect& damage_rect, | 179 const gfx::Rect& damage_rect, |
170 const gfx::Transform& transform_to_root_target, | 180 const gfx::Transform& transform_to_root_target, |
171 const FilterOperations& filters, | 181 const FilterOperations& filters, |
172 const FilterOperations& background_filters, | 182 const FilterOperations& background_filters, |
173 const gfx::ColorSpace& color_space, | 183 const gfx::ColorSpace& color_space, |
174 bool has_transparent_background) { | 184 bool has_transparent_background, |
| 185 bool force_render_surface, |
| 186 bool has_property_change_on_contributing_render_surface, |
| 187 bool has_damage_on_surface_quad) { |
175 DCHECK(id); | 188 DCHECK(id); |
176 | 189 |
177 this->id = id; | 190 this->id = id; |
178 this->output_rect = output_rect; | 191 this->output_rect = output_rect; |
179 this->damage_rect = damage_rect; | 192 this->damage_rect = damage_rect; |
180 this->transform_to_root_target = transform_to_root_target; | 193 this->transform_to_root_target = transform_to_root_target; |
181 this->filters = filters; | 194 this->filters = filters; |
182 this->background_filters = background_filters; | 195 this->background_filters = background_filters; |
183 this->color_space = color_space; | 196 this->color_space = color_space; |
184 this->has_transparent_background = has_transparent_background; | 197 this->has_transparent_background = has_transparent_background; |
| 198 this->force_render_surface = force_render_surface; |
| 199 this->has_property_change_on_contributing_render_surface = |
| 200 has_property_change_on_contributing_render_surface; |
| 201 this->has_damage_on_surface_quad = has_damage_on_surface_quad; |
185 | 202 |
186 DCHECK(quad_list.empty()); | 203 DCHECK(quad_list.empty()); |
187 DCHECK(shared_quad_state_list.empty()); | 204 DCHECK(shared_quad_state_list.empty()); |
188 } | 205 } |
189 | 206 |
190 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { | 207 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { |
191 MathUtil::AddToTracedValue("output_rect", output_rect, value); | 208 MathUtil::AddToTracedValue("output_rect", output_rect, value); |
192 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); | 209 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); |
193 | 210 |
194 value->SetBoolean("has_transparent_background", has_transparent_background); | 211 value->SetBoolean("has_transparent_background", has_transparent_background); |
| 212 value->SetBoolean("force_render_surface", force_render_surface); |
| 213 value->SetBoolean("has_property_change_on_contributing_render_surface", |
| 214 has_property_change_on_contributing_render_surface); |
| 215 value->SetBoolean("has_damage_on_surface_quad", has_damage_on_surface_quad); |
195 value->SetInteger("copy_requests", | 216 value->SetInteger("copy_requests", |
196 base::saturated_cast<int>(copy_requests.size())); | 217 base::saturated_cast<int>(copy_requests.size())); |
197 | 218 |
198 value->BeginArray("filters"); | 219 value->BeginArray("filters"); |
199 filters.AsValueInto(value); | 220 filters.AsValueInto(value); |
200 value->EndArray(); | 221 value->EndArray(); |
201 | 222 |
202 value->BeginArray("background_filters"); | 223 value->BeginArray("background_filters"); |
203 background_filters.AsValueInto(value); | 224 background_filters.AsValueInto(value); |
204 value->EndArray(); | 225 value->EndArray(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 case DrawQuad::RENDER_PASS: | 292 case DrawQuad::RENDER_PASS: |
272 case DrawQuad::INVALID: | 293 case DrawQuad::INVALID: |
273 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; | 294 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; |
274 break; | 295 break; |
275 } | 296 } |
276 quad_list.back()->shared_quad_state = shared_quad_state; | 297 quad_list.back()->shared_quad_state = shared_quad_state; |
277 return quad_list.back(); | 298 return quad_list.back(); |
278 } | 299 } |
279 | 300 |
280 } // namespace cc | 301 } // namespace cc |
OLD | NEW |