Commit 67394b4d authored by vollick's avatar vollick Committed by Commit bot

Combine clips in content target space.

We currently combine clips in the target space of the clip's transform
node. This is incorrect. We want to combine clips in the space of the
transform node's _content_ target space.

BUG=386810

Review URL: https://codereview.chromium.org/991013002

Cr-Commit-Position: refs/heads/master@{#319789}
parent ac138e5c
......@@ -38,7 +38,7 @@ void CalculateVisibleRects(
const TransformNode* clip_transform_node =
transform_tree.Node(clip_node->data.transform_id);
const TransformNode* target_node =
transform_tree.Node(transform_node->data.target_id);
transform_tree.Node(transform_node->data.content_target_id);
gfx::Transform clip_to_target;
gfx::Transform content_to_target;
......
......@@ -8850,5 +8850,59 @@ TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) {
grandchild->visible_rect_from_property_trees());
}
TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) {
// In the following layer tree, the layer |box|'s render target is |surface|.
// |surface| also creates a transform node. We want to combine clips for |box|
// in the space of its target (i.e., |surface|), not its target's target. This
// test ensures that happens.
gfx::Transform rotate;
rotate.Rotate(5);
gfx::Transform identity;
scoped_refptr<Layer> root = Layer::Create();
SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(),
gfx::PointF(), gfx::Size(2500, 1500), true,
false);
scoped_refptr<Layer> frame_clip = Layer::Create();
SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(),
gfx::PointF(), gfx::Size(2500, 1500), true,
false);
frame_clip->SetMasksToBounds(true);
scoped_refptr<Layer> rotated = Layer::Create();
SetLayerPropertiesForTesting(rotated.get(), rotate,
gfx::Point3F(1250, 250, 0), gfx::PointF(),
gfx::Size(2500, 500), true, false);
scoped_refptr<Layer> surface = Layer::Create();
SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(),
gfx::PointF(), gfx::Size(2500, 500), true,
false);
surface->SetOpacity(0.5);
scoped_refptr<LayerWithForcedDrawsContent> container =
make_scoped_refptr(new LayerWithForcedDrawsContent());
SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(),
gfx::PointF(), gfx::Size(300, 300), true, false);
scoped_refptr<LayerWithForcedDrawsContent> box =
make_scoped_refptr(new LayerWithForcedDrawsContent());
SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(),
gfx::PointF(), gfx::Size(100, 100), true, false);
root->AddChild(frame_clip);
frame_clip->AddChild(rotated);
rotated->AddChild(surface);
surface->AddChild(container);
surface->AddChild(box);
scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
host->SetRootLayer(root);
ExecuteCalculateDrawProperties(root.get());
}
} // namespace
} // namespace cc
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