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/values.h" | |
8 #include "cc/base/math_util.h" | |
9 #include "cc/debug/traced_value.h" | |
10 | |
7 namespace cc { | 11 namespace cc { |
8 | 12 |
9 SharedQuadState::SharedQuadState() : is_clipped(false), opacity(0.f) {} | 13 SharedQuadState::SharedQuadState() : is_clipped(false), opacity(0.f) {} |
10 | 14 |
11 SharedQuadState::~SharedQuadState() {} | 15 SharedQuadState::~SharedQuadState() { |
16 // Snapshot was created in cc.debug category, but only if cc.debug.quads is on | |
17 // as well. | |
18 bool enabled; | |
19 TRACE_EVENT_CATEGORY_GROUP_ENABLED( | |
20 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), &enabled); | |
21 if (enabled) { | |
22 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | |
23 "cc::SharedQuadState", | |
24 this); | |
25 } | |
26 } | |
12 | 27 |
13 scoped_ptr<SharedQuadState> SharedQuadState::Create() { | 28 scoped_ptr<SharedQuadState> SharedQuadState::Create() { |
14 return make_scoped_ptr(new SharedQuadState); | 29 return make_scoped_ptr(new SharedQuadState); |
15 } | 30 } |
16 | 31 |
17 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const { | 32 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const { |
18 return make_scoped_ptr(new SharedQuadState(*this)); | 33 return make_scoped_ptr(new SharedQuadState(*this)); |
19 } | 34 } |
20 | 35 |
21 void SharedQuadState::SetAll( | 36 void SharedQuadState::SetAll( |
22 const gfx::Transform& content_to_target_transform, | 37 const gfx::Transform& content_to_target_transform, |
23 gfx::Size content_bounds, | 38 gfx::Size content_bounds, |
24 gfx::Rect visible_content_rect, | 39 gfx::Rect visible_content_rect, |
25 gfx::Rect clip_rect, | 40 gfx::Rect clip_rect, |
26 bool is_clipped, | 41 bool is_clipped, |
27 float opacity) { | 42 float opacity) { |
28 this->content_to_target_transform = content_to_target_transform; | 43 this->content_to_target_transform = content_to_target_transform; |
29 this->content_bounds = content_bounds; | 44 this->content_bounds = content_bounds; |
30 this->visible_content_rect = visible_content_rect; | 45 this->visible_content_rect = visible_content_rect; |
31 this->clip_rect = clip_rect; | 46 this->clip_rect = clip_rect; |
32 this->is_clipped = is_clipped; | 47 this->is_clipped = is_clipped; |
33 this->opacity = opacity; | 48 this->opacity = opacity; |
34 } | 49 } |
35 | 50 |
51 scoped_ptr<base::Value> SharedQuadState::AsValue() const { | |
52 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | |
53 value->Set("transform", | |
54 MathUtil::AsValue(content_to_target_transform).release()); | |
55 value->Set("layer_content_bounds", | |
56 MathUtil::AsValue(content_bounds).release()); | |
57 value->Set("layer_visible_content_rect", | |
58 MathUtil::AsValue(visible_content_rect).release()); | |
59 value->SetBoolean("is_clipped", is_clipped); | |
60 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release()); | |
61 value->SetDouble("opacity", opacity); | |
62 TracedValue::MakeDictIntoImplicitSnapshot( | |
danakj
2013/08/06 19:30:34
Why do you do this for RenderPass and SQState, but
piman
2013/08/06 23:31:11
This lets us reference the data by ID.
Because Ren
| |
63 value.get(), "cc::SharedQuadState", this); | |
64 return value.PassAs<base::Value>(); | |
65 } | |
66 | |
36 } // namespace cc | 67 } // namespace cc |
OLD | NEW |