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/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
11 #include "cc/debug/traced_value.h" | 11 #include "cc/debug/traced_value.h" |
12 | 12 |
13 extern const char* SkBlendMode_Name(SkBlendMode); | |
f(malita)
2016/11/16 21:10:58
Is this not declared in a public Skia header?
reed1
2016/11/16 21:31:17
Just a placeholder until skia roll updates. Will b
| |
14 | |
13 namespace cc { | 15 namespace cc { |
14 | 16 |
15 SharedQuadState::SharedQuadState() | 17 SharedQuadState::SharedQuadState() |
16 : is_clipped(false), | 18 : is_clipped(false), |
17 opacity(0.f), | 19 opacity(0.f), |
18 blend_mode(SkXfermode::kSrcOver_Mode), | 20 blend_mode(SkBlendMode::kSrcOver), |
19 sorting_context_id(0) { | 21 sorting_context_id(0) {} |
20 } | |
21 | 22 |
22 SharedQuadState::SharedQuadState(const SharedQuadState& other) = default; | 23 SharedQuadState::SharedQuadState(const SharedQuadState& other) = default; |
23 | 24 |
24 SharedQuadState::~SharedQuadState() { | 25 SharedQuadState::~SharedQuadState() { |
25 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 26 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
26 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 27 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
27 "cc::SharedQuadState", this); | 28 "cc::SharedQuadState", this); |
28 } | 29 } |
29 | 30 |
30 void SharedQuadState::SetAll(const gfx::Transform& quad_to_target_transform, | 31 void SharedQuadState::SetAll(const gfx::Transform& quad_to_target_transform, |
31 const gfx::Size& quad_layer_bounds, | 32 const gfx::Size& quad_layer_bounds, |
32 const gfx::Rect& visible_quad_layer_rect, | 33 const gfx::Rect& visible_quad_layer_rect, |
33 const gfx::Rect& clip_rect, | 34 const gfx::Rect& clip_rect, |
34 bool is_clipped, | 35 bool is_clipped, |
35 float opacity, | 36 float opacity, |
36 SkXfermode::Mode blend_mode, | 37 SkBlendMode blend_mode, |
37 int sorting_context_id) { | 38 int sorting_context_id) { |
38 this->quad_to_target_transform = quad_to_target_transform; | 39 this->quad_to_target_transform = quad_to_target_transform; |
39 this->quad_layer_bounds = quad_layer_bounds; | 40 this->quad_layer_bounds = quad_layer_bounds; |
40 this->visible_quad_layer_rect = visible_quad_layer_rect; | 41 this->visible_quad_layer_rect = visible_quad_layer_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 void SharedQuadState::AsValueInto(base::trace_event::TracedValue* value) const { | 49 void SharedQuadState::AsValueInto(base::trace_event::TracedValue* value) const { |
49 MathUtil::AddToTracedValue("transform", quad_to_target_transform, value); | 50 MathUtil::AddToTracedValue("transform", quad_to_target_transform, value); |
50 MathUtil::AddToTracedValue("layer_content_bounds", quad_layer_bounds, value); | 51 MathUtil::AddToTracedValue("layer_content_bounds", quad_layer_bounds, value); |
51 MathUtil::AddToTracedValue("layer_visible_content_rect", | 52 MathUtil::AddToTracedValue("layer_visible_content_rect", |
52 visible_quad_layer_rect, value); | 53 visible_quad_layer_rect, value); |
53 | 54 |
54 value->SetBoolean("is_clipped", is_clipped); | 55 value->SetBoolean("is_clipped", is_clipped); |
55 | 56 |
56 MathUtil::AddToTracedValue("clip_rect", clip_rect, value); | 57 MathUtil::AddToTracedValue("clip_rect", clip_rect, value); |
57 | 58 |
58 value->SetDouble("opacity", opacity); | 59 value->SetDouble("opacity", opacity); |
59 value->SetString("blend_mode", SkXfermode::ModeName(blend_mode)); | 60 value->SetString("blend_mode", SkBlendMode_Name(blend_mode)); |
60 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 61 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
61 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 62 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
62 value, | 63 value, |
63 "cc::SharedQuadState", | 64 "cc::SharedQuadState", |
64 this); | 65 this); |
65 } | 66 } |
66 | 67 |
67 } // namespace cc | 68 } // namespace cc |
OLD | NEW |