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

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

Issue 2468113004: Revert of cc: Make visible rect computation aware of pixel-moving filters (Closed)
Patch Set: 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/clip_node.h ('k') | cc/trees/draw_property_utils.cc » ('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/memory/ptr_util.h"
6 #include "base/trace_event/trace_event_argument.h" 5 #include "base/trace_event/trace_event_argument.h"
7 #include "cc/base/math_util.h" 6 #include "cc/base/math_util.h"
8 #include "cc/proto/cc_conversions.h" 7 #include "cc/proto/cc_conversions.h"
9 #include "cc/proto/gfx_conversions.h" 8 #include "cc/proto/gfx_conversions.h"
10 #include "cc/proto/property_tree.pb.h" 9 #include "cc/proto/property_tree.pb.h"
11 #include "cc/trees/clip_node.h" 10 #include "cc/trees/clip_node.h"
12 #include "cc/trees/property_tree.h"
13 11
14 namespace cc { 12 namespace cc {
15 13
16 ClipNode::ClipNode() 14 ClipNode::ClipNode()
17 : id(-1), 15 : id(-1),
18 parent_id(-1), 16 parent_id(-1),
19 owner_id(-1), 17 owner_id(-1),
20 clip_type(ClipType::NONE), 18 clip_type(ClipType::NONE),
21 transform_id(-1), 19 transform_id(-1),
22 target_transform_id(-1), 20 target_transform_id(-1),
23 target_effect_id(-1), 21 target_effect_id(-1),
24 layer_clipping_uses_only_local_clip(false), 22 layer_clipping_uses_only_local_clip(false),
25 target_is_clipped(false), 23 target_is_clipped(false),
26 layers_are_clipped(false), 24 layers_are_clipped(false),
27 layers_are_clipped_when_surfaces_disabled(false), 25 layers_are_clipped_when_surfaces_disabled(false),
28 resets_clip(false) {} 26 resets_clip(false) {}
29 27
30 ClipNode::ClipNode(const ClipNode& other) 28 ClipNode::ClipNode(const ClipNode& other) = default;
31 : id(other.id),
32 parent_id(other.parent_id),
33 owner_id(other.owner_id),
34 clip_type(other.clip_type),
35 clip(other.clip),
36 combined_clip_in_target_space(other.combined_clip_in_target_space),
37 clip_in_target_space(other.clip_in_target_space),
38 transform_id(other.transform_id),
39 target_transform_id(other.target_transform_id),
40 target_effect_id(other.target_effect_id),
41 layer_clipping_uses_only_local_clip(
42 other.layer_clipping_uses_only_local_clip),
43 target_is_clipped(other.target_is_clipped),
44 layers_are_clipped(other.layers_are_clipped),
45 layers_are_clipped_when_surfaces_disabled(
46 other.layers_are_clipped_when_surfaces_disabled),
47 resets_clip(other.resets_clip) {
48 if (other.clip_expander) {
49 DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP);
50 clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander);
51 }
52 }
53
54 ClipNode& ClipNode::operator=(const ClipNode& other) {
55 id = other.id;
56 parent_id = other.parent_id;
57 owner_id = other.owner_id;
58 clip_type = other.clip_type;
59 clip = other.clip;
60 combined_clip_in_target_space = other.combined_clip_in_target_space;
61 clip_in_target_space = other.clip_in_target_space;
62 transform_id = other.transform_id;
63 target_transform_id = other.target_transform_id;
64 target_effect_id = other.target_effect_id;
65 layer_clipping_uses_only_local_clip =
66 other.layer_clipping_uses_only_local_clip;
67 target_is_clipped = other.target_is_clipped;
68 layers_are_clipped = other.layers_are_clipped;
69 layers_are_clipped_when_surfaces_disabled =
70 other.layers_are_clipped_when_surfaces_disabled;
71 resets_clip = other.resets_clip;
72
73 if (other.clip_expander) {
74 DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP);
75 clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander);
76 } else {
77 clip_expander.reset();
78 }
79
80 return *this;
81 }
82
83 ClipNode::~ClipNode() {}
84 29
85 bool ClipNode::operator==(const ClipNode& other) const { 30 bool ClipNode::operator==(const ClipNode& other) const {
86 if (clip_expander && other.clip_expander &&
87 *clip_expander != *other.clip_expander)
88 return false;
89 if ((clip_expander && !other.clip_expander) ||
90 (!clip_expander && other.clip_expander))
91 return false;
92 return id == other.id && parent_id == other.parent_id && 31 return id == other.id && parent_id == other.parent_id &&
93 owner_id == other.owner_id && clip_type == other.clip_type && 32 owner_id == other.owner_id && clip_type == other.clip_type &&
94 clip == other.clip && 33 clip == other.clip &&
95 combined_clip_in_target_space == other.combined_clip_in_target_space && 34 combined_clip_in_target_space == other.combined_clip_in_target_space &&
96 clip_in_target_space == other.clip_in_target_space && 35 clip_in_target_space == other.clip_in_target_space &&
97 transform_id == other.transform_id && 36 transform_id == other.transform_id &&
98 target_transform_id == other.target_transform_id && 37 target_transform_id == other.target_transform_id &&
99 target_effect_id == other.target_effect_id && 38 target_effect_id == other.target_effect_id &&
100 layer_clipping_uses_only_local_clip == 39 layer_clipping_uses_only_local_clip ==
101 other.layer_clipping_uses_only_local_clip && 40 other.layer_clipping_uses_only_local_clip &&
102 target_is_clipped == other.target_is_clipped && 41 target_is_clipped == other.target_is_clipped &&
103 layers_are_clipped == other.layers_are_clipped && 42 layers_are_clipped == other.layers_are_clipped &&
104 layers_are_clipped_when_surfaces_disabled == 43 layers_are_clipped_when_surfaces_disabled ==
105 other.layers_are_clipped_when_surfaces_disabled && 44 other.layers_are_clipped_when_surfaces_disabled &&
106 resets_clip == other.resets_clip; 45 resets_clip == other.resets_clip;
107 } 46 }
108 47
109 void ClipNode::ToProtobuf(proto::TreeNode* proto) const { 48 void ClipNode::ToProtobuf(proto::TreeNode* proto) const {
110 proto->set_id(id); 49 proto->set_id(id);
111 proto->set_parent_id(parent_id); 50 proto->set_parent_id(parent_id);
112 proto->set_owner_id(owner_id); 51 proto->set_owner_id(owner_id);
113 52
114 DCHECK(!proto->has_clip_node_data()); 53 DCHECK(!proto->has_clip_node_data());
115 proto::ClipNodeData* data = proto->mutable_clip_node_data(); 54 proto::ClipNodeData* data = proto->mutable_clip_node_data();
116 55
117 data->set_clip_type(ClipNodeTypeToProto(clip_type)); 56 data->set_clip_type(ClipNodeTypeToProto(clip_type));
118 if (clip_type == ClipType::EXPANDS_CLIP)
119 data->set_clip_expander_effect_id(clip_expander->target_effect_id());
120 else
121 data->set_clip_expander_effect_id(EffectTree::kInvalidNodeId);
122 57
123 RectFToProto(clip, data->mutable_clip()); 58 RectFToProto(clip, data->mutable_clip());
124 RectFToProto(combined_clip_in_target_space, 59 RectFToProto(combined_clip_in_target_space,
125 data->mutable_combined_clip_in_target_space()); 60 data->mutable_combined_clip_in_target_space());
126 RectFToProto(clip_in_target_space, data->mutable_clip_in_target_space()); 61 RectFToProto(clip_in_target_space, data->mutable_clip_in_target_space());
127 62
128 data->set_transform_id(transform_id); 63 data->set_transform_id(transform_id);
129 data->set_target_transform_id(target_transform_id); 64 data->set_target_transform_id(target_transform_id);
130 data->set_target_effect_id(target_effect_id); 65 data->set_target_effect_id(target_effect_id);
131 data->set_layer_clipping_uses_only_local_clip( 66 data->set_layer_clipping_uses_only_local_clip(
132 layer_clipping_uses_only_local_clip); 67 layer_clipping_uses_only_local_clip);
133 data->set_target_is_clipped(target_is_clipped); 68 data->set_target_is_clipped(target_is_clipped);
134 data->set_layers_are_clipped(layers_are_clipped); 69 data->set_layers_are_clipped(layers_are_clipped);
135 data->set_layers_are_clipped_when_surfaces_disabled( 70 data->set_layers_are_clipped_when_surfaces_disabled(
136 layers_are_clipped_when_surfaces_disabled); 71 layers_are_clipped_when_surfaces_disabled);
137 data->set_resets_clip(resets_clip); 72 data->set_resets_clip(resets_clip);
138 } 73 }
139 74
140 void ClipNode::FromProtobuf(const proto::TreeNode& proto) { 75 void ClipNode::FromProtobuf(const proto::TreeNode& proto) {
141 id = proto.id(); 76 id = proto.id();
142 parent_id = proto.parent_id(); 77 parent_id = proto.parent_id();
143 owner_id = proto.owner_id(); 78 owner_id = proto.owner_id();
144 79
145 DCHECK(proto.has_clip_node_data()); 80 DCHECK(proto.has_clip_node_data());
146 const proto::ClipNodeData& data = proto.clip_node_data(); 81 const proto::ClipNodeData& data = proto.clip_node_data();
147 82
148 clip_type = ClipNodeTypeFromProto(data.clip_type()); 83 clip_type = ClipNodeTypeFromProto(data.clip_type());
149 if (clip_type == ClipNode::ClipType::EXPANDS_CLIP) {
150 clip_expander =
151 base::MakeUnique<ClipExpander>(data.clip_expander_effect_id());
152 } else {
153 clip_expander.reset();
154 }
155 clip = ProtoToRectF(data.clip()); 84 clip = ProtoToRectF(data.clip());
156 combined_clip_in_target_space = 85 combined_clip_in_target_space =
157 ProtoToRectF(data.combined_clip_in_target_space()); 86 ProtoToRectF(data.combined_clip_in_target_space());
158 clip_in_target_space = ProtoToRectF(data.clip_in_target_space()); 87 clip_in_target_space = ProtoToRectF(data.clip_in_target_space());
159 88
160 transform_id = data.transform_id(); 89 transform_id = data.transform_id();
161 target_transform_id = data.target_transform_id(); 90 target_transform_id = data.target_transform_id();
162 target_effect_id = data.target_effect_id(); 91 target_effect_id = data.target_effect_id();
163 layer_clipping_uses_only_local_clip = 92 layer_clipping_uses_only_local_clip =
164 data.layer_clipping_uses_only_local_clip(); 93 data.layer_clipping_uses_only_local_clip();
(...skipping 16 matching lines...) Expand all
181 value->SetBoolean("layer_clipping_uses_only_local_clip", 110 value->SetBoolean("layer_clipping_uses_only_local_clip",
182 layer_clipping_uses_only_local_clip); 111 layer_clipping_uses_only_local_clip);
183 value->SetBoolean("target_is_clipped", target_is_clipped); 112 value->SetBoolean("target_is_clipped", target_is_clipped);
184 value->SetBoolean("layers_are_clipped", layers_are_clipped); 113 value->SetBoolean("layers_are_clipped", layers_are_clipped);
185 value->SetBoolean("layers_are_clipped_when_surfaces_disabled", 114 value->SetBoolean("layers_are_clipped_when_surfaces_disabled",
186 layers_are_clipped_when_surfaces_disabled); 115 layers_are_clipped_when_surfaces_disabled);
187 value->SetBoolean("resets_clip", resets_clip); 116 value->SetBoolean("resets_clip", resets_clip);
188 } 117 }
189 118
190 } // namespace cc 119 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/clip_node.h ('k') | cc/trees/draw_property_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698