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 #ifndef CC_TREES_TRANSFORM_NODE_H_ | 5 #ifndef CC_TREES_TRANSFORM_NODE_H_ |
6 #define CC_TREES_TRANSFORM_NODE_H_ | 6 #define CC_TREES_TRANSFORM_NODE_H_ |
7 | 7 |
8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
9 #include "ui/gfx/geometry/point_f.h" | 9 #include "ui/gfx/geometry/point_f.h" |
10 #include "ui/gfx/geometry/scroll_offset.h" | 10 #include "ui/gfx/geometry/scroll_offset.h" |
11 #include "ui/gfx/transform.h" | 11 #include "ui/gfx/transform.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 namespace trace_event { | 14 namespace trace_event { |
15 class TracedValue; | 15 class TracedValue; |
16 } // namespace trace_event | 16 } // namespace trace_event |
17 } // namespace base | 17 } // namespace base |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 namespace proto { | |
22 class TransformCachedNodeData; | |
23 class TreeNode; | |
24 } // namespace proto | |
25 | |
26 struct CC_EXPORT TransformNode { | 21 struct CC_EXPORT TransformNode { |
27 TransformNode(); | 22 TransformNode(); |
28 TransformNode(const TransformNode&); | 23 TransformNode(const TransformNode&); |
29 | 24 |
30 int id; | 25 int id; |
31 int parent_id; | 26 int parent_id; |
32 int owner_id; | 27 int owner_id; |
33 | 28 |
34 // The local transform information is combined to form to_parent (ignoring | 29 // The local transform information is combined to form to_parent (ignoring |
35 // snapping) as follows: | 30 // snapping) as follows: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void set_to_parent(const gfx::Transform& transform) { | 127 void set_to_parent(const gfx::Transform& transform) { |
133 to_parent = transform; | 128 to_parent = transform; |
134 is_invertible = to_parent.IsInvertible(); | 129 is_invertible = to_parent.IsInvertible(); |
135 } | 130 } |
136 | 131 |
137 void update_pre_local_transform(const gfx::Point3F& transform_origin); | 132 void update_pre_local_transform(const gfx::Point3F& transform_origin); |
138 | 133 |
139 void update_post_local_transform(const gfx::PointF& position, | 134 void update_post_local_transform(const gfx::PointF& position, |
140 const gfx::Point3F& transform_origin); | 135 const gfx::Point3F& transform_origin); |
141 | 136 |
142 void ToProtobuf(proto::TreeNode* proto) const; | |
143 void FromProtobuf(const proto::TreeNode& proto); | |
144 | |
145 void AsValueInto(base::trace_event::TracedValue* value) const; | 137 void AsValueInto(base::trace_event::TracedValue* value) const; |
146 }; | 138 }; |
147 | 139 |
148 // TODO(sunxd): move this into PropertyTrees::cached_data_. | 140 // TODO(sunxd): move this into PropertyTrees::cached_data_. |
149 struct CC_EXPORT TransformCachedNodeData { | 141 struct CC_EXPORT TransformCachedNodeData { |
150 TransformCachedNodeData(); | 142 TransformCachedNodeData(); |
151 TransformCachedNodeData(const TransformCachedNodeData& other); | 143 TransformCachedNodeData(const TransformCachedNodeData& other); |
152 ~TransformCachedNodeData(); | 144 ~TransformCachedNodeData(); |
153 | 145 |
154 gfx::Transform from_screen; | 146 gfx::Transform from_screen; |
155 gfx::Transform to_screen; | 147 gfx::Transform to_screen; |
156 int target_id; | 148 int target_id; |
157 // This id is used for all content that draws into a render surface associated | 149 // This id is used for all content that draws into a render surface associated |
158 // with this transform node. | 150 // with this transform node. |
159 int content_target_id; | 151 int content_target_id; |
160 | 152 |
161 bool is_showing_backface : 1; | 153 bool is_showing_backface : 1; |
162 | 154 |
163 bool operator==(const TransformCachedNodeData& other) const; | 155 bool operator==(const TransformCachedNodeData& other) const; |
164 | |
165 void ToProtobuf(proto::TransformCachedNodeData* proto) const; | |
166 void FromProtobuf(const proto::TransformCachedNodeData& proto); | |
167 }; | 156 }; |
168 | 157 |
169 } // namespace cc | 158 } // namespace cc |
170 | 159 |
171 #endif // CC_TREES_TRANSFORM_NODE_H_ | 160 #endif // CC_TREES_TRANSFORM_NODE_H_ |
OLD | NEW |