| 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/proto/skia_conversions.h" |
| 8 #include "cc/trees/effect_node.h" | 9 #include "cc/trees/effect_node.h" |
| 9 | 10 |
| 10 namespace cc { | 11 namespace cc { |
| 11 | 12 |
| 12 EffectNode::EffectNode() | 13 EffectNode::EffectNode() |
| 13 : id(-1), | 14 : id(-1), |
| 14 parent_id(-1), | 15 parent_id(-1), |
| 15 owner_id(-1), | 16 owner_id(-1), |
| 16 opacity(1.f), | 17 opacity(1.f), |
| 17 screen_space_opacity(1.f), | 18 screen_space_opacity(1.f), |
| 19 blend_mode(SkXfermode::kSrcOver_Mode), |
| 18 has_render_surface(false), | 20 has_render_surface(false), |
| 19 render_surface(nullptr), | 21 render_surface(nullptr), |
| 20 has_copy_request(false), | 22 has_copy_request(false), |
| 21 hidden_by_backface_visibility(false), | 23 hidden_by_backface_visibility(false), |
| 22 double_sided(false), | 24 double_sided(false), |
| 23 is_drawn(true), | 25 is_drawn(true), |
| 24 subtree_hidden(false), | 26 subtree_hidden(false), |
| 25 has_potential_filter_animation(false), | 27 has_potential_filter_animation(false), |
| 26 has_potential_opacity_animation(false), | 28 has_potential_opacity_animation(false), |
| 27 is_currently_animating_filter(false), | 29 is_currently_animating_filter(false), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 EffectNode::EffectNode(const EffectNode& other) = default; | 41 EffectNode::EffectNode(const EffectNode& other) = default; |
| 40 | 42 |
| 41 bool EffectNode::operator==(const EffectNode& other) const { | 43 bool EffectNode::operator==(const EffectNode& other) const { |
| 42 return id == other.id && parent_id == other.parent_id && | 44 return id == other.id && parent_id == other.parent_id && |
| 43 owner_id == other.owner_id && opacity == other.opacity && | 45 owner_id == other.owner_id && opacity == other.opacity && |
| 44 screen_space_opacity == other.screen_space_opacity && | 46 screen_space_opacity == other.screen_space_opacity && |
| 45 has_render_surface == other.has_render_surface && | 47 has_render_surface == other.has_render_surface && |
| 46 has_copy_request == other.has_copy_request && | 48 has_copy_request == other.has_copy_request && |
| 47 filters == other.filters && | 49 filters == other.filters && |
| 48 background_filters == other.background_filters && | 50 background_filters == other.background_filters && |
| 51 blend_mode == other.blend_mode && |
| 49 surface_contents_scale == other.surface_contents_scale && | 52 surface_contents_scale == other.surface_contents_scale && |
| 50 hidden_by_backface_visibility == other.hidden_by_backface_visibility && | 53 hidden_by_backface_visibility == other.hidden_by_backface_visibility && |
| 51 double_sided == other.double_sided && is_drawn == other.is_drawn && | 54 double_sided == other.double_sided && is_drawn == other.is_drawn && |
| 52 subtree_hidden == other.subtree_hidden && | 55 subtree_hidden == other.subtree_hidden && |
| 53 has_potential_filter_animation == | 56 has_potential_filter_animation == |
| 54 other.has_potential_filter_animation && | 57 other.has_potential_filter_animation && |
| 55 has_potential_opacity_animation == | 58 has_potential_opacity_animation == |
| 56 other.has_potential_opacity_animation && | 59 other.has_potential_opacity_animation && |
| 57 is_currently_animating_filter == other.is_currently_animating_filter && | 60 is_currently_animating_filter == other.is_currently_animating_filter && |
| 58 is_currently_animating_opacity == | 61 is_currently_animating_opacity == |
| 59 other.is_currently_animating_opacity && | 62 other.is_currently_animating_opacity && |
| 60 effect_changed == other.effect_changed && | 63 effect_changed == other.effect_changed && |
| 61 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && | 64 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && |
| 62 transform_id == other.transform_id && clip_id == other.clip_id && | 65 transform_id == other.transform_id && clip_id == other.clip_id && |
| 63 target_id == other.target_id && mask_layer_id == other.mask_layer_id && | 66 target_id == other.target_id && mask_layer_id == other.mask_layer_id && |
| 64 replica_layer_id == other.replica_layer_id && | 67 replica_layer_id == other.replica_layer_id && |
| 65 replica_mask_layer_id == other.replica_mask_layer_id; | 68 replica_mask_layer_id == other.replica_mask_layer_id; |
| 66 } | 69 } |
| 67 | 70 |
| 68 void EffectNode::ToProtobuf(proto::TreeNode* proto) const { | 71 void EffectNode::ToProtobuf(proto::TreeNode* proto) const { |
| 69 proto->set_id(id); | 72 proto->set_id(id); |
| 70 proto->set_parent_id(parent_id); | 73 proto->set_parent_id(parent_id); |
| 71 proto->set_owner_id(owner_id); | 74 proto->set_owner_id(owner_id); |
| 72 | 75 |
| 73 DCHECK(!proto->has_effect_node_data()); | 76 DCHECK(!proto->has_effect_node_data()); |
| 74 proto::EffectNodeData* data = proto->mutable_effect_node_data(); | 77 proto::EffectNodeData* data = proto->mutable_effect_node_data(); |
| 75 data->set_opacity(opacity); | 78 data->set_opacity(opacity); |
| 76 data->set_screen_space_opacity(screen_space_opacity); | 79 data->set_screen_space_opacity(screen_space_opacity); |
| 80 data->set_blend_mode(SkXfermodeModeToProto(blend_mode)); |
| 77 data->set_has_render_surface(has_render_surface); | 81 data->set_has_render_surface(has_render_surface); |
| 78 data->set_has_copy_request(has_copy_request); | 82 data->set_has_copy_request(has_copy_request); |
| 79 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility); | 83 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility); |
| 80 data->set_double_sided(double_sided); | 84 data->set_double_sided(double_sided); |
| 81 data->set_is_drawn(is_drawn); | 85 data->set_is_drawn(is_drawn); |
| 82 data->set_subtree_hidden(subtree_hidden); | 86 data->set_subtree_hidden(subtree_hidden); |
| 83 data->set_has_potential_filter_animation(has_potential_filter_animation); | 87 data->set_has_potential_filter_animation(has_potential_filter_animation); |
| 84 data->set_has_potential_opacity_animation(has_potential_opacity_animation); | 88 data->set_has_potential_opacity_animation(has_potential_opacity_animation); |
| 85 data->set_is_currently_animating_filter(is_currently_animating_filter); | 89 data->set_is_currently_animating_filter(is_currently_animating_filter); |
| 86 data->set_is_currently_animating_opacity(is_currently_animating_opacity); | 90 data->set_is_currently_animating_opacity(is_currently_animating_opacity); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 99 void EffectNode::FromProtobuf(const proto::TreeNode& proto) { | 103 void EffectNode::FromProtobuf(const proto::TreeNode& proto) { |
| 100 id = proto.id(); | 104 id = proto.id(); |
| 101 parent_id = proto.parent_id(); | 105 parent_id = proto.parent_id(); |
| 102 owner_id = proto.owner_id(); | 106 owner_id = proto.owner_id(); |
| 103 | 107 |
| 104 DCHECK(proto.has_effect_node_data()); | 108 DCHECK(proto.has_effect_node_data()); |
| 105 const proto::EffectNodeData& data = proto.effect_node_data(); | 109 const proto::EffectNodeData& data = proto.effect_node_data(); |
| 106 | 110 |
| 107 opacity = data.opacity(); | 111 opacity = data.opacity(); |
| 108 screen_space_opacity = data.screen_space_opacity(); | 112 screen_space_opacity = data.screen_space_opacity(); |
| 113 blend_mode = SkXfermodeModeFromProto(data.blend_mode()); |
| 109 has_render_surface = data.has_render_surface(); | 114 has_render_surface = data.has_render_surface(); |
| 110 has_copy_request = data.has_copy_request(); | 115 has_copy_request = data.has_copy_request(); |
| 111 hidden_by_backface_visibility = data.hidden_by_backface_visibility(); | 116 hidden_by_backface_visibility = data.hidden_by_backface_visibility(); |
| 112 double_sided = data.double_sided(); | 117 double_sided = data.double_sided(); |
| 113 is_drawn = data.is_drawn(); | 118 is_drawn = data.is_drawn(); |
| 114 subtree_hidden = data.subtree_hidden(); | 119 subtree_hidden = data.subtree_hidden(); |
| 115 has_potential_filter_animation = data.has_potential_filter_animation(); | 120 has_potential_filter_animation = data.has_potential_filter_animation(); |
| 116 has_potential_opacity_animation = data.has_potential_opacity_animation(); | 121 has_potential_opacity_animation = data.has_potential_opacity_animation(); |
| 117 is_currently_animating_filter = data.is_currently_animating_filter(); | 122 is_currently_animating_filter = data.is_currently_animating_filter(); |
| 118 is_currently_animating_opacity = data.is_currently_animating_opacity(); | 123 is_currently_animating_opacity = data.is_currently_animating_opacity(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 145 num_copy_requests_in_subtree); | 150 num_copy_requests_in_subtree); |
| 146 value->SetInteger("transform_id", transform_id); | 151 value->SetInteger("transform_id", transform_id); |
| 147 value->SetInteger("clip_id", clip_id); | 152 value->SetInteger("clip_id", clip_id); |
| 148 value->SetInteger("target_id", target_id); | 153 value->SetInteger("target_id", target_id); |
| 149 value->SetInteger("mask_layer_id", mask_layer_id); | 154 value->SetInteger("mask_layer_id", mask_layer_id); |
| 150 value->SetInteger("replica_layer_id", replica_layer_id); | 155 value->SetInteger("replica_layer_id", replica_layer_id); |
| 151 value->SetInteger("replica_mask_layer_id", replica_mask_layer_id); | 156 value->SetInteger("replica_mask_layer_id", replica_mask_layer_id); |
| 152 } | 157 } |
| 153 | 158 |
| 154 } // namespace cc | 159 } // namespace cc |
| OLD | NEW |