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

Unified Diff: cc/trees/property_tree.h

Issue 2166043002: cc: Compute target space transform dynamically (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Verify screen space transform when non_root_surfaces is disabled. 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/property_tree.h
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h
index dbc9b4d5aaf54643c9524c39f1abc7a0787fd37e..3a089b147a8bd8adda040b3e1ec3ca9ee14587be 100644
--- a/cc/trees/property_tree.h
+++ b/cc/trees/property_tree.h
@@ -67,6 +67,10 @@ class CC_EXPORT PropertyTree {
~PropertyTree();
PropertyTree<T>& operator=(const PropertyTree<T>&);
+ // Property tree node starts from index 0.
+ static const int kInvalidNodeId = -1;
+ static const int kRootNodeId = 0;
+
bool operator==(const PropertyTree<T>& other) const;
int Insert(const T& tree_node, int parent_id);
@@ -211,10 +215,12 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
return nodes_affected_by_outer_viewport_bounds_delta_;
}
- const gfx::Transform& FromTarget(int node_id) const;
+ const gfx::Transform& FromTarget(int node_id, int effect) const;
void SetFromTarget(int node_id, const gfx::Transform& transform);
- const gfx::Transform& ToTarget(int node_id) const;
+ // TODO(sunxd): remove target space transforms in cached data when we
+ // completely implement computing draw transforms on demand
+ const gfx::Transform& ToTarget(int node_id, int effect_id) const;
void SetToTarget(int node_id, const gfx::Transform& transform);
const gfx::Transform& FromScreen(int node_id) const;
@@ -462,9 +468,33 @@ struct CombinedAnimationScale {
}
};
+struct DrawTransforms {
+ gfx::Transform from_target;
+ gfx::Transform to_target;
+
+ DrawTransforms(gfx::Transform from, gfx::Transform to)
+ : from_target(from), to_target(to) {}
+ bool operator==(const DrawTransforms& other) const {
+ return from_target == other.from_target && to_target == other.to_target;
+ }
+};
+
+struct DrawTransformData {
+ int update_number;
+ DrawTransforms transforms;
+
+ // TODO(sunxd): move screen space transforms here if it can improve
+ // performance
+
+ DrawTransformData()
+ : update_number(-1), transforms(gfx::Transform(), gfx::Transform()) {}
+};
+
struct PropertyTreesCachedData {
int property_tree_update_number;
std::vector<AnimationScaleData> animation_scales;
+ mutable std::vector<std::unordered_map<int, DrawTransformData>>
+ draw_transforms;
PropertyTreesCachedData();
~PropertyTreesCachedData();
@@ -509,6 +539,7 @@ class CC_EXPORT PropertyTrees final {
int sequence_number;
bool is_main_thread;
bool is_active;
+ bool verify_transform_tree_calculations;
void SetInnerViewportContainerBoundsDelta(gfx::Vector2dF bounds_delta);
void SetOuterViewportContainerBoundsDelta(gfx::Vector2dF bounds_delta);
@@ -539,6 +570,11 @@ class CC_EXPORT PropertyTrees final {
void SetAnimationScalesForTesting(int transform_id,
float maximum_animation_scale,
float starting_animation_scale);
+
+ // GetDrawTransforms may change the value of cached_data_
+ const DrawTransforms& GetDrawTransforms(int transform_id,
+ int effect_id) const;
+
void ResetCachedData();
void UpdateCachedNumber();
gfx::Transform ToScreenSpaceTransformWithoutSurfaceContentsScale(

Powered by Google App Engine
This is Rietveld 408576698