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

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: Force cc unit tests verify transform tree calculations 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 e9f3bb08b536210982e06cdf539f54378cab5b54..abd5debdc8b888b4599f8210e3ae55bb62a405b3 100644
--- a/cc/trees/property_tree.h
+++ b/cc/trees/property_tree.h
@@ -67,6 +67,8 @@ class CC_EXPORT PropertyTree {
~PropertyTree();
PropertyTree<T>& operator=(const PropertyTree<T>&);
+ static const int kInvalidNodeId = -1;
+
bool operator==(const PropertyTree<T>& other) const;
int Insert(const T& tree_node, int parent_id);
@@ -220,10 +222,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;
@@ -474,9 +478,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();
@@ -521,6 +549,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);
@@ -551,6 +580,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();

Powered by Google App Engine
This is Rietveld 408576698