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

Side by Side Diff: cc/trees/property_tree.h

Issue 2032213002: cc: Put to_target and to_screen behind an accessor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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/draw_property_utils.cc ('k') | cc/trees/property_tree.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PROPERTY_TREE_H_ 5 #ifndef CC_TREES_PROPERTY_TREE_H_
6 #define CC_TREES_PROPERTY_TREE_H_ 6 #define CC_TREES_PROPERTY_TREE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 namespace cc { 26 namespace cc {
27 27
28 namespace proto { 28 namespace proto {
29 class ClipNodeData; 29 class ClipNodeData;
30 class EffectNodeData; 30 class EffectNodeData;
31 class PropertyTree; 31 class PropertyTree;
32 class PropertyTrees; 32 class PropertyTrees;
33 class ScrollNodeData; 33 class ScrollNodeData;
34 class TranformNodeData; 34 class TransformNodeData;
35 class TransformCachedNodeData;
35 class TransformTreeData; 36 class TransformTreeData;
36 class TreeNode; 37 class TreeNode;
37 } 38 }
38 39
39 class CopyOutputRequest; 40 class CopyOutputRequest;
40 class LayerTreeImpl; 41 class LayerTreeImpl;
41 class RenderSurfaceImpl; 42 class RenderSurfaceImpl;
42 class ScrollState; 43 class ScrollState;
43 struct ScrollAndScaleSet; 44 struct ScrollAndScaleSet;
44 45
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // directly on the transform/scroll display list items when that's possible, 88 // directly on the transform/scroll display list items when that's possible,
88 // or potentially in a scroll tree. 89 // or potentially in a scroll tree.
89 // 90 //
90 // TODO(vollick): will be moved when accelerated effects are implemented. 91 // TODO(vollick): will be moved when accelerated effects are implemented.
91 gfx::Transform pre_local; 92 gfx::Transform pre_local;
92 gfx::Transform local; 93 gfx::Transform local;
93 gfx::Transform post_local; 94 gfx::Transform post_local;
94 95
95 gfx::Transform to_parent; 96 gfx::Transform to_parent;
96 97
97 gfx::Transform to_target;
98 gfx::Transform from_target;
99
100 gfx::Transform to_screen;
101 gfx::Transform from_screen;
102
103 int target_id;
104 // This id is used for all content that draws into a render surface associated
105 // with this transform node.
106 int content_target_id;
107
108 // This is the node with respect to which source_offset is defined. This will 98 // This is the node with respect to which source_offset is defined. This will
109 // not be needed once layerization moves to cc, but is needed in order to 99 // not be needed once layerization moves to cc, but is needed in order to
110 // efficiently update the transform tree for changes to position in the layer 100 // efficiently update the transform tree for changes to position in the layer
111 // tree. 101 // tree.
112 int source_node_id; 102 int source_node_id;
113 103
114 // This id determines which 3d rendering context the node is in. 0 is a 104 // This id determines which 3d rendering context the node is in. 0 is a
115 // special value and indicates that the node is not in any 3d rendering 105 // special value and indicates that the node is not in any 3d rendering
116 // context. 106 // context.
117 int sorting_context_id; 107 int sorting_context_id;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 196
207 void update_post_local_transform(const gfx::PointF& position, 197 void update_post_local_transform(const gfx::PointF& position,
208 const gfx::Point3F& transform_origin); 198 const gfx::Point3F& transform_origin);
209 199
210 void ToProtobuf(proto::TreeNode* proto) const; 200 void ToProtobuf(proto::TreeNode* proto) const;
211 void FromProtobuf(const proto::TreeNode& proto); 201 void FromProtobuf(const proto::TreeNode& proto);
212 202
213 void AsValueInto(base::trace_event::TracedValue* value) const; 203 void AsValueInto(base::trace_event::TracedValue* value) const;
214 }; 204 };
215 205
206 struct CC_EXPORT TransformCachedNodeData {
207 TransformCachedNodeData();
208 TransformCachedNodeData(const TransformCachedNodeData& other);
209 ~TransformCachedNodeData();
210
211 gfx::Transform from_target;
212 gfx::Transform to_target;
213 gfx::Transform from_screen;
214 gfx::Transform to_screen;
215 int target_id;
216 // This id is used for all content that draws into a render surface associated
217 // with this transform node.
218 int content_target_id;
219
220 bool operator==(const TransformCachedNodeData& other) const;
221
222 void ToProtobuf(proto::TransformCachedNodeData* proto) const;
223 void FromProtobuf(const proto::TransformCachedNodeData& proto);
224 };
225
216 typedef TreeNode<TransformNodeData> TransformNode; 226 typedef TreeNode<TransformNodeData> TransformNode;
217 227
218 struct CC_EXPORT ClipNodeData { 228 struct CC_EXPORT ClipNodeData {
219 ClipNodeData(); 229 ClipNodeData();
220 ClipNodeData(const ClipNodeData& other); 230 ClipNodeData(const ClipNodeData& other);
221 231
222 // The clip rect that this node contributes, expressed in the space of its 232 // The clip rect that this node contributes, expressed in the space of its
223 // transform node. 233 // transform node.
224 gfx::RectF clip; 234 gfx::RectF clip;
225 235
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 PropertyTrees* property_trees_; 409 PropertyTrees* property_trees_;
400 }; 410 };
401 411
402 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { 412 class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
403 public: 413 public:
404 TransformTree(); 414 TransformTree();
405 ~TransformTree(); 415 ~TransformTree();
406 416
407 bool operator==(const TransformTree& other) const; 417 bool operator==(const TransformTree& other) const;
408 418
419 int Insert(const TransformNode& tree_node, int parent_id);
420
409 void clear(); 421 void clear();
410 422
411 // Computes the change of basis transform from node |source_id| to |dest_id|. 423 // Computes the change of basis transform from node |source_id| to |dest_id|.
412 // The function returns false iff the inverse of a singular transform was 424 // The function returns false iff the inverse of a singular transform was
413 // used (and the result should, therefore, not be trusted). Transforms may 425 // used (and the result should, therefore, not be trusted). Transforms may
414 // be computed between any pair of nodes that have an ancestor/descendant 426 // be computed between any pair of nodes that have an ancestor/descendant
415 // relationship. Transforms between other pairs of nodes may only be computed 427 // relationship. Transforms between other pairs of nodes may only be computed
416 // if the following condition holds: let id1 the larger id and let id2 be the 428 // if the following condition holds: let id1 the larger id and let id2 be the
417 // other id; then the nearest ancestor of node id1 whose id is smaller than 429 // other id; then the nearest ancestor of node id1 whose id is smaller than
418 // id2 is the lowest common ancestor of the pair of nodes, and the transform 430 // id2 is the lowest common ancestor of the pair of nodes, and the transform
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 510
499 const std::vector<int>& nodes_affected_by_inner_viewport_bounds_delta() 511 const std::vector<int>& nodes_affected_by_inner_viewport_bounds_delta()
500 const { 512 const {
501 return nodes_affected_by_inner_viewport_bounds_delta_; 513 return nodes_affected_by_inner_viewport_bounds_delta_;
502 } 514 }
503 const std::vector<int>& nodes_affected_by_outer_viewport_bounds_delta() 515 const std::vector<int>& nodes_affected_by_outer_viewport_bounds_delta()
504 const { 516 const {
505 return nodes_affected_by_outer_viewport_bounds_delta_; 517 return nodes_affected_by_outer_viewport_bounds_delta_;
506 } 518 }
507 519
520 const gfx::Transform& FromTarget(int node_id) const;
521 void SetFromTarget(int node_id, const gfx::Transform& transform);
522
523 const gfx::Transform& ToTarget(int node_id) const;
524 void SetToTarget(int node_id, const gfx::Transform& transform);
525
526 const gfx::Transform& FromScreen(int node_id) const;
527 void SetFromScreen(int node_id, const gfx::Transform& transform);
528
529 const gfx::Transform& ToScreen(int node_id) const;
530 void SetToScreen(int node_id, const gfx::Transform& transform);
531
532 int TargetId(int node_id) const;
533 void SetTargetId(int node_id, int target_id);
534
535 int ContentTargetId(int node_id) const;
536 void SetContentTargetId(int node_id, int content_target_id);
537
538 const std::vector<TransformCachedNodeData>& cached_data() const {
539 return cached_data_;
540 }
541
508 gfx::Transform ToScreenSpaceTransformWithoutSublayerScale(int id) const; 542 gfx::Transform ToScreenSpaceTransformWithoutSublayerScale(int id) const;
509 543
510 void ToProtobuf(proto::PropertyTree* proto) const; 544 void ToProtobuf(proto::PropertyTree* proto) const;
511 void FromProtobuf(const proto::PropertyTree& proto, 545 void FromProtobuf(const proto::PropertyTree& proto,
512 std::unordered_map<int, int>* node_id_to_index_map); 546 std::unordered_map<int, int>* node_id_to_index_map);
513 547
514 private: 548 private:
515 // Returns true iff the node at |desc_id| is a descendant of the node at 549 // Returns true iff the node at |desc_id| is a descendant of the node at
516 // |anc_id|. 550 // |anc_id|.
517 bool IsDescendant(int desc_id, int anc_id) const; 551 bool IsDescendant(int desc_id, int anc_id) const;
(...skipping 30 matching lines...) Expand all
548 582
549 bool source_to_parent_updates_allowed_; 583 bool source_to_parent_updates_allowed_;
550 // When to_screen transform has perspective, the transform node's sublayer 584 // When to_screen transform has perspective, the transform node's sublayer
551 // scale is calculated using page scale factor, device scale factor and the 585 // scale is calculated using page scale factor, device scale factor and the
552 // scale factor of device transform. So we need to store them explicitly. 586 // scale factor of device transform. So we need to store them explicitly.
553 float page_scale_factor_; 587 float page_scale_factor_;
554 float device_scale_factor_; 588 float device_scale_factor_;
555 float device_transform_scale_factor_; 589 float device_transform_scale_factor_;
556 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_; 590 std::vector<int> nodes_affected_by_inner_viewport_bounds_delta_;
557 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_; 591 std::vector<int> nodes_affected_by_outer_viewport_bounds_delta_;
592 std::vector<TransformCachedNodeData> cached_data_;
558 }; 593 };
559 594
560 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> { 595 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> {
561 public: 596 public:
562 bool operator==(const ClipTree& other) const; 597 bool operator==(const ClipTree& other) const;
563 598
564 void SetViewportClip(gfx::RectF viewport_rect); 599 void SetViewportClip(gfx::RectF viewport_rect);
565 gfx::RectF ViewportClip(); 600 gfx::RectF ViewportClip();
566 601
567 void ToProtobuf(proto::PropertyTree* proto) const; 602 void ToProtobuf(proto::PropertyTree* proto) const;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 774
740 private: 775 private:
741 gfx::Vector2dF inner_viewport_container_bounds_delta_; 776 gfx::Vector2dF inner_viewport_container_bounds_delta_;
742 gfx::Vector2dF outer_viewport_container_bounds_delta_; 777 gfx::Vector2dF outer_viewport_container_bounds_delta_;
743 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; 778 gfx::Vector2dF inner_viewport_scroll_bounds_delta_;
744 }; 779 };
745 780
746 } // namespace cc 781 } // namespace cc
747 782
748 #endif // CC_TREES_PROPERTY_TREE_H_ 783 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698