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" | 7 #include "base/values.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/debug/traced_value.h" | 9 #include "cc/debug/traced_value.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 SharedQuadState::SharedQuadState() | 13 SharedQuadState::SharedQuadState() |
14 : is_clipped(false), opacity(0.f), blend_mode(SkXfermode::kSrcOver_Mode) {} | 14 : is_clipped(false), |
| 15 opacity(0.f), |
| 16 blend_mode(SkXfermode::kSrcOver_Mode), |
| 17 context_id(0) { |
| 18 } |
15 | 19 |
16 SharedQuadState::~SharedQuadState() { | 20 SharedQuadState::~SharedQuadState() { |
17 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 21 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
18 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 22 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
19 "cc::SharedQuadState", this); | 23 "cc::SharedQuadState", this); |
20 } | 24 } |
21 | 25 |
22 void SharedQuadState::CopyFrom(const SharedQuadState* other) { | 26 void SharedQuadState::CopyFrom(const SharedQuadState* other) { |
23 *this = *other; | 27 *this = *other; |
24 } | 28 } |
25 | 29 |
26 void SharedQuadState::SetAll(const gfx::Transform& content_to_target_transform, | 30 void SharedQuadState::SetAll(const gfx::Transform& content_to_target_transform, |
27 const gfx::Size& content_bounds, | 31 const gfx::Size& content_bounds, |
28 const gfx::Rect& visible_content_rect, | 32 const gfx::Rect& visible_content_rect, |
29 const gfx::Rect& clip_rect, | 33 const gfx::Rect& clip_rect, |
30 bool is_clipped, | 34 bool is_clipped, |
31 float opacity, | 35 float opacity, |
32 SkXfermode::Mode blend_mode) { | 36 SkXfermode::Mode blend_mode, |
| 37 int context_id) { |
33 this->content_to_target_transform = content_to_target_transform; | 38 this->content_to_target_transform = content_to_target_transform; |
34 this->content_bounds = content_bounds; | 39 this->content_bounds = content_bounds; |
35 this->visible_content_rect = visible_content_rect; | 40 this->visible_content_rect = visible_content_rect; |
36 this->clip_rect = clip_rect; | 41 this->clip_rect = clip_rect; |
37 this->is_clipped = is_clipped; | 42 this->is_clipped = is_clipped; |
38 this->opacity = opacity; | 43 this->opacity = opacity; |
39 this->blend_mode = blend_mode; | 44 this->blend_mode = blend_mode; |
| 45 this->context_id = context_id; |
40 } | 46 } |
41 | 47 |
42 scoped_ptr<base::Value> SharedQuadState::AsValue() const { | 48 scoped_ptr<base::Value> SharedQuadState::AsValue() const { |
43 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 49 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
44 value->Set("transform", | 50 value->Set("transform", |
45 MathUtil::AsValue(content_to_target_transform).release()); | 51 MathUtil::AsValue(content_to_target_transform).release()); |
46 value->Set("layer_content_bounds", | 52 value->Set("layer_content_bounds", |
47 MathUtil::AsValue(content_bounds).release()); | 53 MathUtil::AsValue(content_bounds).release()); |
48 value->Set("layer_visible_content_rect", | 54 value->Set("layer_visible_content_rect", |
49 MathUtil::AsValue(visible_content_rect).release()); | 55 MathUtil::AsValue(visible_content_rect).release()); |
50 value->SetBoolean("is_clipped", is_clipped); | 56 value->SetBoolean("is_clipped", is_clipped); |
51 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release()); | 57 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release()); |
52 value->SetDouble("opacity", opacity); | 58 value->SetDouble("opacity", opacity); |
53 value->SetString("blend_mode", SkXfermode::ModeName(blend_mode)); | 59 value->SetString("blend_mode", SkXfermode::ModeName(blend_mode)); |
54 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 60 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
55 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 61 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
56 value.get(), "cc::SharedQuadState", this); | 62 value.get(), "cc::SharedQuadState", this); |
57 return value.PassAs<base::Value>(); | 63 return value.PassAs<base::Value>(); |
58 } | 64 } |
59 | 65 |
60 } // namespace cc | 66 } // namespace cc |
OLD | NEW |