Commit 2f6d058a authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

Remove TransformTree::ComputeTranslation

This code became unused after https://crrev.com/691020.

Change-Id: I9f91a36e98518ec907f63c7cfefc0503481e784b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1846338
Auto-Submit: Philip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703758}
parent 61fc82e5
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/numerics/checked_math.h" #include "base/numerics/checked_math.h"
#include "base/trace_event/traced_value.h" #include "base/trace_event/traced_value.h"
#include "cc/layers/layer_impl.h"
#include "cc/trees/clip_node.h" #include "cc/trees/clip_node.h"
#include "cc/trees/effect_node.h" #include "cc/trees/effect_node.h"
#include "cc/trees/layer_tree_impl.h" #include "cc/trees/layer_tree_impl.h"
...@@ -132,47 +131,6 @@ void TransformTree::set_needs_update(bool needs_update) { ...@@ -132,47 +131,6 @@ void TransformTree::set_needs_update(bool needs_update) {
PropertyTree<TransformNode>::set_needs_update(needs_update); PropertyTree<TransformNode>::set_needs_update(needs_update);
} }
bool TransformTree::ComputeTranslation(int source_id,
int dest_id,
gfx::Transform* transform) const {
transform->MakeIdentity();
if (source_id == dest_id)
return true;
const TransformNode* dest = Node(dest_id);
if (!dest->ancestors_are_invertible)
return false;
if (source_id != kInvalidNodeId)
transform->ConcatTransform(ToScreen(source_id));
if (dest_id != kInvalidNodeId) {
if (dest->local.IsFlat() && (dest->node_and_ancestors_are_flat ||
dest->flattens_inherited_transform)) {
// In this case, flattenning will not affect the result, so we can use the
// FromScreen transform of the dest node.
transform->ConcatTransform(FromScreen(dest_id));
} else {
// In this case, some node between source and destination flattens
// inherited transform. Consider the tree R->A->B->C->D, where D is the
// source, A is the destination and C flattens inherited transform. The
// expected result is D * C * flattened(B). D's ToScreen will be D * C *
// flattened(B * A * R), but as the source to destination transform is
// at most translation, C and B cannot be non-flat and so flattened(B * A
// * R) = B * flattened(A * R). So, to get the expected result we have to
// multiply D's ToScreen transform with flattened(A * R)^{-1}, which is
// the inverse of flattened ToScreen of destination.
gfx::Transform to_screen = ToScreen(dest_id);
to_screen.FlattenTo2d();
gfx::Transform from_screen;
bool success = to_screen.GetInverse(&from_screen);
if (!success)
return false;
transform->ConcatTransform(from_screen);
}
}
return true;
}
TransformNode* TransformTree::FindNodeFromElementId(ElementId id) { TransformNode* TransformTree::FindNodeFromElementId(ElementId id) {
auto iterator = property_trees()->element_id_to_transform_node_index.find(id); auto iterator = property_trees()->element_id_to_transform_node_index.find(id);
if (iterator == property_trees()->element_id_to_transform_node_index.end()) if (iterator == property_trees()->element_id_to_transform_node_index.end())
......
...@@ -137,16 +137,6 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { ...@@ -137,16 +137,6 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
TransformNode* FindNodeFromElementId(ElementId id); TransformNode* FindNodeFromElementId(ElementId id);
bool OnTransformAnimated(ElementId element_id, bool OnTransformAnimated(ElementId element_id,
const gfx::Transform& transform); const gfx::Transform& transform);
// Computes the change of basis transform from node |source_id| to |dest_id|.
// This is used by scroll children to compute transform from their scroll
// parent space (source) to their parent space (destination) and it can atmost
// be a translation. This function assumes that the path from source to
// destination has only translations. So, it should not be called when there
// can be intermediate 3d transforms but the end result is a translation.
bool ComputeTranslation(int source_id,
int dest_id,
gfx::Transform* transform) const;
void ResetChangeTracking(); void ResetChangeTracking();
// Updates the parent, target, and screen space transforms and snapping. // Updates the parent, target, and screen space transforms and snapping.
void UpdateTransforms(int id); void UpdateTransforms(int id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment