| 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/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "base/trace_event/trace_event_argument.h" | 6 #include "base/trace_event/trace_event_argument.h" |
| 7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/trees/clip_node.h" | 9 #include "cc/trees/clip_node.h" |
| 10 #include "cc/trees/property_tree.h" | 10 #include "cc/trees/property_tree.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 ClipNode::ClipNode() | 14 ClipNode::ClipNode() |
| 15 : id(ClipTree::kInvalidNodeId), | 15 : id(ClipTree::kInvalidNodeId), |
| 16 parent_id(ClipTree::kInvalidNodeId), | 16 parent_id(ClipTree::kInvalidNodeId), |
| 17 owning_layer_id(Layer::INVALID_ID), | 17 owning_layer_id(Layer::INVALID_ID), |
| 18 clip_type(ClipType::NONE), | 18 clip_type(ClipType::NONE), |
| 19 transform_id(TransformTree::kInvalidNodeId), | 19 transform_id(TransformTree::kInvalidNodeId), |
| 20 target_transform_id(TransformTree::kInvalidNodeId), | 20 target_transform_id(TransformTree::kInvalidNodeId), |
| 21 target_effect_id(EffectTree::kInvalidNodeId), | 21 target_effect_id(EffectTree::kInvalidNodeId), |
| 22 layer_clipping_uses_only_local_clip(false), | 22 layer_clipping_uses_only_local_clip(false), |
| 23 layers_are_clipped(false), | 23 layers_are_clipped(false), |
| 24 layers_are_clipped_when_surfaces_disabled(false), | |
| 25 resets_clip(false) {} | 24 resets_clip(false) {} |
| 26 | 25 |
| 27 ClipNode::ClipNode(const ClipNode& other) | 26 ClipNode::ClipNode(const ClipNode& other) |
| 28 : id(other.id), | 27 : id(other.id), |
| 29 parent_id(other.parent_id), | 28 parent_id(other.parent_id), |
| 30 owning_layer_id(other.owning_layer_id), | 29 owning_layer_id(other.owning_layer_id), |
| 31 clip_type(other.clip_type), | 30 clip_type(other.clip_type), |
| 32 clip(other.clip), | 31 clip(other.clip), |
| 33 combined_clip_in_target_space(other.combined_clip_in_target_space), | 32 combined_clip_in_target_space(other.combined_clip_in_target_space), |
| 34 clip_in_target_space(other.clip_in_target_space), | 33 clip_in_target_space(other.clip_in_target_space), |
| 35 transform_id(other.transform_id), | 34 transform_id(other.transform_id), |
| 36 target_transform_id(other.target_transform_id), | 35 target_transform_id(other.target_transform_id), |
| 37 target_effect_id(other.target_effect_id), | 36 target_effect_id(other.target_effect_id), |
| 38 layer_clipping_uses_only_local_clip( | 37 layer_clipping_uses_only_local_clip( |
| 39 other.layer_clipping_uses_only_local_clip), | 38 other.layer_clipping_uses_only_local_clip), |
| 40 layers_are_clipped(other.layers_are_clipped), | 39 layers_are_clipped(other.layers_are_clipped), |
| 41 layers_are_clipped_when_surfaces_disabled( | |
| 42 other.layers_are_clipped_when_surfaces_disabled), | |
| 43 resets_clip(other.resets_clip) { | 40 resets_clip(other.resets_clip) { |
| 44 if (other.clip_expander) { | 41 if (other.clip_expander) { |
| 45 DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP); | 42 DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP); |
| 46 clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander); | 43 clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander); |
| 47 } | 44 } |
| 48 } | 45 } |
| 49 | 46 |
| 50 ClipNode& ClipNode::operator=(const ClipNode& other) { | 47 ClipNode& ClipNode::operator=(const ClipNode& other) { |
| 51 id = other.id; | 48 id = other.id; |
| 52 parent_id = other.parent_id; | 49 parent_id = other.parent_id; |
| 53 owning_layer_id = other.owning_layer_id; | 50 owning_layer_id = other.owning_layer_id; |
| 54 clip_type = other.clip_type; | 51 clip_type = other.clip_type; |
| 55 clip = other.clip; | 52 clip = other.clip; |
| 56 combined_clip_in_target_space = other.combined_clip_in_target_space; | 53 combined_clip_in_target_space = other.combined_clip_in_target_space; |
| 57 clip_in_target_space = other.clip_in_target_space; | 54 clip_in_target_space = other.clip_in_target_space; |
| 58 transform_id = other.transform_id; | 55 transform_id = other.transform_id; |
| 59 target_transform_id = other.target_transform_id; | 56 target_transform_id = other.target_transform_id; |
| 60 target_effect_id = other.target_effect_id; | 57 target_effect_id = other.target_effect_id; |
| 61 layer_clipping_uses_only_local_clip = | 58 layer_clipping_uses_only_local_clip = |
| 62 other.layer_clipping_uses_only_local_clip; | 59 other.layer_clipping_uses_only_local_clip; |
| 63 layers_are_clipped = other.layers_are_clipped; | 60 layers_are_clipped = other.layers_are_clipped; |
| 64 layers_are_clipped_when_surfaces_disabled = | |
| 65 other.layers_are_clipped_when_surfaces_disabled; | |
| 66 resets_clip = other.resets_clip; | 61 resets_clip = other.resets_clip; |
| 67 | 62 |
| 68 if (other.clip_expander) { | 63 if (other.clip_expander) { |
| 69 DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP); | 64 DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP); |
| 70 clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander); | 65 clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander); |
| 71 } else { | 66 } else { |
| 72 clip_expander.reset(); | 67 clip_expander.reset(); |
| 73 } | 68 } |
| 74 | 69 |
| 75 return *this; | 70 return *this; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 owning_layer_id == other.owning_layer_id && | 83 owning_layer_id == other.owning_layer_id && |
| 89 clip_type == other.clip_type && clip == other.clip && | 84 clip_type == other.clip_type && clip == other.clip && |
| 90 combined_clip_in_target_space == other.combined_clip_in_target_space && | 85 combined_clip_in_target_space == other.combined_clip_in_target_space && |
| 91 clip_in_target_space == other.clip_in_target_space && | 86 clip_in_target_space == other.clip_in_target_space && |
| 92 transform_id == other.transform_id && | 87 transform_id == other.transform_id && |
| 93 target_transform_id == other.target_transform_id && | 88 target_transform_id == other.target_transform_id && |
| 94 target_effect_id == other.target_effect_id && | 89 target_effect_id == other.target_effect_id && |
| 95 layer_clipping_uses_only_local_clip == | 90 layer_clipping_uses_only_local_clip == |
| 96 other.layer_clipping_uses_only_local_clip && | 91 other.layer_clipping_uses_only_local_clip && |
| 97 layers_are_clipped == other.layers_are_clipped && | 92 layers_are_clipped == other.layers_are_clipped && |
| 98 layers_are_clipped_when_surfaces_disabled == | |
| 99 other.layers_are_clipped_when_surfaces_disabled && | |
| 100 resets_clip == other.resets_clip; | 93 resets_clip == other.resets_clip; |
| 101 } | 94 } |
| 102 | 95 |
| 103 void ClipNode::AsValueInto(base::trace_event::TracedValue* value) const { | 96 void ClipNode::AsValueInto(base::trace_event::TracedValue* value) const { |
| 104 value->SetInteger("id", id); | 97 value->SetInteger("id", id); |
| 105 value->SetInteger("parent_id", parent_id); | 98 value->SetInteger("parent_id", parent_id); |
| 106 value->SetInteger("owning_layer_id", owning_layer_id); | 99 value->SetInteger("owning_layer_id", owning_layer_id); |
| 107 value->SetInteger("clip_type", static_cast<int>(clip_type)); | 100 value->SetInteger("clip_type", static_cast<int>(clip_type)); |
| 108 MathUtil::AddToTracedValue("clip", clip, value); | 101 MathUtil::AddToTracedValue("clip", clip, value); |
| 109 value->SetInteger("transform_id", transform_id); | 102 value->SetInteger("transform_id", transform_id); |
| 110 value->SetInteger("target_transform_id", target_transform_id); | 103 value->SetInteger("target_transform_id", target_transform_id); |
| 111 value->SetInteger("target_effect_id", target_effect_id); | 104 value->SetInteger("target_effect_id", target_effect_id); |
| 112 value->SetBoolean("layer_clipping_uses_only_local_clip", | 105 value->SetBoolean("layer_clipping_uses_only_local_clip", |
| 113 layer_clipping_uses_only_local_clip); | 106 layer_clipping_uses_only_local_clip); |
| 114 value->SetBoolean("layers_are_clipped", layers_are_clipped); | 107 value->SetBoolean("layers_are_clipped", layers_are_clipped); |
| 115 value->SetBoolean("layers_are_clipped_when_surfaces_disabled", | |
| 116 layers_are_clipped_when_surfaces_disabled); | |
| 117 value->SetBoolean("resets_clip", resets_clip); | 108 value->SetBoolean("resets_clip", resets_clip); |
| 118 } | 109 } |
| 119 | 110 |
| 120 } // namespace cc | 111 } // namespace cc |
| OLD | NEW |