OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
(...skipping 8832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8843 | 8843 |
8844 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8844 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
8845 host->SetRootLayer(root); | 8845 host->SetRootLayer(root); |
8846 | 8846 |
8847 ExecuteCalculateDrawProperties(root.get()); | 8847 ExecuteCalculateDrawProperties(root.get()); |
8848 | 8848 |
8849 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), | 8849 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), |
8850 grandchild->visible_rect_from_property_trees()); | 8850 grandchild->visible_rect_from_property_trees()); |
8851 } | 8851 } |
8852 | 8852 |
| 8853 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { |
| 8854 // In the following layer tree, the layer |box|'s render target is |surface|. |
| 8855 // |surface| also creates a transform node. We want to combine clips for |box| |
| 8856 // in the space of its target (i.e., |surface|), not its target's target. This |
| 8857 // test ensures that happens. |
| 8858 |
| 8859 gfx::Transform rotate; |
| 8860 rotate.Rotate(5); |
| 8861 gfx::Transform identity; |
| 8862 |
| 8863 scoped_refptr<Layer> root = Layer::Create(); |
| 8864 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8865 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 8866 false); |
| 8867 |
| 8868 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8869 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 8870 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 8871 false); |
| 8872 frame_clip->SetMasksToBounds(true); |
| 8873 |
| 8874 scoped_refptr<Layer> rotated = Layer::Create(); |
| 8875 SetLayerPropertiesForTesting(rotated.get(), rotate, |
| 8876 gfx::Point3F(1250, 250, 0), gfx::PointF(), |
| 8877 gfx::Size(2500, 500), true, false); |
| 8878 |
| 8879 scoped_refptr<Layer> surface = Layer::Create(); |
| 8880 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), |
| 8881 gfx::PointF(), gfx::Size(2500, 500), true, |
| 8882 false); |
| 8883 surface->SetOpacity(0.5); |
| 8884 |
| 8885 scoped_refptr<LayerWithForcedDrawsContent> container = |
| 8886 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8887 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), |
| 8888 gfx::PointF(), gfx::Size(300, 300), true, false); |
| 8889 |
| 8890 scoped_refptr<LayerWithForcedDrawsContent> box = |
| 8891 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8892 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), |
| 8893 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8894 |
| 8895 root->AddChild(frame_clip); |
| 8896 frame_clip->AddChild(rotated); |
| 8897 rotated->AddChild(surface); |
| 8898 surface->AddChild(container); |
| 8899 surface->AddChild(box); |
| 8900 |
| 8901 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8902 host->SetRootLayer(root); |
| 8903 |
| 8904 ExecuteCalculateDrawProperties(root.get()); |
| 8905 } |
| 8906 |
8853 } // namespace | 8907 } // namespace |
8854 } // namespace cc | 8908 } // namespace cc |
OLD | NEW |