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