| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, output_rect, damage_rect, transform_to_root_target, | 92 copy_pass->SetAll(new_id, output_rect, damage_rect, transform_to_root_target, |
| 93 filters, background_filters, has_transparent_background); | 93 filters, background_filters, color_space, |
| 94 has_transparent_background); |
| 94 return copy_pass; | 95 return copy_pass; |
| 95 } | 96 } |
| 96 | 97 |
| 97 std::unique_ptr<RenderPass> RenderPass::DeepCopy() const { | 98 std::unique_ptr<RenderPass> RenderPass::DeepCopy() const { |
| 98 // Since we can't copy these, it's wrong to use DeepCopy in a situation where | 99 // Since we can't copy these, it's wrong to use DeepCopy in a situation where |
| 99 // you may have copy_requests present. | 100 // you may have copy_requests present. |
| 100 DCHECK_EQ(copy_requests.size(), 0u); | 101 DCHECK_EQ(copy_requests.size(), 0u); |
| 101 | 102 |
| 102 std::unique_ptr<RenderPass> copy_pass( | 103 std::unique_ptr<RenderPass> copy_pass( |
| 103 Create(shared_quad_state_list.size(), quad_list.size())); | 104 Create(shared_quad_state_list.size(), quad_list.size())); |
| 104 copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target, | 105 copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target, |
| 105 filters, background_filters, has_transparent_background); | 106 filters, background_filters, color_space, |
| 107 has_transparent_background); |
| 106 for (auto* shared_quad_state : shared_quad_state_list) { | 108 for (auto* shared_quad_state : shared_quad_state_list) { |
| 107 SharedQuadState* copy_shared_quad_state = | 109 SharedQuadState* copy_shared_quad_state = |
| 108 copy_pass->CreateAndAppendSharedQuadState(); | 110 copy_pass->CreateAndAppendSharedQuadState(); |
| 109 *copy_shared_quad_state = *shared_quad_state; | 111 *copy_shared_quad_state = *shared_quad_state; |
| 110 } | 112 } |
| 111 SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin(); | 113 SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin(); |
| 112 SharedQuadStateList::Iterator copy_sqs_iter = | 114 SharedQuadStateList::Iterator copy_sqs_iter = |
| 113 copy_pass->shared_quad_state_list.begin(); | 115 copy_pass->shared_quad_state_list.begin(); |
| 114 for (auto* quad : quad_list) { | 116 for (auto* quad : quad_list) { |
| 115 while (quad->shared_quad_state != *sqs_iter) { | 117 while (quad->shared_quad_state != *sqs_iter) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 DCHECK(quad_list.empty()); | 159 DCHECK(quad_list.empty()); |
| 158 DCHECK(shared_quad_state_list.empty()); | 160 DCHECK(shared_quad_state_list.empty()); |
| 159 } | 161 } |
| 160 | 162 |
| 161 void RenderPass::SetAll(int id, | 163 void RenderPass::SetAll(int id, |
| 162 const gfx::Rect& output_rect, | 164 const gfx::Rect& output_rect, |
| 163 const gfx::Rect& damage_rect, | 165 const gfx::Rect& damage_rect, |
| 164 const gfx::Transform& transform_to_root_target, | 166 const gfx::Transform& transform_to_root_target, |
| 165 const FilterOperations& filters, | 167 const FilterOperations& filters, |
| 166 const FilterOperations& background_filters, | 168 const FilterOperations& background_filters, |
| 169 const gfx::ColorSpace& color_space, |
| 167 bool has_transparent_background) { | 170 bool has_transparent_background) { |
| 168 DCHECK(id); | 171 DCHECK(id); |
| 169 | 172 |
| 170 this->id = id; | 173 this->id = id; |
| 171 this->output_rect = output_rect; | 174 this->output_rect = output_rect; |
| 172 this->damage_rect = damage_rect; | 175 this->damage_rect = damage_rect; |
| 173 this->transform_to_root_target = transform_to_root_target; | 176 this->transform_to_root_target = transform_to_root_target; |
| 174 this->filters = filters; | 177 this->filters = filters; |
| 175 this->background_filters = background_filters; | 178 this->background_filters = background_filters; |
| 179 this->color_space = color_space; |
| 176 this->has_transparent_background = has_transparent_background; | 180 this->has_transparent_background = has_transparent_background; |
| 177 | 181 |
| 178 DCHECK(quad_list.empty()); | 182 DCHECK(quad_list.empty()); |
| 179 DCHECK(shared_quad_state_list.empty()); | 183 DCHECK(shared_quad_state_list.empty()); |
| 180 } | 184 } |
| 181 | 185 |
| 182 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { | 186 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { |
| 183 MathUtil::AddToTracedValue("output_rect", output_rect, value); | 187 MathUtil::AddToTracedValue("output_rect", output_rect, value); |
| 184 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); | 188 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); |
| 185 | 189 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 case DrawQuad::RENDER_PASS: | 267 case DrawQuad::RENDER_PASS: |
| 264 case DrawQuad::INVALID: | 268 case DrawQuad::INVALID: |
| 265 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; | 269 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; |
| 266 break; | 270 break; |
| 267 } | 271 } |
| 268 quad_list.back()->shared_quad_state = shared_quad_state; | 272 quad_list.back()->shared_quad_state = shared_quad_state; |
| 269 return quad_list.back(); | 273 return quad_list.back(); |
| 270 } | 274 } |
| 271 | 275 |
| 272 } // namespace cc | 276 } // namespace cc |
| OLD | NEW |