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/trace_event/trace_event_argument.h" | 9 #include "base/trace_event/trace_event_argument.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 out->push_back(copy_pass.Pass()); | 142 out->push_back(copy_pass.Pass()); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 void RenderPass::SetNew(RenderPassId id, | 146 void RenderPass::SetNew(RenderPassId id, |
147 const gfx::Rect& output_rect, | 147 const gfx::Rect& output_rect, |
148 const gfx::Rect& damage_rect, | 148 const gfx::Rect& damage_rect, |
149 const gfx::Transform& transform_to_root_target) { | 149 const gfx::Transform& transform_to_root_target) { |
150 DCHECK_GT(id.layer_id, 0); | 150 DCHECK_GT(id.layer_id, 0); |
151 DCHECK_GE(id.index, 0); | |
152 DCHECK(damage_rect.IsEmpty() || output_rect.Contains(damage_rect)) | 151 DCHECK(damage_rect.IsEmpty() || output_rect.Contains(damage_rect)) |
153 << "damage_rect: " << damage_rect.ToString() | 152 << "damage_rect: " << damage_rect.ToString() |
154 << " output_rect: " << output_rect.ToString(); | 153 << " output_rect: " << output_rect.ToString(); |
155 | 154 |
156 this->id = id; | 155 this->id = id; |
157 this->output_rect = output_rect; | 156 this->output_rect = output_rect; |
158 this->damage_rect = damage_rect; | 157 this->damage_rect = damage_rect; |
159 this->transform_to_root_target = transform_to_root_target; | 158 this->transform_to_root_target = transform_to_root_target; |
160 | 159 |
161 DCHECK(quad_list.empty()); | 160 DCHECK(quad_list.empty()); |
162 DCHECK(shared_quad_state_list.empty()); | 161 DCHECK(shared_quad_state_list.empty()); |
163 } | 162 } |
164 | 163 |
165 void RenderPass::SetAll(RenderPassId id, | 164 void RenderPass::SetAll(RenderPassId id, |
166 const gfx::Rect& output_rect, | 165 const gfx::Rect& output_rect, |
167 const gfx::Rect& damage_rect, | 166 const gfx::Rect& damage_rect, |
168 const gfx::Transform& transform_to_root_target, | 167 const gfx::Transform& transform_to_root_target, |
169 bool has_transparent_background) { | 168 bool has_transparent_background) { |
170 DCHECK_GT(id.layer_id, 0); | 169 DCHECK_GT(id.layer_id, 0); |
171 DCHECK_GE(id.index, 0); | |
172 | 170 |
173 this->id = id; | 171 this->id = id; |
174 this->output_rect = output_rect; | 172 this->output_rect = output_rect; |
175 this->damage_rect = damage_rect; | 173 this->damage_rect = damage_rect; |
176 this->transform_to_root_target = transform_to_root_target; | 174 this->transform_to_root_target = transform_to_root_target; |
177 this->has_transparent_background = has_transparent_background; | 175 this->has_transparent_background = has_transparent_background; |
178 | 176 |
179 DCHECK(quad_list.empty()); | 177 DCHECK(quad_list.empty()); |
180 DCHECK(shared_quad_state_list.empty()); | 178 DCHECK(shared_quad_state_list.empty()); |
181 } | 179 } |
182 | 180 |
183 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { | 181 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { |
184 MathUtil::AddToTracedValue("output_rect", output_rect, value); | 182 MathUtil::AddToTracedValue("output_rect", output_rect, value); |
185 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); | 183 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); |
186 | 184 |
187 value->SetBoolean("has_transparent_background", has_transparent_background); | 185 value->SetBoolean("has_transparent_background", has_transparent_background); |
188 value->SetInteger("copy_requests", copy_requests.size()); | 186 value->SetInteger("copy_requests", static_cast<int>(copy_requests.size())); |
189 | 187 |
190 value->BeginArray("shared_quad_state_list"); | 188 value->BeginArray("shared_quad_state_list"); |
191 for (const auto& shared_quad_state : shared_quad_state_list) { | 189 for (const auto& shared_quad_state : shared_quad_state_list) { |
192 value->BeginDictionary(); | 190 value->BeginDictionary(); |
193 shared_quad_state->AsValueInto(value); | 191 shared_quad_state->AsValueInto(value); |
194 value->EndDictionary(); | 192 value->EndDictionary(); |
195 } | 193 } |
196 value->EndArray(); | 194 value->EndArray(); |
197 | 195 |
198 value->BeginArray("quad_list"); | 196 value->BeginArray("quad_list"); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 case DrawQuad::RENDER_PASS: | 261 case DrawQuad::RENDER_PASS: |
264 case DrawQuad::INVALID: | 262 case DrawQuad::INVALID: |
265 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; | 263 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; |
266 break; | 264 break; |
267 } | 265 } |
268 quad_list.back()->shared_quad_state = shared_quad_state; | 266 quad_list.back()->shared_quad_state = shared_quad_state; |
269 return quad_list.back(); | 267 return quad_list.back(); |
270 } | 268 } |
271 | 269 |
272 } // namespace cc | 270 } // namespace cc |
OLD | NEW |