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

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

Issue 2118993002: Detemplatize cc property nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/trace_event/trace_event_argument.h"
6 #include "cc/base/math_util.h"
7 #include "cc/proto/gfx_conversions.h"
8 #include "cc/proto/property_tree.pb.h"
9 #include "cc/trees/clip_node.h"
10
11 namespace cc {
12
13 ClipNode::ClipNode()
14 : id(-1),
15 parent_id(-1),
16 owner_id(-1),
17 transform_id(-1),
18 target_id(-1),
19 applies_local_clip(true),
20 layer_clipping_uses_only_local_clip(false),
21 target_is_clipped(false),
22 layers_are_clipped(false),
23 layers_are_clipped_when_surfaces_disabled(false),
24 resets_clip(false) {}
25
26 ClipNode::ClipNode(const ClipNode& other) = default;
27
28 bool ClipNode::operator==(const ClipNode& other) const {
29 return id == other.id && parent_id == other.parent_id &&
30 owner_id == other.owner_id && clip == other.clip &&
31 combined_clip_in_target_space == other.combined_clip_in_target_space &&
32 clip_in_target_space == other.clip_in_target_space &&
33 transform_id == other.transform_id && target_id == other.target_id &&
34 applies_local_clip == other.applies_local_clip &&
35 layer_clipping_uses_only_local_clip ==
36 other.layer_clipping_uses_only_local_clip &&
37 target_is_clipped == other.target_is_clipped &&
38 layers_are_clipped == other.layers_are_clipped &&
39 layers_are_clipped_when_surfaces_disabled ==
40 other.layers_are_clipped_when_surfaces_disabled &&
41 resets_clip == other.resets_clip;
42 }
43
44 void ClipNode::ToProtobuf(proto::TreeNode* proto) const {
45 proto->set_id(id);
46 proto->set_parent_id(parent_id);
47 proto->set_owner_id(owner_id);
48
49 DCHECK(!proto->has_clip_node_data());
50 proto::ClipNodeData* data = proto->mutable_clip_node_data();
51
52 RectFToProto(clip, data->mutable_clip());
53 RectFToProto(combined_clip_in_target_space,
54 data->mutable_combined_clip_in_target_space());
55 RectFToProto(clip_in_target_space, data->mutable_clip_in_target_space());
56
57 data->set_transform_id(transform_id);
58 data->set_target_id(target_id);
59 data->set_applies_local_clip(applies_local_clip);
60 data->set_layer_clipping_uses_only_local_clip(
61 layer_clipping_uses_only_local_clip);
62 data->set_target_is_clipped(target_is_clipped);
63 data->set_layers_are_clipped(layers_are_clipped);
64 data->set_layers_are_clipped_when_surfaces_disabled(
65 layers_are_clipped_when_surfaces_disabled);
66 data->set_resets_clip(resets_clip);
67 }
68
69 void ClipNode::FromProtobuf(const proto::TreeNode& proto) {
70 id = proto.id();
71 parent_id = proto.parent_id();
72 owner_id = proto.owner_id();
73
74 DCHECK(proto.has_clip_node_data());
75 const proto::ClipNodeData& data = proto.clip_node_data();
76
77 clip = ProtoToRectF(data.clip());
78 combined_clip_in_target_space =
79 ProtoToRectF(data.combined_clip_in_target_space());
80 clip_in_target_space = ProtoToRectF(data.clip_in_target_space());
81
82 transform_id = data.transform_id();
83 target_id = data.target_id();
84 applies_local_clip = data.applies_local_clip();
85 layer_clipping_uses_only_local_clip =
86 data.layer_clipping_uses_only_local_clip();
87 target_is_clipped = data.target_is_clipped();
88 layers_are_clipped = data.layers_are_clipped();
89 layers_are_clipped_when_surfaces_disabled =
90 data.layers_are_clipped_when_surfaces_disabled();
91 resets_clip = data.resets_clip();
92 }
93
94 void ClipNode::AsValueInto(base::trace_event::TracedValue* value) const {
95 value->SetInteger("id", id);
96 value->SetInteger("parent_id", parent_id);
97 value->SetInteger("owner_id", owner_id);
98 MathUtil::AddToTracedValue("clip", clip, value);
99 value->SetInteger("transform_id", transform_id);
100 value->SetInteger("target_id", target_id);
101 value->SetBoolean("applies_local_clip", applies_local_clip);
102 value->SetBoolean("layer_clipping_uses_only_local_clip",
103 layer_clipping_uses_only_local_clip);
104 value->SetBoolean("target_is_clipped", target_is_clipped);
105 value->SetBoolean("layers_are_clipped", layers_are_clipped);
106 value->SetBoolean("layers_are_clipped_when_surfaces_disabled",
107 layers_are_clipped_when_surfaces_disabled);
108 value->SetBoolean("resets_clip", resets_clip);
109 }
110
111 } // 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