OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/shared_quad_state.h" | 5 #include "cc/quads/shared_quad_state.h" |
6 | 6 |
| 7 #include "base/debug/trace_event_argument.h" |
7 #include "base/values.h" | 8 #include "base/values.h" |
8 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
9 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
10 | 11 |
11 namespace cc { | 12 namespace cc { |
12 | 13 |
13 SharedQuadState::SharedQuadState() | 14 SharedQuadState::SharedQuadState() |
14 : is_clipped(false), | 15 : is_clipped(false), |
15 opacity(0.f), | 16 opacity(0.f), |
16 blend_mode(SkXfermode::kSrcOver_Mode), | 17 blend_mode(SkXfermode::kSrcOver_Mode), |
(...skipping 21 matching lines...) Expand all Loading... |
38 this->content_to_target_transform = content_to_target_transform; | 39 this->content_to_target_transform = content_to_target_transform; |
39 this->content_bounds = content_bounds; | 40 this->content_bounds = content_bounds; |
40 this->visible_content_rect = visible_content_rect; | 41 this->visible_content_rect = visible_content_rect; |
41 this->clip_rect = clip_rect; | 42 this->clip_rect = clip_rect; |
42 this->is_clipped = is_clipped; | 43 this->is_clipped = is_clipped; |
43 this->opacity = opacity; | 44 this->opacity = opacity; |
44 this->blend_mode = blend_mode; | 45 this->blend_mode = blend_mode; |
45 this->sorting_context_id = sorting_context_id; | 46 this->sorting_context_id = sorting_context_id; |
46 } | 47 } |
47 | 48 |
48 scoped_ptr<base::Value> SharedQuadState::AsValue() const { | 49 void SharedQuadState::AsValueInto(base::debug::TracedValue* value) const { |
49 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 50 value->BeginArray("transform"); |
50 value->Set("transform", | 51 MathUtil::AddToTracedValue(content_to_target_transform, value); |
51 MathUtil::AsValue(content_to_target_transform).release()); | 52 value->EndArray(); |
52 value->Set("layer_content_bounds", | 53 |
53 MathUtil::AsValue(content_bounds).release()); | 54 value->BeginDictionary("layer_content_bounds"); |
54 value->Set("layer_visible_content_rect", | 55 MathUtil::AddToTracedValue(content_bounds, value); |
55 MathUtil::AsValue(visible_content_rect).release()); | 56 value->EndDictionary(); |
| 57 |
| 58 value->BeginArray("layer_visible_content_rect"); |
| 59 MathUtil::AddToTracedValue(visible_content_rect, value); |
| 60 value->EndArray(); |
| 61 |
56 value->SetBoolean("is_clipped", is_clipped); | 62 value->SetBoolean("is_clipped", is_clipped); |
57 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release()); | 63 |
| 64 value->BeginArray("clip_rect"); |
| 65 MathUtil::AddToTracedValue(clip_rect, value); |
| 66 value->EndArray(); |
| 67 |
58 value->SetDouble("opacity", opacity); | 68 value->SetDouble("opacity", opacity); |
59 value->SetString("blend_mode", SkXfermode::ModeName(blend_mode)); | 69 value->SetString("blend_mode", SkXfermode::ModeName(blend_mode)); |
60 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 70 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
61 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 71 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
62 value.get(), "cc::SharedQuadState", this); | 72 value, |
63 return value.PassAs<base::Value>(); | 73 "cc::SharedQuadState", |
| 74 this); |
64 } | 75 } |
65 | 76 |
66 } // namespace cc | 77 } // namespace cc |
OLD | NEW |