Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: cc/trees/effect_node.cc

Issue 2118993002: Detemplatize cc property nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/effect_node.h ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/trace_event/trace_event_argument.h"
6 #include "cc/proto/gfx_conversions.h"
7 #include "cc/proto/property_tree.pb.h"
8 #include "cc/trees/effect_node.h"
9
10 namespace cc {
11
12 EffectNode::EffectNode()
13 : id(-1),
14 parent_id(-1),
15 owner_id(-1),
16 opacity(1.f),
17 screen_space_opacity(1.f),
18 has_render_surface(false),
19 render_surface(nullptr),
20 has_copy_request(false),
21 hidden_by_backface_visibility(false),
22 double_sided(false),
23 is_drawn(true),
24 subtree_hidden(false),
25 has_potential_opacity_animation(false),
26 is_currently_animating_opacity(false),
27 effect_changed(false),
28 num_copy_requests_in_subtree(0),
29 has_unclipped_descendants(false),
30 transform_id(0),
31 clip_id(0),
32 target_id(0),
33 mask_layer_id(-1),
34 replica_layer_id(-1),
35 replica_mask_layer_id(-1) {}
36
37 EffectNode::EffectNode(const EffectNode& other) = default;
38
39 bool EffectNode::operator==(const EffectNode& other) const {
40 return id == other.id && parent_id == other.parent_id &&
41 owner_id == other.owner_id && opacity == other.opacity &&
42 screen_space_opacity == other.screen_space_opacity &&
43 has_render_surface == other.has_render_surface &&
44 has_copy_request == other.has_copy_request &&
45 background_filters == other.background_filters &&
46 sublayer_scale == other.sublayer_scale &&
47 hidden_by_backface_visibility == other.hidden_by_backface_visibility &&
48 double_sided == other.double_sided && is_drawn == other.is_drawn &&
49 subtree_hidden == other.subtree_hidden &&
50 has_potential_opacity_animation ==
51 other.has_potential_opacity_animation &&
52 is_currently_animating_opacity ==
53 other.is_currently_animating_opacity &&
54 effect_changed == other.effect_changed &&
55 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree &&
56 transform_id == other.transform_id && clip_id == other.clip_id &&
57 target_id == other.target_id && mask_layer_id == other.mask_layer_id &&
58 replica_layer_id == other.replica_layer_id &&
59 replica_mask_layer_id == other.replica_mask_layer_id;
60 }
61
62 void EffectNode::ToProtobuf(proto::TreeNode* proto) const {
63 proto->set_id(id);
64 proto->set_parent_id(parent_id);
65 proto->set_owner_id(owner_id);
66
67 DCHECK(!proto->has_effect_node_data());
68 proto::EffectNodeData* data = proto->mutable_effect_node_data();
69 data->set_opacity(opacity);
70 data->set_screen_space_opacity(screen_space_opacity);
71 data->set_has_render_surface(has_render_surface);
72 data->set_has_copy_request(has_copy_request);
73 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility);
74 data->set_double_sided(double_sided);
75 data->set_is_drawn(is_drawn);
76 data->set_subtree_hidden(subtree_hidden);
77 data->set_has_potential_opacity_animation(has_potential_opacity_animation);
78 data->set_is_currently_animating_opacity(is_currently_animating_opacity);
79 data->set_effect_changed(effect_changed);
80 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree);
81 data->set_transform_id(transform_id);
82 data->set_clip_id(clip_id);
83 data->set_target_id(target_id);
84 data->set_mask_layer_id(mask_layer_id);
85 data->set_replica_layer_id(replica_layer_id);
86 data->set_replica_mask_layer_id(replica_mask_layer_id);
87 Vector2dFToProto(sublayer_scale, data->mutable_sublayer_scale());
88 }
89
90 void EffectNode::FromProtobuf(const proto::TreeNode& proto) {
91 id = proto.id();
92 parent_id = proto.parent_id();
93 owner_id = proto.owner_id();
94
95 DCHECK(proto.has_effect_node_data());
96 const proto::EffectNodeData& data = proto.effect_node_data();
97
98 opacity = data.opacity();
99 screen_space_opacity = data.screen_space_opacity();
100 has_render_surface = data.has_render_surface();
101 has_copy_request = data.has_copy_request();
102 hidden_by_backface_visibility = data.hidden_by_backface_visibility();
103 double_sided = data.double_sided();
104 is_drawn = data.is_drawn();
105 subtree_hidden = data.subtree_hidden();
106 has_potential_opacity_animation = data.has_potential_opacity_animation();
107 is_currently_animating_opacity = data.is_currently_animating_opacity();
108 effect_changed = data.effect_changed();
109 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree();
110 transform_id = data.transform_id();
111 clip_id = data.clip_id();
112 target_id = data.target_id();
113 mask_layer_id = data.mask_layer_id();
114 replica_layer_id = data.replica_layer_id();
115 replica_mask_layer_id = data.replica_mask_layer_id();
116 sublayer_scale = ProtoToVector2dF(data.sublayer_scale());
117 }
118
119 void EffectNode::AsValueInto(base::trace_event::TracedValue* value) const {
120 value->SetInteger("id", id);
121 value->SetInteger("parent_id", parent_id);
122 value->SetInteger("owner_id", owner_id);
123 value->SetDouble("opacity", opacity);
124 value->SetBoolean("has_render_surface", has_render_surface);
125 value->SetBoolean("has_copy_request", has_copy_request);
126 value->SetBoolean("double_sided", double_sided);
127 value->SetBoolean("is_drawn", is_drawn);
128 value->SetBoolean("has_potential_opacity_animation",
129 has_potential_opacity_animation);
130 value->SetBoolean("effect_changed", effect_changed);
131 value->SetInteger("num_copy_requests_in_subtree",
132 num_copy_requests_in_subtree);
133 value->SetInteger("transform_id", transform_id);
134 value->SetInteger("clip_id", clip_id);
135 value->SetInteger("target_id", target_id);
136 value->SetInteger("mask_layer_id", mask_layer_id);
137 value->SetInteger("replica_layer_id", replica_layer_id);
138 value->SetInteger("replica_mask_layer_id", replica_mask_layer_id);
139 }
140
141 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/effect_node.h ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698