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

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

Issue 2493853002: cc/blimp: Proto Cleanup. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "cc/proto/skia_conversions.h" 7 #include "cc/proto/skia_conversions.h"
9 #include "cc/trees/effect_node.h" 8 #include "cc/trees/effect_node.h"
10 9
11 namespace cc { 10 namespace cc {
12 11
13 EffectNode::EffectNode() 12 EffectNode::EffectNode()
14 : id(-1), 13 : id(-1),
15 parent_id(-1), 14 parent_id(-1),
16 owner_id(-1), 15 owner_id(-1),
17 opacity(1.f), 16 opacity(1.f),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 other.has_potential_opacity_animation && 58 other.has_potential_opacity_animation &&
60 is_currently_animating_filter == other.is_currently_animating_filter && 59 is_currently_animating_filter == other.is_currently_animating_filter &&
61 is_currently_animating_opacity == 60 is_currently_animating_opacity ==
62 other.is_currently_animating_opacity && 61 other.is_currently_animating_opacity &&
63 effect_changed == other.effect_changed && 62 effect_changed == other.effect_changed &&
64 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && 63 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree &&
65 transform_id == other.transform_id && clip_id == other.clip_id && 64 transform_id == other.transform_id && clip_id == other.clip_id &&
66 target_id == other.target_id && mask_layer_id == other.mask_layer_id; 65 target_id == other.target_id && mask_layer_id == other.mask_layer_id;
67 } 66 }
68 67
69 void EffectNode::ToProtobuf(proto::TreeNode* proto) const {
70 proto->set_id(id);
71 proto->set_parent_id(parent_id);
72 proto->set_owner_id(owner_id);
73
74 DCHECK(!proto->has_effect_node_data());
75 proto::EffectNodeData* data = proto->mutable_effect_node_data();
76 data->set_opacity(opacity);
77 data->set_screen_space_opacity(screen_space_opacity);
78 data->set_blend_mode(SkXfermodeModeToProto(blend_mode));
79 data->set_has_render_surface(has_render_surface);
80 data->set_has_copy_request(has_copy_request);
81 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility);
82 data->set_double_sided(double_sided);
83 data->set_is_drawn(is_drawn);
84 data->set_subtree_hidden(subtree_hidden);
85 data->set_has_potential_filter_animation(has_potential_filter_animation);
86 data->set_has_potential_opacity_animation(has_potential_opacity_animation);
87 data->set_is_currently_animating_filter(is_currently_animating_filter);
88 data->set_is_currently_animating_opacity(is_currently_animating_opacity);
89 data->set_effect_changed(effect_changed);
90 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree);
91 data->set_transform_id(transform_id);
92 data->set_clip_id(clip_id);
93 data->set_target_id(target_id);
94 data->set_mask_layer_id(mask_layer_id);
95 Vector2dFToProto(surface_contents_scale,
96 data->mutable_surface_contents_scale());
97 SizeToProto(unscaled_mask_target_size,
98 data->mutable_unscaled_mask_target_size());
99 }
100
101 void EffectNode::FromProtobuf(const proto::TreeNode& proto) {
102 id = proto.id();
103 parent_id = proto.parent_id();
104 owner_id = proto.owner_id();
105
106 DCHECK(proto.has_effect_node_data());
107 const proto::EffectNodeData& data = proto.effect_node_data();
108
109 opacity = data.opacity();
110 screen_space_opacity = data.screen_space_opacity();
111 blend_mode = SkXfermodeModeFromProto(data.blend_mode());
112 unscaled_mask_target_size = ProtoToSize(data.unscaled_mask_target_size());
113 has_render_surface = data.has_render_surface();
114 has_copy_request = data.has_copy_request();
115 hidden_by_backface_visibility = data.hidden_by_backface_visibility();
116 double_sided = data.double_sided();
117 is_drawn = data.is_drawn();
118 subtree_hidden = data.subtree_hidden();
119 has_potential_filter_animation = data.has_potential_filter_animation();
120 has_potential_opacity_animation = data.has_potential_opacity_animation();
121 is_currently_animating_filter = data.is_currently_animating_filter();
122 is_currently_animating_opacity = data.is_currently_animating_opacity();
123 effect_changed = data.effect_changed();
124 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree();
125 transform_id = data.transform_id();
126 clip_id = data.clip_id();
127 target_id = data.target_id();
128 mask_layer_id = data.mask_layer_id();
129 surface_contents_scale = ProtoToVector2dF(data.surface_contents_scale());
130 }
131
132 void EffectNode::AsValueInto(base::trace_event::TracedValue* value) const { 68 void EffectNode::AsValueInto(base::trace_event::TracedValue* value) const {
133 value->SetInteger("id", id); 69 value->SetInteger("id", id);
134 value->SetInteger("parent_id", parent_id); 70 value->SetInteger("parent_id", parent_id);
135 value->SetInteger("owner_id", owner_id); 71 value->SetInteger("owner_id", owner_id);
136 value->SetDouble("opacity", opacity); 72 value->SetDouble("opacity", opacity);
137 value->SetBoolean("has_render_surface", has_render_surface); 73 value->SetBoolean("has_render_surface", has_render_surface);
138 value->SetBoolean("has_copy_request", has_copy_request); 74 value->SetBoolean("has_copy_request", has_copy_request);
139 value->SetBoolean("double_sided", double_sided); 75 value->SetBoolean("double_sided", double_sided);
140 value->SetBoolean("is_drawn", is_drawn); 76 value->SetBoolean("is_drawn", is_drawn);
141 value->SetBoolean("has_potential_filter_animation", 77 value->SetBoolean("has_potential_filter_animation",
142 has_potential_filter_animation); 78 has_potential_filter_animation);
143 value->SetBoolean("has_potential_opacity_animation", 79 value->SetBoolean("has_potential_opacity_animation",
144 has_potential_opacity_animation); 80 has_potential_opacity_animation);
145 value->SetBoolean("effect_changed", effect_changed); 81 value->SetBoolean("effect_changed", effect_changed);
146 value->SetInteger("num_copy_requests_in_subtree", 82 value->SetInteger("num_copy_requests_in_subtree",
147 num_copy_requests_in_subtree); 83 num_copy_requests_in_subtree);
148 value->SetInteger("transform_id", transform_id); 84 value->SetInteger("transform_id", transform_id);
149 value->SetInteger("clip_id", clip_id); 85 value->SetInteger("clip_id", clip_id);
150 value->SetInteger("target_id", target_id); 86 value->SetInteger("target_id", target_id);
151 value->SetInteger("mask_layer_id", mask_layer_id); 87 value->SetInteger("mask_layer_id", mask_layer_id);
152 } 88 }
153 89
154 } // namespace cc 90 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/effect_node.h ('k') | cc/trees/layer_tree_host_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698