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 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 17 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
| 18 "cc::SharedQuadState", this); |
| 19 } |
12 | 20 |
13 scoped_ptr<SharedQuadState> SharedQuadState::Create() { | 21 scoped_ptr<SharedQuadState> SharedQuadState::Create() { |
14 return make_scoped_ptr(new SharedQuadState); | 22 return make_scoped_ptr(new SharedQuadState); |
15 } | 23 } |
16 | 24 |
17 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const { | 25 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const { |
18 return make_scoped_ptr(new SharedQuadState(*this)); | 26 return make_scoped_ptr(new SharedQuadState(*this)); |
19 } | 27 } |
20 | 28 |
21 void SharedQuadState::SetAll( | 29 void SharedQuadState::SetAll( |
22 const gfx::Transform& content_to_target_transform, | 30 const gfx::Transform& content_to_target_transform, |
23 gfx::Size content_bounds, | 31 gfx::Size content_bounds, |
24 gfx::Rect visible_content_rect, | 32 gfx::Rect visible_content_rect, |
25 gfx::Rect clip_rect, | 33 gfx::Rect clip_rect, |
26 bool is_clipped, | 34 bool is_clipped, |
27 float opacity) { | 35 float opacity) { |
28 this->content_to_target_transform = content_to_target_transform; | 36 this->content_to_target_transform = content_to_target_transform; |
29 this->content_bounds = content_bounds; | 37 this->content_bounds = content_bounds; |
30 this->visible_content_rect = visible_content_rect; | 38 this->visible_content_rect = visible_content_rect; |
31 this->clip_rect = clip_rect; | 39 this->clip_rect = clip_rect; |
32 this->is_clipped = is_clipped; | 40 this->is_clipped = is_clipped; |
33 this->opacity = opacity; | 41 this->opacity = opacity; |
34 } | 42 } |
35 | 43 |
| 44 scoped_ptr<base::Value> SharedQuadState::AsValue() const { |
| 45 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 46 value->Set("transform", |
| 47 MathUtil::AsValue(content_to_target_transform).release()); |
| 48 value->Set("layer_content_bounds", |
| 49 MathUtil::AsValue(content_bounds).release()); |
| 50 value->Set("layer_visible_content_rect", |
| 51 MathUtil::AsValue(visible_content_rect).release()); |
| 52 value->SetBoolean("is_clipped", is_clipped); |
| 53 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release()); |
| 54 value->SetDouble("opacity", opacity); |
| 55 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
| 56 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
| 57 value.get(), "cc::SharedQuadState", this); |
| 58 return value.PassAs<base::Value>(); |
| 59 } |
| 60 |
36 } // namespace cc | 61 } // namespace cc |
OLD | NEW |