| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 scoped_ptr<RenderPass> RenderPass::Copy(RenderPassId new_id) const { | 83 scoped_ptr<RenderPass> RenderPass::Copy(RenderPassId new_id) const { |
| 84 scoped_ptr<RenderPass> copy_pass( | 84 scoped_ptr<RenderPass> copy_pass( |
| 85 Create(shared_quad_state_list.size(), quad_list.size())); | 85 Create(shared_quad_state_list.size(), quad_list.size())); |
| 86 copy_pass->SetAll(new_id, | 86 copy_pass->SetAll(new_id, |
| 87 output_rect, | 87 output_rect, |
| 88 damage_rect, | 88 damage_rect, |
| 89 transform_to_root_target, | 89 transform_to_root_target, |
| 90 has_transparent_background); | 90 has_transparent_background); |
| 91 return copy_pass.Pass(); | 91 return copy_pass; |
| 92 } | 92 } |
| 93 | 93 |
| 94 // static | 94 // static |
| 95 void RenderPass::CopyAll(const std::vector<scoped_ptr<RenderPass>>& in, | 95 void RenderPass::CopyAll(const std::vector<scoped_ptr<RenderPass>>& in, |
| 96 std::vector<scoped_ptr<RenderPass>>* out) { | 96 std::vector<scoped_ptr<RenderPass>>* out) { |
| 97 for (const auto& source : in) { | 97 for (const auto& source : in) { |
| 98 // Since we can't copy these, it's wrong to use CopyAll in a situation where | 98 // Since we can't copy these, it's wrong to use CopyAll in a situation where |
| 99 // you may have copy_requests present. | 99 // you may have copy_requests present. |
| 100 DCHECK_EQ(source->copy_requests.size(), 0u); | 100 DCHECK_EQ(source->copy_requests.size(), 0u); |
| 101 | 101 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 127 | 127 |
| 128 if (quad->material == DrawQuad::RENDER_PASS) { | 128 if (quad->material == DrawQuad::RENDER_PASS) { |
| 129 const RenderPassDrawQuad* pass_quad = | 129 const RenderPassDrawQuad* pass_quad = |
| 130 RenderPassDrawQuad::MaterialCast(quad); | 130 RenderPassDrawQuad::MaterialCast(quad); |
| 131 copy_pass->CopyFromAndAppendRenderPassDrawQuad( | 131 copy_pass->CopyFromAndAppendRenderPassDrawQuad( |
| 132 pass_quad, copy_shared_quad_state, pass_quad->render_pass_id); | 132 pass_quad, copy_shared_quad_state, pass_quad->render_pass_id); |
| 133 } else { | 133 } else { |
| 134 copy_pass->CopyFromAndAppendDrawQuad(quad, copy_shared_quad_state); | 134 copy_pass->CopyFromAndAppendDrawQuad(quad, copy_shared_quad_state); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 out->push_back(copy_pass.Pass()); | 137 out->push_back(std::move(copy_pass)); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 void RenderPass::SetNew(RenderPassId id, | 141 void RenderPass::SetNew(RenderPassId id, |
| 142 const gfx::Rect& output_rect, | 142 const gfx::Rect& output_rect, |
| 143 const gfx::Rect& damage_rect, | 143 const gfx::Rect& damage_rect, |
| 144 const gfx::Transform& transform_to_root_target) { | 144 const gfx::Transform& transform_to_root_target) { |
| 145 DCHECK(id.IsValid()); | 145 DCHECK(id.IsValid()); |
| 146 DCHECK(damage_rect.IsEmpty() || output_rect.Contains(damage_rect)) | 146 DCHECK(damage_rect.IsEmpty() || output_rect.Contains(damage_rect)) |
| 147 << "damage_rect: " << damage_rect.ToString() | 147 << "damage_rect: " << damage_rect.ToString() |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 case DrawQuad::RENDER_PASS: | 254 case DrawQuad::RENDER_PASS: |
| 255 case DrawQuad::INVALID: | 255 case DrawQuad::INVALID: |
| 256 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; | 256 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; |
| 257 break; | 257 break; |
| 258 } | 258 } |
| 259 quad_list.back()->shared_quad_state = shared_quad_state; | 259 quad_list.back()->shared_quad_state = shared_quad_state; |
| 260 return quad_list.back(); | 260 return quad_list.back(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 } // namespace cc | 263 } // namespace cc |
| OLD | NEW |