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 "base/debug/trace_event_argument.h" | |
8 #include "base/values.h" | 7 #include "base/values.h" |
9 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
10 #include "cc/debug/traced_value.h" | 9 #include "cc/debug/traced_value.h" |
11 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
12 #include "cc/quads/checkerboard_draw_quad.h" | 11 #include "cc/quads/checkerboard_draw_quad.h" |
13 #include "cc/quads/debug_border_draw_quad.h" | 12 #include "cc/quads/debug_border_draw_quad.h" |
14 #include "cc/quads/draw_quad.h" | 13 #include "cc/quads/draw_quad.h" |
15 #include "cc/quads/io_surface_draw_quad.h" | 14 #include "cc/quads/io_surface_draw_quad.h" |
16 #include "cc/quads/picture_draw_quad.h" | 15 #include "cc/quads/picture_draw_quad.h" |
17 #include "cc/quads/render_pass_draw_quad.h" | 16 #include "cc/quads/render_pass_draw_quad.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 this->id = id; | 150 this->id = id; |
152 this->output_rect = output_rect; | 151 this->output_rect = output_rect; |
153 this->damage_rect = damage_rect; | 152 this->damage_rect = damage_rect; |
154 this->transform_to_root_target = transform_to_root_target; | 153 this->transform_to_root_target = transform_to_root_target; |
155 this->has_transparent_background = has_transparent_background; | 154 this->has_transparent_background = has_transparent_background; |
156 | 155 |
157 DCHECK(quad_list.empty()); | 156 DCHECK(quad_list.empty()); |
158 DCHECK(shared_quad_state_list.empty()); | 157 DCHECK(shared_quad_state_list.empty()); |
159 } | 158 } |
160 | 159 |
161 void RenderPass::AsValueInto(base::debug::TracedValue* value) const { | 160 scoped_ptr<base::Value> RenderPass::AsValue() const { |
162 value->BeginArray("output_rect"); | 161 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
163 MathUtil::AddToTracedValue(output_rect, value); | 162 value->Set("output_rect", MathUtil::AsValue(output_rect).release()); |
164 value->EndArray(); | 163 value->Set("damage_rect", MathUtil::AsValue(damage_rect).release()); |
165 | |
166 value->BeginArray("damage_rect"); | |
167 MathUtil::AddToTracedValue(damage_rect, value); | |
168 value->EndArray(); | |
169 | |
170 value->SetBoolean("has_transparent_background", has_transparent_background); | 164 value->SetBoolean("has_transparent_background", has_transparent_background); |
171 value->SetInteger("copy_requests", copy_requests.size()); | 165 value->SetInteger("copy_requests", copy_requests.size()); |
172 | 166 scoped_ptr<base::ListValue> shared_states_value(new base::ListValue()); |
173 value->BeginArray("shared_quad_state_list"); | |
174 for (size_t i = 0; i < shared_quad_state_list.size(); ++i) { | 167 for (size_t i = 0; i < shared_quad_state_list.size(); ++i) { |
175 value->BeginDictionary(); | 168 shared_states_value->Append(shared_quad_state_list[i]->AsValue().release()); |
176 shared_quad_state_list[i]->AsValueInto(value); | |
177 value->EndDictionary(); | |
178 } | 169 } |
179 value->EndArray(); | 170 value->Set("shared_quad_state_list", shared_states_value.release()); |
180 | 171 scoped_ptr<base::ListValue> quad_list_value(new base::ListValue()); |
181 value->BeginArray("quad_list"); | |
182 for (size_t i = 0; i < quad_list.size(); ++i) { | 172 for (size_t i = 0; i < quad_list.size(); ++i) { |
183 value->BeginDictionary(); | 173 quad_list_value->Append(quad_list[i]->AsValue().release()); |
184 quad_list[i]->AsValueInto(value); | |
185 value->EndDictionary(); | |
186 } | 174 } |
187 value->EndArray(); | 175 value->Set("quad_list", quad_list_value.release()); |
188 | 176 |
189 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 177 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
190 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 178 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
191 value, | 179 value.get(), "cc::RenderPass", id.AsTracingId()); |
192 "cc::RenderPass", | 180 return value.PassAs<base::Value>(); |
193 id.AsTracingId()); | |
194 } | 181 } |
195 | 182 |
196 SharedQuadState* RenderPass::CreateAndAppendSharedQuadState() { | 183 SharedQuadState* RenderPass::CreateAndAppendSharedQuadState() { |
197 shared_quad_state_list.push_back(make_scoped_ptr(new SharedQuadState)); | 184 shared_quad_state_list.push_back(make_scoped_ptr(new SharedQuadState)); |
198 return shared_quad_state_list.back(); | 185 return shared_quad_state_list.back(); |
199 } | 186 } |
200 | 187 |
201 RenderPassDrawQuad* RenderPass::CopyFromAndAppendRenderPassDrawQuad( | 188 RenderPassDrawQuad* RenderPass::CopyFromAndAppendRenderPassDrawQuad( |
202 const RenderPassDrawQuad* quad, | 189 const RenderPassDrawQuad* quad, |
203 const SharedQuadState* shared_quad_state, | 190 const SharedQuadState* shared_quad_state, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 case DrawQuad::RENDER_PASS: | 234 case DrawQuad::RENDER_PASS: |
248 case DrawQuad::INVALID: | 235 case DrawQuad::INVALID: |
249 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; | 236 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; |
250 break; | 237 break; |
251 } | 238 } |
252 quad_list.back()->shared_quad_state = shared_quad_state; | 239 quad_list.back()->shared_quad_state = shared_quad_state; |
253 return quad_list.back(); | 240 return quad_list.back(); |
254 } | 241 } |
255 | 242 |
256 } // namespace cc | 243 } // namespace cc |
OLD | NEW |