OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/trace_event/trace_event_argument.h" | 5 #include "base/trace_event/trace_event_argument.h" |
6 #include "cc/proto/gfx_conversions.h" | 6 #include "cc/proto/gfx_conversions.h" |
7 #include "cc/proto/property_tree.pb.h" | 7 #include "cc/proto/property_tree.pb.h" |
8 #include "cc/trees/effect_node.h" | 8 #include "cc/trees/effect_node.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 EffectNode::EffectNode() | 12 EffectNode::EffectNode() |
13 : id(-1), | 13 : id(-1), |
14 parent_id(-1), | 14 parent_id(-1), |
15 owner_id(-1), | 15 owner_id(-1), |
16 opacity(1.f), | 16 opacity(1.f), |
17 screen_space_opacity(1.f), | 17 screen_space_opacity(1.f), |
18 has_render_surface(false), | 18 has_render_surface(false), |
19 render_surface(nullptr), | 19 render_surface(nullptr), |
20 has_copy_request(false), | 20 has_copy_request(false), |
21 hidden_by_backface_visibility(false), | 21 hidden_by_backface_visibility(false), |
22 double_sided(false), | 22 double_sided(false), |
23 is_drawn(true), | 23 is_drawn(true), |
24 subtree_hidden(false), | 24 subtree_hidden(false), |
| 25 has_potential_filter_animation(false), |
25 has_potential_opacity_animation(false), | 26 has_potential_opacity_animation(false), |
| 27 is_currently_animating_filter(false), |
26 is_currently_animating_opacity(false), | 28 is_currently_animating_opacity(false), |
27 effect_changed(false), | 29 effect_changed(false), |
28 num_copy_requests_in_subtree(0), | 30 num_copy_requests_in_subtree(0), |
29 has_unclipped_descendants(false), | 31 has_unclipped_descendants(false), |
30 transform_id(0), | 32 transform_id(0), |
31 clip_id(0), | 33 clip_id(0), |
32 target_id(0), | 34 target_id(0), |
33 mask_layer_id(-1), | 35 mask_layer_id(-1), |
34 replica_layer_id(-1), | 36 replica_layer_id(-1), |
35 replica_mask_layer_id(-1) {} | 37 replica_mask_layer_id(-1) {} |
36 | 38 |
37 EffectNode::EffectNode(const EffectNode& other) = default; | 39 EffectNode::EffectNode(const EffectNode& other) = default; |
38 | 40 |
39 bool EffectNode::operator==(const EffectNode& other) const { | 41 bool EffectNode::operator==(const EffectNode& other) const { |
40 return id == other.id && parent_id == other.parent_id && | 42 return id == other.id && parent_id == other.parent_id && |
41 owner_id == other.owner_id && opacity == other.opacity && | 43 owner_id == other.owner_id && opacity == other.opacity && |
42 screen_space_opacity == other.screen_space_opacity && | 44 screen_space_opacity == other.screen_space_opacity && |
43 has_render_surface == other.has_render_surface && | 45 has_render_surface == other.has_render_surface && |
44 has_copy_request == other.has_copy_request && | 46 has_copy_request == other.has_copy_request && |
| 47 filters == other.filters && |
45 background_filters == other.background_filters && | 48 background_filters == other.background_filters && |
46 surface_contents_scale == other.surface_contents_scale && | 49 surface_contents_scale == other.surface_contents_scale && |
47 hidden_by_backface_visibility == other.hidden_by_backface_visibility && | 50 hidden_by_backface_visibility == other.hidden_by_backface_visibility && |
48 double_sided == other.double_sided && is_drawn == other.is_drawn && | 51 double_sided == other.double_sided && is_drawn == other.is_drawn && |
49 subtree_hidden == other.subtree_hidden && | 52 subtree_hidden == other.subtree_hidden && |
| 53 has_potential_filter_animation == |
| 54 other.has_potential_filter_animation && |
50 has_potential_opacity_animation == | 55 has_potential_opacity_animation == |
51 other.has_potential_opacity_animation && | 56 other.has_potential_opacity_animation && |
| 57 is_currently_animating_filter == other.is_currently_animating_filter && |
52 is_currently_animating_opacity == | 58 is_currently_animating_opacity == |
53 other.is_currently_animating_opacity && | 59 other.is_currently_animating_opacity && |
54 effect_changed == other.effect_changed && | 60 effect_changed == other.effect_changed && |
55 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && | 61 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && |
56 transform_id == other.transform_id && clip_id == other.clip_id && | 62 transform_id == other.transform_id && clip_id == other.clip_id && |
57 target_id == other.target_id && mask_layer_id == other.mask_layer_id && | 63 target_id == other.target_id && mask_layer_id == other.mask_layer_id && |
58 replica_layer_id == other.replica_layer_id && | 64 replica_layer_id == other.replica_layer_id && |
59 replica_mask_layer_id == other.replica_mask_layer_id; | 65 replica_mask_layer_id == other.replica_mask_layer_id; |
60 } | 66 } |
61 | 67 |
62 void EffectNode::ToProtobuf(proto::TreeNode* proto) const { | 68 void EffectNode::ToProtobuf(proto::TreeNode* proto) const { |
63 proto->set_id(id); | 69 proto->set_id(id); |
64 proto->set_parent_id(parent_id); | 70 proto->set_parent_id(parent_id); |
65 proto->set_owner_id(owner_id); | 71 proto->set_owner_id(owner_id); |
66 | 72 |
67 DCHECK(!proto->has_effect_node_data()); | 73 DCHECK(!proto->has_effect_node_data()); |
68 proto::EffectNodeData* data = proto->mutable_effect_node_data(); | 74 proto::EffectNodeData* data = proto->mutable_effect_node_data(); |
69 data->set_opacity(opacity); | 75 data->set_opacity(opacity); |
70 data->set_screen_space_opacity(screen_space_opacity); | 76 data->set_screen_space_opacity(screen_space_opacity); |
71 data->set_has_render_surface(has_render_surface); | 77 data->set_has_render_surface(has_render_surface); |
72 data->set_has_copy_request(has_copy_request); | 78 data->set_has_copy_request(has_copy_request); |
73 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility); | 79 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility); |
74 data->set_double_sided(double_sided); | 80 data->set_double_sided(double_sided); |
75 data->set_is_drawn(is_drawn); | 81 data->set_is_drawn(is_drawn); |
76 data->set_subtree_hidden(subtree_hidden); | 82 data->set_subtree_hidden(subtree_hidden); |
| 83 data->set_has_potential_filter_animation(has_potential_filter_animation); |
77 data->set_has_potential_opacity_animation(has_potential_opacity_animation); | 84 data->set_has_potential_opacity_animation(has_potential_opacity_animation); |
| 85 data->set_is_currently_animating_filter(is_currently_animating_filter); |
78 data->set_is_currently_animating_opacity(is_currently_animating_opacity); | 86 data->set_is_currently_animating_opacity(is_currently_animating_opacity); |
79 data->set_effect_changed(effect_changed); | 87 data->set_effect_changed(effect_changed); |
80 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree); | 88 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree); |
81 data->set_transform_id(transform_id); | 89 data->set_transform_id(transform_id); |
82 data->set_clip_id(clip_id); | 90 data->set_clip_id(clip_id); |
83 data->set_target_id(target_id); | 91 data->set_target_id(target_id); |
84 data->set_mask_layer_id(mask_layer_id); | 92 data->set_mask_layer_id(mask_layer_id); |
85 data->set_replica_layer_id(replica_layer_id); | 93 data->set_replica_layer_id(replica_layer_id); |
86 data->set_replica_mask_layer_id(replica_mask_layer_id); | 94 data->set_replica_mask_layer_id(replica_mask_layer_id); |
87 Vector2dFToProto(surface_contents_scale, | 95 Vector2dFToProto(surface_contents_scale, |
88 data->mutable_surface_contents_scale()); | 96 data->mutable_surface_contents_scale()); |
89 } | 97 } |
90 | 98 |
91 void EffectNode::FromProtobuf(const proto::TreeNode& proto) { | 99 void EffectNode::FromProtobuf(const proto::TreeNode& proto) { |
92 id = proto.id(); | 100 id = proto.id(); |
93 parent_id = proto.parent_id(); | 101 parent_id = proto.parent_id(); |
94 owner_id = proto.owner_id(); | 102 owner_id = proto.owner_id(); |
95 | 103 |
96 DCHECK(proto.has_effect_node_data()); | 104 DCHECK(proto.has_effect_node_data()); |
97 const proto::EffectNodeData& data = proto.effect_node_data(); | 105 const proto::EffectNodeData& data = proto.effect_node_data(); |
98 | 106 |
99 opacity = data.opacity(); | 107 opacity = data.opacity(); |
100 screen_space_opacity = data.screen_space_opacity(); | 108 screen_space_opacity = data.screen_space_opacity(); |
101 has_render_surface = data.has_render_surface(); | 109 has_render_surface = data.has_render_surface(); |
102 has_copy_request = data.has_copy_request(); | 110 has_copy_request = data.has_copy_request(); |
103 hidden_by_backface_visibility = data.hidden_by_backface_visibility(); | 111 hidden_by_backface_visibility = data.hidden_by_backface_visibility(); |
104 double_sided = data.double_sided(); | 112 double_sided = data.double_sided(); |
105 is_drawn = data.is_drawn(); | 113 is_drawn = data.is_drawn(); |
106 subtree_hidden = data.subtree_hidden(); | 114 subtree_hidden = data.subtree_hidden(); |
| 115 has_potential_filter_animation = data.has_potential_filter_animation(); |
107 has_potential_opacity_animation = data.has_potential_opacity_animation(); | 116 has_potential_opacity_animation = data.has_potential_opacity_animation(); |
| 117 is_currently_animating_filter = data.is_currently_animating_filter(); |
108 is_currently_animating_opacity = data.is_currently_animating_opacity(); | 118 is_currently_animating_opacity = data.is_currently_animating_opacity(); |
109 effect_changed = data.effect_changed(); | 119 effect_changed = data.effect_changed(); |
110 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree(); | 120 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree(); |
111 transform_id = data.transform_id(); | 121 transform_id = data.transform_id(); |
112 clip_id = data.clip_id(); | 122 clip_id = data.clip_id(); |
113 target_id = data.target_id(); | 123 target_id = data.target_id(); |
114 mask_layer_id = data.mask_layer_id(); | 124 mask_layer_id = data.mask_layer_id(); |
115 replica_layer_id = data.replica_layer_id(); | 125 replica_layer_id = data.replica_layer_id(); |
116 replica_mask_layer_id = data.replica_mask_layer_id(); | 126 replica_mask_layer_id = data.replica_mask_layer_id(); |
117 surface_contents_scale = ProtoToVector2dF(data.surface_contents_scale()); | 127 surface_contents_scale = ProtoToVector2dF(data.surface_contents_scale()); |
118 } | 128 } |
119 | 129 |
120 void EffectNode::AsValueInto(base::trace_event::TracedValue* value) const { | 130 void EffectNode::AsValueInto(base::trace_event::TracedValue* value) const { |
121 value->SetInteger("id", id); | 131 value->SetInteger("id", id); |
122 value->SetInteger("parent_id", parent_id); | 132 value->SetInteger("parent_id", parent_id); |
123 value->SetInteger("owner_id", owner_id); | 133 value->SetInteger("owner_id", owner_id); |
124 value->SetDouble("opacity", opacity); | 134 value->SetDouble("opacity", opacity); |
125 value->SetBoolean("has_render_surface", has_render_surface); | 135 value->SetBoolean("has_render_surface", has_render_surface); |
126 value->SetBoolean("has_copy_request", has_copy_request); | 136 value->SetBoolean("has_copy_request", has_copy_request); |
127 value->SetBoolean("double_sided", double_sided); | 137 value->SetBoolean("double_sided", double_sided); |
128 value->SetBoolean("is_drawn", is_drawn); | 138 value->SetBoolean("is_drawn", is_drawn); |
| 139 value->SetBoolean("has_potential_filter_animation", |
| 140 has_potential_filter_animation); |
129 value->SetBoolean("has_potential_opacity_animation", | 141 value->SetBoolean("has_potential_opacity_animation", |
130 has_potential_opacity_animation); | 142 has_potential_opacity_animation); |
131 value->SetBoolean("effect_changed", effect_changed); | 143 value->SetBoolean("effect_changed", effect_changed); |
132 value->SetInteger("num_copy_requests_in_subtree", | 144 value->SetInteger("num_copy_requests_in_subtree", |
133 num_copy_requests_in_subtree); | 145 num_copy_requests_in_subtree); |
134 value->SetInteger("transform_id", transform_id); | 146 value->SetInteger("transform_id", transform_id); |
135 value->SetInteger("clip_id", clip_id); | 147 value->SetInteger("clip_id", clip_id); |
136 value->SetInteger("target_id", target_id); | 148 value->SetInteger("target_id", target_id); |
137 value->SetInteger("mask_layer_id", mask_layer_id); | 149 value->SetInteger("mask_layer_id", mask_layer_id); |
138 value->SetInteger("replica_layer_id", replica_layer_id); | 150 value->SetInteger("replica_layer_id", replica_layer_id); |
139 value->SetInteger("replica_mask_layer_id", replica_mask_layer_id); | 151 value->SetInteger("replica_mask_layer_id", replica_mask_layer_id); |
140 } | 152 } |
141 | 153 |
142 } // namespace cc | 154 } // namespace cc |
OLD | NEW |