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/trace_event/trace_event_argument.h" | 6 #include "base/trace_event/trace_event_argument.h" |
6 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
7 #include "cc/proto/cc_conversions.h" | 8 #include "cc/proto/cc_conversions.h" |
8 #include "cc/proto/gfx_conversions.h" | 9 #include "cc/proto/gfx_conversions.h" |
9 #include "cc/trees/clip_node.h" | 10 #include "cc/trees/clip_node.h" |
| 11 #include "cc/trees/property_tree.h" |
10 | 12 |
11 namespace cc { | 13 namespace cc { |
12 | 14 |
13 ClipNode::ClipNode() | 15 ClipNode::ClipNode() |
14 : id(-1), | 16 : id(-1), |
15 parent_id(-1), | 17 parent_id(-1), |
16 owning_layer_id(-1), | 18 owning_layer_id(-1), |
17 clip_type(ClipType::NONE), | 19 clip_type(ClipType::NONE), |
18 transform_id(-1), | 20 transform_id(-1), |
19 target_transform_id(-1), | 21 target_transform_id(-1), |
20 target_effect_id(-1), | 22 target_effect_id(-1), |
21 layer_clipping_uses_only_local_clip(false), | 23 layer_clipping_uses_only_local_clip(false), |
22 layers_are_clipped(false), | 24 layers_are_clipped(false), |
23 layers_are_clipped_when_surfaces_disabled(false), | 25 layers_are_clipped_when_surfaces_disabled(false), |
24 resets_clip(false) {} | 26 resets_clip(false) {} |
25 | 27 |
26 ClipNode::ClipNode(const ClipNode& other) = default; | 28 ClipNode::ClipNode(const ClipNode& other) |
| 29 : id(other.id), |
| 30 parent_id(other.parent_id), |
| 31 owning_layer_id(other.owning_layer_id), |
| 32 clip_type(other.clip_type), |
| 33 clip(other.clip), |
| 34 combined_clip_in_target_space(other.combined_clip_in_target_space), |
| 35 clip_in_target_space(other.clip_in_target_space), |
| 36 transform_id(other.transform_id), |
| 37 target_transform_id(other.target_transform_id), |
| 38 target_effect_id(other.target_effect_id), |
| 39 layer_clipping_uses_only_local_clip( |
| 40 other.layer_clipping_uses_only_local_clip), |
| 41 layers_are_clipped(other.layers_are_clipped), |
| 42 layers_are_clipped_when_surfaces_disabled( |
| 43 other.layers_are_clipped_when_surfaces_disabled), |
| 44 resets_clip(other.resets_clip) { |
| 45 if (other.clip_expander) { |
| 46 DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP); |
| 47 clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander); |
| 48 } |
| 49 } |
| 50 |
| 51 ClipNode& ClipNode::operator=(const ClipNode& other) { |
| 52 id = other.id; |
| 53 parent_id = other.parent_id; |
| 54 owning_layer_id = other.owning_layer_id; |
| 55 clip_type = other.clip_type; |
| 56 clip = other.clip; |
| 57 combined_clip_in_target_space = other.combined_clip_in_target_space; |
| 58 clip_in_target_space = other.clip_in_target_space; |
| 59 transform_id = other.transform_id; |
| 60 target_transform_id = other.target_transform_id; |
| 61 target_effect_id = other.target_effect_id; |
| 62 layer_clipping_uses_only_local_clip = |
| 63 other.layer_clipping_uses_only_local_clip; |
| 64 layers_are_clipped = other.layers_are_clipped; |
| 65 layers_are_clipped_when_surfaces_disabled = |
| 66 other.layers_are_clipped_when_surfaces_disabled; |
| 67 resets_clip = other.resets_clip; |
| 68 |
| 69 if (other.clip_expander) { |
| 70 DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP); |
| 71 clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander); |
| 72 } else { |
| 73 clip_expander.reset(); |
| 74 } |
| 75 |
| 76 return *this; |
| 77 } |
| 78 |
| 79 ClipNode::~ClipNode() {} |
27 | 80 |
28 bool ClipNode::operator==(const ClipNode& other) const { | 81 bool ClipNode::operator==(const ClipNode& other) const { |
| 82 if (clip_expander && other.clip_expander && |
| 83 *clip_expander != *other.clip_expander) |
| 84 return false; |
| 85 if ((clip_expander && !other.clip_expander) || |
| 86 (!clip_expander && other.clip_expander)) |
| 87 return false; |
29 return id == other.id && parent_id == other.parent_id && | 88 return id == other.id && parent_id == other.parent_id && |
30 owning_layer_id == other.owning_layer_id && | 89 owning_layer_id == other.owning_layer_id && |
31 clip_type == other.clip_type && clip == other.clip && | 90 clip_type == other.clip_type && clip == other.clip && |
32 combined_clip_in_target_space == other.combined_clip_in_target_space && | 91 combined_clip_in_target_space == other.combined_clip_in_target_space && |
33 clip_in_target_space == other.clip_in_target_space && | 92 clip_in_target_space == other.clip_in_target_space && |
34 transform_id == other.transform_id && | 93 transform_id == other.transform_id && |
35 target_transform_id == other.target_transform_id && | 94 target_transform_id == other.target_transform_id && |
36 target_effect_id == other.target_effect_id && | 95 target_effect_id == other.target_effect_id && |
37 layer_clipping_uses_only_local_clip == | 96 layer_clipping_uses_only_local_clip == |
38 other.layer_clipping_uses_only_local_clip && | 97 other.layer_clipping_uses_only_local_clip && |
(...skipping 14 matching lines...) Expand all Loading... |
53 value->SetInteger("target_effect_id", target_effect_id); | 112 value->SetInteger("target_effect_id", target_effect_id); |
54 value->SetBoolean("layer_clipping_uses_only_local_clip", | 113 value->SetBoolean("layer_clipping_uses_only_local_clip", |
55 layer_clipping_uses_only_local_clip); | 114 layer_clipping_uses_only_local_clip); |
56 value->SetBoolean("layers_are_clipped", layers_are_clipped); | 115 value->SetBoolean("layers_are_clipped", layers_are_clipped); |
57 value->SetBoolean("layers_are_clipped_when_surfaces_disabled", | 116 value->SetBoolean("layers_are_clipped_when_surfaces_disabled", |
58 layers_are_clipped_when_surfaces_disabled); | 117 layers_are_clipped_when_surfaces_disabled); |
59 value->SetBoolean("resets_clip", resets_clip); | 118 value->SetBoolean("resets_clip", resets_clip); |
60 } | 119 } |
61 | 120 |
62 } // namespace cc | 121 } // namespace cc |
OLD | NEW |