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

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

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