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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 RenderPass::~RenderPass() { | 85 RenderPass::~RenderPass() { |
86 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 86 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
87 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 87 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
88 "cc::RenderPass", id.AsTracingId()); | 88 "cc::RenderPass", id.AsTracingId()); |
89 } | 89 } |
90 | 90 |
91 std::unique_ptr<RenderPass> RenderPass::Copy(RenderPassId new_id) const { | 91 std::unique_ptr<RenderPass> RenderPass::Copy(RenderPassId new_id) const { |
92 std::unique_ptr<RenderPass> copy_pass( | 92 std::unique_ptr<RenderPass> copy_pass( |
93 Create(shared_quad_state_list.size(), quad_list.size())); | 93 Create(shared_quad_state_list.size(), quad_list.size())); |
94 copy_pass->SetAll(new_id, | 94 copy_pass->SetAll(new_id, output_rect, damage_rect, transform_to_root_target, |
95 output_rect, | 95 filters, background_filters, has_transparent_background); |
96 damage_rect, | |
97 transform_to_root_target, | |
98 has_transparent_background); | |
99 return copy_pass; | 96 return copy_pass; |
100 } | 97 } |
101 | 98 |
102 std::unique_ptr<RenderPass> RenderPass::DeepCopy() const { | 99 std::unique_ptr<RenderPass> RenderPass::DeepCopy() const { |
103 // Since we can't copy these, it's wrong to use DeepCopy in a situation where | 100 // Since we can't copy these, it's wrong to use DeepCopy in a situation where |
104 // you may have copy_requests present. | 101 // you may have copy_requests present. |
105 DCHECK_EQ(copy_requests.size(), 0u); | 102 DCHECK_EQ(copy_requests.size(), 0u); |
106 | 103 |
107 std::unique_ptr<RenderPass> copy_pass( | 104 std::unique_ptr<RenderPass> copy_pass( |
108 Create(shared_quad_state_list.size(), quad_list.size())); | 105 Create(shared_quad_state_list.size(), quad_list.size())); |
109 copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target, | 106 copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target, |
110 has_transparent_background); | 107 filters, background_filters, has_transparent_background); |
111 for (auto* shared_quad_state : shared_quad_state_list) { | 108 for (auto* shared_quad_state : shared_quad_state_list) { |
112 SharedQuadState* copy_shared_quad_state = | 109 SharedQuadState* copy_shared_quad_state = |
113 copy_pass->CreateAndAppendSharedQuadState(); | 110 copy_pass->CreateAndAppendSharedQuadState(); |
114 *copy_shared_quad_state = *shared_quad_state; | 111 *copy_shared_quad_state = *shared_quad_state; |
115 } | 112 } |
116 SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin(); | 113 SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin(); |
117 SharedQuadStateList::Iterator copy_sqs_iter = | 114 SharedQuadStateList::Iterator copy_sqs_iter = |
118 copy_pass->shared_quad_state_list.begin(); | 115 copy_pass->shared_quad_state_list.begin(); |
119 for (auto* quad : quad_list) { | 116 for (auto* quad : quad_list) { |
120 while (quad->shared_quad_state != *sqs_iter) { | 117 while (quad->shared_quad_state != *sqs_iter) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 this->transform_to_root_target = transform_to_root_target; | 157 this->transform_to_root_target = transform_to_root_target; |
161 | 158 |
162 DCHECK(quad_list.empty()); | 159 DCHECK(quad_list.empty()); |
163 DCHECK(shared_quad_state_list.empty()); | 160 DCHECK(shared_quad_state_list.empty()); |
164 } | 161 } |
165 | 162 |
166 void RenderPass::SetAll(RenderPassId id, | 163 void RenderPass::SetAll(RenderPassId id, |
167 const gfx::Rect& output_rect, | 164 const gfx::Rect& output_rect, |
168 const gfx::Rect& damage_rect, | 165 const gfx::Rect& damage_rect, |
169 const gfx::Transform& transform_to_root_target, | 166 const gfx::Transform& transform_to_root_target, |
| 167 const FilterOperations& filters, |
| 168 const FilterOperations& background_filters, |
170 bool has_transparent_background) { | 169 bool has_transparent_background) { |
171 DCHECK(id.IsValid()); | 170 DCHECK(id.IsValid()); |
172 | 171 |
173 this->id = id; | 172 this->id = id; |
174 this->output_rect = output_rect; | 173 this->output_rect = output_rect; |
175 this->damage_rect = damage_rect; | 174 this->damage_rect = damage_rect; |
176 this->transform_to_root_target = transform_to_root_target; | 175 this->transform_to_root_target = transform_to_root_target; |
| 176 this->filters = filters; |
| 177 this->background_filters = background_filters; |
177 this->has_transparent_background = has_transparent_background; | 178 this->has_transparent_background = has_transparent_background; |
178 | 179 |
179 DCHECK(quad_list.empty()); | 180 DCHECK(quad_list.empty()); |
180 DCHECK(shared_quad_state_list.empty()); | 181 DCHECK(shared_quad_state_list.empty()); |
181 } | 182 } |
182 | 183 |
183 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { | 184 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { |
184 MathUtil::AddToTracedValue("output_rect", output_rect, value); | 185 MathUtil::AddToTracedValue("output_rect", output_rect, value); |
185 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); | 186 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); |
186 | 187 |
187 value->SetBoolean("has_transparent_background", has_transparent_background); | 188 value->SetBoolean("has_transparent_background", has_transparent_background); |
188 value->SetInteger("copy_requests", | 189 value->SetInteger("copy_requests", |
189 base::saturated_cast<int>(copy_requests.size())); | 190 base::saturated_cast<int>(copy_requests.size())); |
190 | 191 |
| 192 value->BeginArray("filters"); |
| 193 filters.AsValueInto(value); |
| 194 value->EndArray(); |
| 195 |
| 196 value->BeginArray("background_filters"); |
| 197 background_filters.AsValueInto(value); |
| 198 value->EndArray(); |
| 199 |
191 value->BeginArray("shared_quad_state_list"); | 200 value->BeginArray("shared_quad_state_list"); |
192 for (auto* shared_quad_state : shared_quad_state_list) { | 201 for (auto* shared_quad_state : shared_quad_state_list) { |
193 value->BeginDictionary(); | 202 value->BeginDictionary(); |
194 shared_quad_state->AsValueInto(value); | 203 shared_quad_state->AsValueInto(value); |
195 value->EndDictionary(); | 204 value->EndDictionary(); |
196 } | 205 } |
197 value->EndArray(); | 206 value->EndArray(); |
198 | 207 |
199 value->BeginArray("quad_list"); | 208 value->BeginArray("quad_list"); |
200 for (auto* quad : quad_list) { | 209 for (auto* quad : quad_list) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 case DrawQuad::RENDER_PASS: | 267 case DrawQuad::RENDER_PASS: |
259 case DrawQuad::INVALID: | 268 case DrawQuad::INVALID: |
260 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; | 269 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; |
261 break; | 270 break; |
262 } | 271 } |
263 quad_list.back()->shared_quad_state = shared_quad_state; | 272 quad_list.back()->shared_quad_state = shared_quad_state; |
264 return quad_list.back(); | 273 return quad_list.back(); |
265 } | 274 } |
266 | 275 |
267 } // namespace cc | 276 } // namespace cc |
OLD | NEW |