| 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 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1471 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 1472 parent.get(), parent->bounds(), &render_surface_layer_list); | 1472 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 1473 inputs.can_adjust_raster_scales = true; | 1473 inputs.can_adjust_raster_scales = true; |
| 1474 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1474 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 1475 EXPECT_TRUE(parent->render_surface()); | 1475 EXPECT_TRUE(parent->render_surface()); |
| 1476 EXPECT_FALSE(render_surface1->render_surface()); | 1476 EXPECT_FALSE(render_surface1->render_surface()); |
| 1477 EXPECT_EQ(1U, render_surface_layer_list.size()); | 1477 EXPECT_EQ(1U, render_surface_layer_list.size()); |
| 1478 } | 1478 } |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 TEST_F(LayerTreeHostCommonTest, RenderSurfacesFlattenScreenSpaceTransform) { |
| 1482 // Render surfaces act as a flattening point for their subtree, so should |
| 1483 // always flatten the target-to-screen space transform seen by descendants. |
| 1484 |
| 1485 scoped_refptr<Layer> root = Layer::Create(); |
| 1486 scoped_refptr<Layer> parent = Layer::Create(); |
| 1487 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1488 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1489 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 1490 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1491 |
| 1492 gfx::Transform rotation_about_y_axis; |
| 1493 rotation_about_y_axis.RotateAboutYAxis(30.0); |
| 1494 // Make |parent| have a render surface. |
| 1495 parent->SetOpacity(0.9f); |
| 1496 |
| 1497 const gfx::Transform identity_matrix; |
| 1498 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 1499 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 1500 SetLayerPropertiesForTesting(parent.get(), rotation_about_y_axis, |
| 1501 gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10), |
| 1502 true, false); |
| 1503 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), |
| 1504 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 1505 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
| 1506 gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10), |
| 1507 true, false); |
| 1508 |
| 1509 root->AddChild(parent); |
| 1510 parent->AddChild(child); |
| 1511 child->AddChild(grand_child); |
| 1512 |
| 1513 grand_child->SetShouldFlattenTransform(false); |
| 1514 |
| 1515 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1516 host->SetRootLayer(root); |
| 1517 |
| 1518 // Only grand_child should preserve 3d. |
| 1519 EXPECT_TRUE(root->should_flatten_transform()); |
| 1520 EXPECT_TRUE(parent->should_flatten_transform()); |
| 1521 EXPECT_TRUE(child->should_flatten_transform()); |
| 1522 EXPECT_FALSE(grand_child->should_flatten_transform()); |
| 1523 |
| 1524 gfx::Transform expected_child_draw_transform = identity_matrix; |
| 1525 gfx::Transform expected_grand_child_draw_transform = identity_matrix; |
| 1526 |
| 1527 gfx::Transform flattened_rotation_about_y = rotation_about_y_axis; |
| 1528 flattened_rotation_about_y.FlattenTo2d(); |
| 1529 |
| 1530 ExecuteCalculateDrawProperties(root.get()); |
| 1531 |
| 1532 EXPECT_TRUE(parent->render_surface()); |
| 1533 EXPECT_FALSE(child->render_surface()); |
| 1534 EXPECT_FALSE(grand_child->render_surface()); |
| 1535 |
| 1536 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); |
| 1537 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 1538 grand_child->draw_transform()); |
| 1539 |
| 1540 // The screen-space transform inherited by |child| and |grand_child| should |
| 1541 // have been flattened at their render target. In particular, the fact that |
| 1542 // |grand_child| happens to preserve 3d shouldn't affect this flattening. |
| 1543 EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_y, |
| 1544 child->screen_space_transform()); |
| 1545 EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_y, |
| 1546 grand_child->screen_space_transform()); |
| 1547 } |
| 1548 |
| 1481 TEST_F(LayerTreeHostCommonTest, ClipRectCullsRenderSurfaces) { | 1549 TEST_F(LayerTreeHostCommonTest, ClipRectCullsRenderSurfaces) { |
| 1482 // The entire subtree of layers that are outside the clip rect should be | 1550 // The entire subtree of layers that are outside the clip rect should be |
| 1483 // culled away, and should not affect the render_surface_layer_list. | 1551 // culled away, and should not affect the render_surface_layer_list. |
| 1484 // | 1552 // |
| 1485 // The test tree is set up as follows: | 1553 // The test tree is set up as follows: |
| 1486 // - all layers except the leaf_nodes are forced to be a new render surface | 1554 // - all layers except the leaf_nodes are forced to be a new render surface |
| 1487 // that have something to draw. | 1555 // that have something to draw. |
| 1488 // - parent is a large container layer. | 1556 // - parent is a large container layer. |
| 1489 // - child has masksToBounds=true to cause clipping. | 1557 // - child has masksToBounds=true to cause clipping. |
| 1490 // - grand_child is positioned outside of the child's bounds | 1558 // - grand_child is positioned outside of the child's bounds |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2968 AddAnimatedTransformToLayer( | 3036 AddAnimatedTransformToLayer( |
| 2969 root.get(), 10.0, start_transform_operations, end_transform_operations); | 3037 root.get(), 10.0, start_transform_operations, end_transform_operations); |
| 2970 | 3038 |
| 2971 EXPECT_TRUE(root->TransformIsAnimating()); | 3039 EXPECT_TRUE(root->TransformIsAnimating()); |
| 2972 | 3040 |
| 2973 ExecuteCalculateDrawProperties(root.get()); | 3041 ExecuteCalculateDrawProperties(root.get()); |
| 2974 | 3042 |
| 2975 EXPECT_FALSE(child->draw_properties().sorted_for_recursion); | 3043 EXPECT_FALSE(child->draw_properties().sorted_for_recursion); |
| 2976 } | 3044 } |
| 2977 | 3045 |
| 2978 TEST_F(LayerTreeHostCommonTest, WillSortAtContextBoundary) { | |
| 2979 // Creates a layer tree that looks as follows: | |
| 2980 // * root (sorting-context-id1) | |
| 2981 // * parent (sorting-context-id2) | |
| 2982 // * child1 (sorting-context-id2) | |
| 2983 // * child2 (sorting-context-id2) | |
| 2984 // | |
| 2985 // This test ensures that we sort at |parent| even though both it and root are | |
| 2986 // set to be 3d sorted. | |
| 2987 FakeImplProxy proxy; | |
| 2988 TestSharedBitmapManager shared_bitmap_manager; | |
| 2989 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | |
| 2990 | |
| 2991 scoped_ptr<LayerImpl> root_ptr(LayerImpl::Create(host_impl.active_tree(), 1)); | |
| 2992 LayerImpl* root = root_ptr.get(); | |
| 2993 scoped_ptr<LayerImpl> parent_ptr( | |
| 2994 LayerImpl::Create(host_impl.active_tree(), 2)); | |
| 2995 LayerImpl* parent = parent_ptr.get(); | |
| 2996 scoped_ptr<LayerImpl> child1_ptr( | |
| 2997 LayerImpl::Create(host_impl.active_tree(), 3)); | |
| 2998 LayerImpl* child1 = child1_ptr.get(); | |
| 2999 scoped_ptr<LayerImpl> child2_ptr( | |
| 3000 LayerImpl::Create(host_impl.active_tree(), 4)); | |
| 3001 LayerImpl* child2 = child2_ptr.get(); | |
| 3002 | |
| 3003 gfx::Transform identity_matrix; | |
| 3004 gfx::Transform below_matrix; | |
| 3005 below_matrix.Translate3d(0.f, 0.f, -10.f); | |
| 3006 gfx::Transform above_matrix; | |
| 3007 above_matrix.Translate3d(0.f, 0.f, 10.f); | |
| 3008 | |
| 3009 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), | |
| 3010 gfx::PointF(), gfx::Size(100, 100), true, true, | |
| 3011 true); | |
| 3012 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | |
| 3013 gfx::PointF(), gfx::Size(50, 50), true, true, | |
| 3014 true); | |
| 3015 SetLayerPropertiesForTesting(child1, above_matrix, gfx::Point3F(), | |
| 3016 gfx::PointF(), gfx::Size(50, 50), true, true, | |
| 3017 false); | |
| 3018 SetLayerPropertiesForTesting(child2, below_matrix, gfx::Point3F(), | |
| 3019 gfx::PointF(), gfx::Size(50, 50), true, true, | |
| 3020 false); | |
| 3021 | |
| 3022 root->Set3dSortingContextId(3); | |
| 3023 root->SetDrawsContent(true); | |
| 3024 parent->Set3dSortingContextId(7); | |
| 3025 parent->SetDrawsContent(true); | |
| 3026 child1->Set3dSortingContextId(7); | |
| 3027 child1->SetDrawsContent(true); | |
| 3028 child2->Set3dSortingContextId(7); | |
| 3029 child2->SetDrawsContent(true); | |
| 3030 | |
| 3031 parent->AddChild(child1_ptr.Pass()); | |
| 3032 parent->AddChild(child2_ptr.Pass()); | |
| 3033 root->AddChild(parent_ptr.Pass()); | |
| 3034 | |
| 3035 LayerImplList render_surface_layer_list; | |
| 3036 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | |
| 3037 root_ptr.get(), root->bounds(), &render_surface_layer_list); | |
| 3038 inputs.can_adjust_raster_scales = true; | |
| 3039 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | |
| 3040 | |
| 3041 EXPECT_TRUE(root->render_surface()); | |
| 3042 EXPECT_EQ(2u, render_surface_layer_list.size()); | |
| 3043 | |
| 3044 EXPECT_EQ(3u, parent->render_surface()->layer_list().size()); | |
| 3045 EXPECT_EQ(child2->id(), parent->render_surface()->layer_list().at(0)->id()); | |
| 3046 EXPECT_EQ(parent->id(), parent->render_surface()->layer_list().at(1)->id()); | |
| 3047 EXPECT_EQ(child1->id(), parent->render_surface()->layer_list().at(2)->id()); | |
| 3048 } | |
| 3049 | |
| 3050 TEST_F(LayerTreeHostCommonTest, | 3046 TEST_F(LayerTreeHostCommonTest, |
| 3051 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { | 3047 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { |
| 3052 scoped_refptr<Layer> root = Layer::Create(); | 3048 scoped_refptr<Layer> root = Layer::Create(); |
| 3053 | 3049 |
| 3054 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3050 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3055 host->SetRootLayer(root); | 3051 host->SetRootLayer(root); |
| 3056 | 3052 |
| 3057 gfx::Transform identity_matrix; | 3053 gfx::Transform identity_matrix; |
| 3058 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 3054 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 3059 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 3055 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| (...skipping 4525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7585 // right clip, our render_surface_layer_list's order should be unaffected. | 7581 // right clip, our render_surface_layer_list's order should be unaffected. |
| 7586 EXPECT_EQ(3u, render_surface_layer_list.size()); | 7582 EXPECT_EQ(3u, render_surface_layer_list.size()); |
| 7587 EXPECT_EQ(root.get(), render_surface_layer_list.at(0)); | 7583 EXPECT_EQ(root.get(), render_surface_layer_list.at(0)); |
| 7588 EXPECT_EQ(render_surface2.get(), render_surface_layer_list.at(1)); | 7584 EXPECT_EQ(render_surface2.get(), render_surface_layer_list.at(1)); |
| 7589 EXPECT_EQ(render_surface1.get(), render_surface_layer_list.at(2)); | 7585 EXPECT_EQ(render_surface1.get(), render_surface_layer_list.at(2)); |
| 7590 EXPECT_TRUE(render_surface_layer_list.at(0)->render_surface()); | 7586 EXPECT_TRUE(render_surface_layer_list.at(0)->render_surface()); |
| 7591 EXPECT_TRUE(render_surface_layer_list.at(1)->render_surface()); | 7587 EXPECT_TRUE(render_surface_layer_list.at(1)->render_surface()); |
| 7592 EXPECT_TRUE(render_surface_layer_list.at(2)->render_surface()); | 7588 EXPECT_TRUE(render_surface_layer_list.at(2)->render_surface()); |
| 7593 } | 7589 } |
| 7594 | 7590 |
| 7595 TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { | |
| 7596 // We rearrange layer list contributions if we have to visit children out of | |
| 7597 // order, but it should be a 'stable' rearrangement. That is, the layer list | |
| 7598 // additions for a single layer should not be reordered, though their position | |
| 7599 // wrt to the contributions due to a sibling may vary. | |
| 7600 // | |
| 7601 // + root | |
| 7602 // + scroll_child | |
| 7603 // + top_content | |
| 7604 // + bottom_content | |
| 7605 // + scroll_parent_border | |
| 7606 // + scroll_parent_clip | |
| 7607 // + scroll_parent | |
| 7608 // | |
| 7609 FakeImplProxy proxy; | |
| 7610 TestSharedBitmapManager shared_bitmap_manager; | |
| 7611 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | |
| 7612 host_impl.CreatePendingTree(); | |
| 7613 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | |
| 7614 scoped_ptr<LayerImpl> scroll_parent_border = | |
| 7615 LayerImpl::Create(host_impl.active_tree(), 2); | |
| 7616 scoped_ptr<LayerImpl> scroll_parent_clip = | |
| 7617 LayerImpl::Create(host_impl.active_tree(), 3); | |
| 7618 scoped_ptr<LayerImpl> scroll_parent = | |
| 7619 LayerImpl::Create(host_impl.active_tree(), 4); | |
| 7620 scoped_ptr<LayerImpl> scroll_child = | |
| 7621 LayerImpl::Create(host_impl.active_tree(), 5); | |
| 7622 scoped_ptr<LayerImpl> bottom_content = | |
| 7623 LayerImpl::Create(host_impl.active_tree(), 6); | |
| 7624 scoped_ptr<LayerImpl> top_content = | |
| 7625 LayerImpl::Create(host_impl.active_tree(), 7); | |
| 7626 | |
| 7627 scroll_parent_clip->SetMasksToBounds(true); | |
| 7628 | |
| 7629 scroll_child->SetScrollParent(scroll_parent.get()); | |
| 7630 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); | |
| 7631 scroll_children->insert(scroll_child.get()); | |
| 7632 scroll_parent->SetScrollChildren(scroll_children.release()); | |
| 7633 | |
| 7634 scroll_child->SetDrawsContent(true); | |
| 7635 scroll_parent->SetDrawsContent(true); | |
| 7636 top_content->SetDrawsContent(true); | |
| 7637 bottom_content->SetDrawsContent(true); | |
| 7638 | |
| 7639 gfx::Transform identity_transform; | |
| 7640 gfx::Transform top_transform; | |
| 7641 top_transform.Translate3d(0.0, 0.0, 5.0); | |
| 7642 gfx::Transform bottom_transform; | |
| 7643 bottom_transform.Translate3d(0.0, 0.0, 3.0); | |
| 7644 | |
| 7645 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | |
| 7646 gfx::PointF(), gfx::Size(50, 50), true, false, | |
| 7647 true); | |
| 7648 SetLayerPropertiesForTesting(scroll_parent_border.get(), identity_transform, | |
| 7649 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), | |
| 7650 true, false, false); | |
| 7651 SetLayerPropertiesForTesting(scroll_parent_clip.get(), identity_transform, | |
| 7652 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | |
| 7653 true, false, false); | |
| 7654 SetLayerPropertiesForTesting(scroll_parent.get(), identity_transform, | |
| 7655 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | |
| 7656 true, false, false); | |
| 7657 SetLayerPropertiesForTesting(scroll_child.get(), identity_transform, | |
| 7658 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | |
| 7659 true, false, false); | |
| 7660 SetLayerPropertiesForTesting(top_content.get(), top_transform, gfx::Point3F(), | |
| 7661 gfx::PointF(), gfx::Size(50, 50), false, true, | |
| 7662 true); | |
| 7663 SetLayerPropertiesForTesting(bottom_content.get(), bottom_transform, | |
| 7664 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | |
| 7665 false, true, true); | |
| 7666 | |
| 7667 scroll_child->SetShouldFlattenTransform(false); | |
| 7668 scroll_child->Set3dSortingContextId(1); | |
| 7669 | |
| 7670 scroll_child->AddChild(top_content.Pass()); | |
| 7671 scroll_child->AddChild(bottom_content.Pass()); | |
| 7672 root->AddChild(scroll_child.Pass()); | |
| 7673 | |
| 7674 scroll_parent_clip->AddChild(scroll_parent.Pass()); | |
| 7675 scroll_parent_border->AddChild(scroll_parent_clip.Pass()); | |
| 7676 root->AddChild(scroll_parent_border.Pass()); | |
| 7677 | |
| 7678 LayerImplList render_surface_layer_list; | |
| 7679 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | |
| 7680 root.get(), root->bounds(), &render_surface_layer_list); | |
| 7681 | |
| 7682 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | |
| 7683 | |
| 7684 EXPECT_TRUE(root->render_surface()); | |
| 7685 | |
| 7686 // If we don't sort by depth and let the layers get added in the order they | |
| 7687 // would normally be visited in, then layers 6 and 7 will be out of order. In | |
| 7688 // other words, although we've had to shift 5, 6, and 7 to appear before 4 | |
| 7689 // in the list (because of the scroll parent relationship), this should not | |
| 7690 // have an effect on the the order of 5, 6, and 7 (which had been reordered | |
| 7691 // due to layer sorting). | |
| 7692 EXPECT_EQ(4u, root->render_surface()->layer_list().size()); | |
| 7693 EXPECT_EQ(5, root->render_surface()->layer_list().at(0)->id()); | |
| 7694 EXPECT_EQ(6, root->render_surface()->layer_list().at(1)->id()); | |
| 7695 EXPECT_EQ(7, root->render_surface()->layer_list().at(2)->id()); | |
| 7696 EXPECT_EQ(4, root->render_surface()->layer_list().at(3)->id()); | |
| 7697 } | |
| 7698 | |
| 7699 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { | 7591 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { |
| 7700 // This test verifies that a scrolling layer that gets snapped to | 7592 // This test verifies that a scrolling layer that gets snapped to |
| 7701 // integer coordinates doesn't move a fixed position child. | 7593 // integer coordinates doesn't move a fixed position child. |
| 7702 // | 7594 // |
| 7703 // + root | 7595 // + root |
| 7704 // + container | 7596 // + container |
| 7705 // + scroller | 7597 // + scroller |
| 7706 // + fixed | 7598 // + fixed |
| 7707 // | 7599 // |
| 7708 FakeImplProxy proxy; | 7600 FakeImplProxy proxy; |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8843 | 8735 |
| 8844 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8736 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8845 host->SetRootLayer(root); | 8737 host->SetRootLayer(root); |
| 8846 | 8738 |
| 8847 ExecuteCalculateDrawProperties(root.get()); | 8739 ExecuteCalculateDrawProperties(root.get()); |
| 8848 | 8740 |
| 8849 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), | 8741 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), |
| 8850 grandchild->visible_rect_from_property_trees()); | 8742 grandchild->visible_rect_from_property_trees()); |
| 8851 } | 8743 } |
| 8852 | 8744 |
| 8745 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { |
| 8746 // In the following layer tree, the layer |box|'s render target is |surface|. |
| 8747 // |surface| also creates a transform node. We want to combine clips for |box| |
| 8748 // in the space of its target (i.e., |surface|), not its target's target. This |
| 8749 // test ensures that happens. |
| 8750 |
| 8751 gfx::Transform rotate; |
| 8752 rotate.Rotate(5); |
| 8753 gfx::Transform identity; |
| 8754 |
| 8755 scoped_refptr<Layer> root = Layer::Create(); |
| 8756 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8757 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 8758 false); |
| 8759 |
| 8760 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8761 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 8762 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 8763 false); |
| 8764 frame_clip->SetMasksToBounds(true); |
| 8765 |
| 8766 scoped_refptr<Layer> rotated = Layer::Create(); |
| 8767 SetLayerPropertiesForTesting(rotated.get(), rotate, |
| 8768 gfx::Point3F(1250, 250, 0), gfx::PointF(), |
| 8769 gfx::Size(2500, 500), true, false); |
| 8770 |
| 8771 scoped_refptr<Layer> surface = Layer::Create(); |
| 8772 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), |
| 8773 gfx::PointF(), gfx::Size(2500, 500), true, |
| 8774 false); |
| 8775 surface->SetOpacity(0.5); |
| 8776 |
| 8777 scoped_refptr<LayerWithForcedDrawsContent> container = |
| 8778 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8779 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), |
| 8780 gfx::PointF(), gfx::Size(300, 300), true, false); |
| 8781 |
| 8782 scoped_refptr<LayerWithForcedDrawsContent> box = |
| 8783 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8784 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), |
| 8785 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8786 |
| 8787 root->AddChild(frame_clip); |
| 8788 frame_clip->AddChild(rotated); |
| 8789 rotated->AddChild(surface); |
| 8790 surface->AddChild(container); |
| 8791 surface->AddChild(box); |
| 8792 |
| 8793 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8794 host->SetRootLayer(root); |
| 8795 |
| 8796 ExecuteCalculateDrawProperties(root.get()); |
| 8797 } |
| 8798 |
| 8853 } // namespace | 8799 } // namespace |
| 8854 } // namespace cc | 8800 } // namespace cc |
| OLD | NEW |