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