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

Unified Diff: cc/trees/property_tree.cc

Issue 1876903003: cc : Add node and ancestors are animated or invertible to transform tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index de0096bca4ef9a192051c29a941135273c593540..664bfd4a8b74df69ada830d96935b13089c95d82 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -136,6 +136,7 @@ TransformNodeData::TransformNodeData()
source_node_id(-1),
sorting_context_id(0),
needs_local_transform_update(true),
+ node_and_ancestors_are_animated_or_invertible(true),
is_invertible(true),
ancestors_are_invertible(true),
is_animated(false),
@@ -174,6 +175,8 @@ bool TransformNodeData::operator==(const TransformNodeData& other) const {
source_node_id == other.source_node_id &&
sorting_context_id == other.sorting_context_id &&
needs_local_transform_update == other.needs_local_transform_update &&
+ node_and_ancestors_are_animated_or_invertible ==
+ other.node_and_ancestors_are_animated_or_invertible &&
is_invertible == other.is_invertible &&
ancestors_are_invertible == other.ancestors_are_invertible &&
is_animated == other.is_animated &&
@@ -256,6 +259,9 @@ void TransformNodeData::ToProtobuf(proto::TreeNode* proto) const {
data->set_needs_local_transform_update(needs_local_transform_update);
+ data->set_node_and_ancestors_are_animated_or_invertible(
+ node_and_ancestors_are_animated_or_invertible);
+
data->set_is_invertible(is_invertible);
data->set_ancestors_are_invertible(ancestors_are_invertible);
@@ -323,6 +329,9 @@ void TransformNodeData::FromProtobuf(const proto::TreeNode& proto) {
needs_local_transform_update = data.needs_local_transform_update();
+ node_and_ancestors_are_animated_or_invertible =
+ data.node_and_ancestors_are_animated_or_invertible();
+
is_invertible = data.is_invertible();
ancestors_are_invertible = data.ancestors_are_invertible();
@@ -690,6 +699,7 @@ void TransformTree::UpdateTransforms(int id) {
UpdateSnapping(node);
UpdateNodeAndAncestorsHaveIntegerTranslations(node, parent_node);
UpdateTransformChanged(node, parent_node, source_node);
+ UpdateNodeAndAncestorsAreAnimatedOrInvertible(node, parent_node);
}
bool TransformTree::IsDescendant(int desc_id, int source_id) const {
@@ -1062,6 +1072,29 @@ void TransformTree::UpdateTransformChanged(TransformNode* node,
node->data.transform_changed = true;
}
+void TransformTree::UpdateNodeAndAncestorsAreAnimatedOrInvertible(
+ TransformNode* node,
+ TransformNode* parent_node) {
+ if (!parent_node) {
+ node->data.node_and_ancestors_are_animated_or_invertible =
+ node->data.is_animated || node->data.is_invertible;
+ return;
+ }
+ if (!parent_node->data.node_and_ancestors_are_animated_or_invertible) {
+ node->data.node_and_ancestors_are_animated_or_invertible = false;
+ return;
+ }
+ bool is_invertible = node->data.is_invertible;
+ // Even when the current node's transform and the parent's screen space
+ // transform are invertible, the current node's screen space transform can
+ // become uninvertible due to floating-point arithmetic.
+ if (!node->data.ancestors_are_invertible &&
+ parent_node->data.ancestors_are_invertible)
+ is_invertible = false;
+ node->data.node_and_ancestors_are_animated_or_invertible =
+ node->data.is_animated || is_invertible;
+}
+
void TransformTree::SetDeviceTransform(const gfx::Transform& transform,
gfx::PointF root_position) {
gfx::Transform root_post_local = transform;
« no previous file with comments | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698