Commit 8c62ff08 authored by jaydasika's avatar jaydasika Committed by Commit bot

cc: Compute transform to target using effect id.

This CL adds ComputeTransformsToTarget method which takes a transform id
and effect id and calls this instead of ComputeTransforms when
destination is target.

BUG=622372
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_blink_rel

Review-Url: https://codereview.chromium.org/2172003002
Cr-Commit-Position: refs/heads/master@{#407282}
parent 4c174803
This diff is collapsed.
......@@ -1001,9 +1001,9 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) {
// We are calculating transform between two render surfaces. So, we
// need to apply the surface contents scale at target and remove the
// surface contents scale at source.
property_trees()->transform_tree.ComputeTransform(
property_trees()->ComputeTransformToTarget(
it->render_surface()->TransformTreeIndex(),
occlusion_surface->TransformTreeIndex(), &draw_transform);
occlusion_surface->EffectTreeIndex(), &draw_transform);
// We don't have to apply surface contents scale when target is root.
if (occlusion_surface->TransformTreeIndex() != 0) {
const EffectNode* occlusion_effect_node =
......
......@@ -773,9 +773,8 @@ void EffectTree::UpdateBackfaceVisibility(EffectNode* node,
parent_transform_node->sorting_context_id ==
transform_node->sorting_context_id) {
gfx::Transform surface_draw_transform;
transform_tree.ComputeTransform(
transform_node->id, transform_tree.TargetId(transform_node->id),
&surface_draw_transform);
property_trees()->ComputeTransformToTarget(
transform_node->id, node->target_id, &surface_draw_transform);
node->hidden_by_backface_visibility =
surface_draw_transform.IsBackFaceVisible();
} else {
......@@ -1876,4 +1875,33 @@ gfx::Transform PropertyTrees::ToScreenSpaceTransformWithoutSurfaceContentsScale(
return screen_space_transform;
}
bool PropertyTrees::ComputeTransformToTarget(int transform_id,
int effect_id,
gfx::Transform* transform) const {
transform->MakeIdentity();
int destination_transform_id;
if (effect_id == -1) {
// This can happen when PaintArtifactCompositor builds property trees as
// it doesn't set effect ids on clip nodes. We want to compute transform
// to the root in this case.
destination_transform_id = 0;
} else {
const EffectNode* effect_node = effect_tree.Node(effect_id);
DCHECK(effect_node->has_render_surface || effect_node->id == 0);
destination_transform_id = effect_node->transform_id;
}
if (transform_id == destination_transform_id)
return true;
if (transform_id > destination_transform_id) {
return transform_tree.CombineTransformsBetween(
transform_id, destination_transform_id, transform);
}
return transform_tree.CombineInversesBetween(
transform_id, destination_transform_id, transform);
}
} // namespace cc
......@@ -237,11 +237,6 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
void FromProtobuf(const proto::PropertyTree& proto,
std::unordered_map<int, int>* node_id_to_index_map);
private:
// Returns true iff the node at |desc_id| is a descendant of the node at
// |anc_id|.
bool IsDescendant(int desc_id, int anc_id) const;
// Computes the combined transform between |source_id| and |dest_id| and
// returns false if the inverse of a singular transform was used. These two
// nodes must be on the same ancestor chain.
......@@ -256,6 +251,11 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
int dest_id,
gfx::Transform* transform) const;
private:
// Returns true iff the node at |desc_id| is a descendant of the node at
// |anc_id|.
bool IsDescendant(int desc_id, int anc_id) const;
void UpdateLocalTransform(TransformNode* node);
void UpdateScreenSpaceTransform(TransformNode* node,
TransformNode* parent_node,
......@@ -544,6 +544,9 @@ class CC_EXPORT PropertyTrees final {
gfx::Transform ToScreenSpaceTransformWithoutSurfaceContentsScale(
int transform_id,
int effect_id) const;
bool ComputeTransformToTarget(int transform_id,
int effect_id,
gfx::Transform* transform) const;
private:
gfx::Vector2dF inner_viewport_container_bounds_delta_;
......
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