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

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

Powered by Google App Engine
This is Rietveld 408576698