| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
| 6 | 6 |
| 7 #include "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
| 8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
| 9 #include "cc/debug/overdraw_metrics.h" | 9 #include "cc/debug/overdraw_metrics.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| 11 #include "cc/layers/layer_impl.h" | 11 #include "cc/layers/layer_impl.h" |
| 12 #include "cc/output/copy_output_request.h" | 12 #include "cc/output/copy_output_request.h" |
| 13 #include "cc/output/copy_output_result.h" | 13 #include "cc/output/copy_output_result.h" |
| 14 #include "cc/output/filter_operation.h" | 14 #include "cc/output/filter_operation.h" |
| 15 #include "cc/output/filter_operations.h" | 15 #include "cc/output/filter_operations.h" |
| 16 #include "cc/test/animation_test_common.h" | 16 #include "cc/test/animation_test_common.h" |
| 17 #include "cc/test/fake_impl_proxy.h" | 17 #include "cc/test/fake_impl_proxy.h" |
| 18 #include "cc/test/fake_layer_tree_host.h" | 18 #include "cc/test/fake_layer_tree_host.h" |
| 19 #include "cc/test/fake_layer_tree_host_impl.h" | 19 #include "cc/test/fake_layer_tree_host_impl.h" |
| 20 #include "cc/test/geometry_test_utils.h" | 20 #include "cc/test/geometry_test_utils.h" |
| 21 #include "cc/test/occlusion_tracker_test_common.h" | 21 #include "cc/test/test_occlusion_tracker.h" |
| 22 #include "cc/trees/layer_tree_host_common.h" | 22 #include "cc/trees/layer_tree_host_common.h" |
| 23 #include "cc/trees/single_thread_proxy.h" | 23 #include "cc/trees/single_thread_proxy.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 #include "ui/gfx/transform.h" | 26 #include "ui/gfx/transform.h" |
| 27 | 27 |
| 28 namespace cc { | 28 namespace cc { |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 class TestContentLayer : public Layer { | 31 class TestContentLayer : public Layer { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 gfx::Rect opaque_contents_rect_; | 73 gfx::Rect opaque_contents_rect_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 static inline bool LayerImplDrawTransformIsUnknown(const Layer* layer) { | 76 static inline bool LayerImplDrawTransformIsUnknown(const Layer* layer) { |
| 77 return layer->draw_transform_is_animating(); | 77 return layer->draw_transform_is_animating(); |
| 78 } | 78 } |
| 79 static inline bool LayerImplDrawTransformIsUnknown(const LayerImpl* layer) { | 79 static inline bool LayerImplDrawTransformIsUnknown(const LayerImpl* layer) { |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 template <typename LayerType, typename RenderSurfaceType> | 83 template <typename LayerType> |
| 84 class TestOcclusionTrackerWithClip | 84 class TestOcclusionTrackerWithClip : public TestOcclusionTracker<LayerType> { |
| 85 : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> { | |
| 86 public: | 85 public: |
| 87 TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect, | 86 TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect, |
| 88 bool record_metrics_for_frame) | 87 bool record_metrics_for_frame) |
| 89 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>( | 88 : TestOcclusionTracker<LayerType>(viewport_rect, |
| 90 viewport_rect, | 89 record_metrics_for_frame) {} |
| 91 record_metrics_for_frame) {} | |
| 92 explicit TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect) | 90 explicit TestOcclusionTrackerWithClip(const gfx::Rect& viewport_rect) |
| 93 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewport_rect, | 91 : TestOcclusionTracker<LayerType>(viewport_rect, false) {} |
| 94 false) {} | |
| 95 | 92 |
| 96 bool OccludedLayer(const LayerType* layer, | 93 bool OccludedLayer(const LayerType* layer, |
| 97 const gfx::Rect& content_rect) const { | 94 const gfx::Rect& content_rect) const { |
| 98 DCHECK(layer->visible_content_rect().Contains(content_rect)); | 95 DCHECK(layer->visible_content_rect().Contains(content_rect)); |
| 99 return this->Occluded(layer->render_target(), | 96 return this->Occluded(layer->render_target(), |
| 100 content_rect, | 97 content_rect, |
| 101 layer->draw_transform(), | 98 layer->draw_transform(), |
| 102 LayerImplDrawTransformIsUnknown(layer)); | 99 LayerImplDrawTransformIsUnknown(layer)); |
| 103 } | 100 } |
| 104 | 101 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 116 }; | 113 }; |
| 117 | 114 |
| 118 struct OcclusionTrackerTestMainThreadTypes { | 115 struct OcclusionTrackerTestMainThreadTypes { |
| 119 typedef Layer LayerType; | 116 typedef Layer LayerType; |
| 120 typedef FakeLayerTreeHost HostType; | 117 typedef FakeLayerTreeHost HostType; |
| 121 typedef RenderSurface RenderSurfaceType; | 118 typedef RenderSurface RenderSurfaceType; |
| 122 typedef TestContentLayer ContentLayerType; | 119 typedef TestContentLayer ContentLayerType; |
| 123 typedef scoped_refptr<Layer> LayerPtrType; | 120 typedef scoped_refptr<Layer> LayerPtrType; |
| 124 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; | 121 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; |
| 125 typedef LayerIterator<Layer> TestLayerIterator; | 122 typedef LayerIterator<Layer> TestLayerIterator; |
| 126 typedef OcclusionTracker OcclusionTrackerType; | 123 typedef OcclusionTracker<Layer> OcclusionTrackerType; |
| 127 | 124 |
| 128 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } | 125 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } |
| 129 static ContentLayerPtrType CreateContentLayer(HostType* host) { | 126 static ContentLayerPtrType CreateContentLayer(HostType* host) { |
| 130 return make_scoped_refptr(new ContentLayerType()); | 127 return make_scoped_refptr(new ContentLayerType()); |
| 131 } | 128 } |
| 132 | 129 |
| 133 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { | 130 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { |
| 134 LayerPtrType ref(*layer); | 131 LayerPtrType ref(*layer); |
| 135 *layer = NULL; | 132 *layer = NULL; |
| 136 return ref; | 133 return ref; |
| 137 } | 134 } |
| 138 | 135 |
| 139 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { | 136 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { |
| 140 LayerPtrType ref(*layer); | 137 LayerPtrType ref(*layer); |
| 141 *layer = NULL; | 138 *layer = NULL; |
| 142 return ref; | 139 return ref; |
| 143 } | 140 } |
| 144 | 141 |
| 145 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } | 142 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } |
| 146 }; | 143 }; |
| 147 | 144 |
| 148 struct OcclusionTrackerTestImplThreadTypes { | 145 struct OcclusionTrackerTestImplThreadTypes { |
| 149 typedef LayerImpl LayerType; | 146 typedef LayerImpl LayerType; |
| 150 typedef LayerTreeImpl HostType; | 147 typedef LayerTreeImpl HostType; |
| 151 typedef RenderSurfaceImpl RenderSurfaceType; | 148 typedef RenderSurfaceImpl RenderSurfaceType; |
| 152 typedef TestContentLayerImpl ContentLayerType; | 149 typedef TestContentLayerImpl ContentLayerType; |
| 153 typedef scoped_ptr<LayerImpl> LayerPtrType; | 150 typedef scoped_ptr<LayerImpl> LayerPtrType; |
| 154 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; | 151 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; |
| 155 typedef LayerIterator<LayerImpl> TestLayerIterator; | 152 typedef LayerIterator<LayerImpl> TestLayerIterator; |
| 156 typedef OcclusionTrackerImpl OcclusionTrackerType; | 153 typedef OcclusionTracker<LayerImpl> OcclusionTrackerType; |
| 157 | 154 |
| 158 static LayerPtrType CreateLayer(HostType* host) { | 155 static LayerPtrType CreateLayer(HostType* host) { |
| 159 return LayerImpl::Create(host, next_layer_impl_id++); | 156 return LayerImpl::Create(host, next_layer_impl_id++); |
| 160 } | 157 } |
| 161 static ContentLayerPtrType CreateContentLayer(HostType* host) { | 158 static ContentLayerPtrType CreateContentLayer(HostType* host) { |
| 162 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++)); | 159 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++)); |
| 163 } | 160 } |
| 164 static int next_layer_impl_id; | 161 static int next_layer_impl_id; |
| 165 | 162 |
| 166 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { | 163 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); | 535 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); |
| 539 typename Types::ContentLayerType* layer = | 536 typename Types::ContentLayerType* layer = |
| 540 this->CreateDrawingLayer(parent, | 537 this->CreateDrawingLayer(parent, |
| 541 this->identity_matrix, | 538 this->identity_matrix, |
| 542 gfx::PointF(30.f, 30.f), | 539 gfx::PointF(30.f, 30.f), |
| 543 gfx::Size(500, 500), | 540 gfx::Size(500, 500), |
| 544 true); | 541 true); |
| 545 parent->SetMasksToBounds(true); | 542 parent->SetMasksToBounds(true); |
| 546 this->CalcDrawEtc(root); | 543 this->CalcDrawEtc(root); |
| 547 | 544 |
| 548 TestOcclusionTrackerWithClip<typename Types::LayerType, | 545 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 549 typename Types::RenderSurfaceType> occlusion( | |
| 550 gfx::Rect(0, 0, 1000, 1000), false); | 546 gfx::Rect(0, 0, 1000, 1000), false); |
| 551 | 547 |
| 552 this->VisitLayer(layer, &occlusion); | 548 this->VisitLayer(layer, &occlusion); |
| 553 this->EnterLayer(parent, &occlusion); | 549 this->EnterLayer(parent, &occlusion); |
| 554 | 550 |
| 555 EXPECT_EQ(gfx::Rect().ToString(), | 551 EXPECT_EQ(gfx::Rect().ToString(), |
| 556 occlusion.occlusion_from_outside_target().ToString()); | 552 occlusion.occlusion_from_outside_target().ToString()); |
| 557 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), | 553 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), |
| 558 occlusion.occlusion_from_inside_target().ToString()); | 554 occlusion.occlusion_from_inside_target().ToString()); |
| 559 | 555 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 layer_transform.Translate(10.0, 10.0); | 601 layer_transform.Translate(10.0, 10.0); |
| 606 | 602 |
| 607 typename Types::ContentLayerType* parent = this->CreateRoot( | 603 typename Types::ContentLayerType* parent = this->CreateRoot( |
| 608 this->identity_matrix, gfx::Point(0, 0), gfx::Size(100, 100)); | 604 this->identity_matrix, gfx::Point(0, 0), gfx::Size(100, 100)); |
| 609 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer( | 605 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer( |
| 610 parent, layer_transform, gfx::PointF(), gfx::Size(90, 90), true); | 606 parent, layer_transform, gfx::PointF(), gfx::Size(90, 90), true); |
| 611 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( | 607 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( |
| 612 layer1, layer_transform, gfx::PointF(), gfx::Size(50, 50), true); | 608 layer1, layer_transform, gfx::PointF(), gfx::Size(50, 50), true); |
| 613 this->CalcDrawEtc(parent); | 609 this->CalcDrawEtc(parent); |
| 614 | 610 |
| 615 TestOcclusionTrackerWithClip<typename Types::LayerType, | 611 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 616 typename Types::RenderSurfaceType> occlusion( | |
| 617 gfx::Rect(0, 0, 1000, 1000)); | 612 gfx::Rect(0, 0, 1000, 1000)); |
| 618 | 613 |
| 619 this->VisitLayer(layer2, &occlusion); | 614 this->VisitLayer(layer2, &occlusion); |
| 620 this->EnterLayer(layer1, &occlusion); | 615 this->EnterLayer(layer1, &occlusion); |
| 621 | 616 |
| 622 EXPECT_EQ(gfx::Rect().ToString(), | 617 EXPECT_EQ(gfx::Rect().ToString(), |
| 623 occlusion.occlusion_from_outside_target().ToString()); | 618 occlusion.occlusion_from_outside_target().ToString()); |
| 624 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), | 619 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), |
| 625 occlusion.occlusion_from_inside_target().ToString()); | 620 occlusion.occlusion_from_inside_target().ToString()); |
| 626 | 621 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); | 667 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); |
| 673 typename Types::ContentLayerType* layer = | 668 typename Types::ContentLayerType* layer = |
| 674 this->CreateDrawingLayer(parent, | 669 this->CreateDrawingLayer(parent, |
| 675 layer_transform, | 670 layer_transform, |
| 676 gfx::PointF(30.f, 30.f), | 671 gfx::PointF(30.f, 30.f), |
| 677 gfx::Size(500, 500), | 672 gfx::Size(500, 500), |
| 678 true); | 673 true); |
| 679 parent->SetMasksToBounds(true); | 674 parent->SetMasksToBounds(true); |
| 680 this->CalcDrawEtc(root); | 675 this->CalcDrawEtc(root); |
| 681 | 676 |
| 682 TestOcclusionTrackerWithClip<typename Types::LayerType, | 677 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 683 typename Types::RenderSurfaceType> occlusion( | |
| 684 gfx::Rect(0, 0, 1000, 1000)); | 678 gfx::Rect(0, 0, 1000, 1000)); |
| 685 | 679 |
| 686 this->VisitLayer(layer, &occlusion); | 680 this->VisitLayer(layer, &occlusion); |
| 687 this->EnterLayer(parent, &occlusion); | 681 this->EnterLayer(parent, &occlusion); |
| 688 | 682 |
| 689 EXPECT_EQ(gfx::Rect().ToString(), | 683 EXPECT_EQ(gfx::Rect().ToString(), |
| 690 occlusion.occlusion_from_outside_target().ToString()); | 684 occlusion.occlusion_from_outside_target().ToString()); |
| 691 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), | 685 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), |
| 692 occlusion.occlusion_from_inside_target().ToString()); | 686 occlusion.occlusion_from_inside_target().ToString()); |
| 693 | 687 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); | 737 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); |
| 744 typename Types::ContentLayerType* layer = | 738 typename Types::ContentLayerType* layer = |
| 745 this->CreateDrawingLayer(parent, | 739 this->CreateDrawingLayer(parent, |
| 746 layer_transform, | 740 layer_transform, |
| 747 gfx::PointF(30.f, 30.f), | 741 gfx::PointF(30.f, 30.f), |
| 748 gfx::Size(500, 500), | 742 gfx::Size(500, 500), |
| 749 true); | 743 true); |
| 750 parent->SetMasksToBounds(true); | 744 parent->SetMasksToBounds(true); |
| 751 this->CalcDrawEtc(root); | 745 this->CalcDrawEtc(root); |
| 752 | 746 |
| 753 TestOcclusionTrackerWithClip<typename Types::LayerType, | 747 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 754 typename Types::RenderSurfaceType> occlusion( | |
| 755 gfx::Rect(0, 0, 1000, 1000)); | 748 gfx::Rect(0, 0, 1000, 1000)); |
| 756 | 749 |
| 757 this->VisitLayer(layer, &occlusion); | 750 this->VisitLayer(layer, &occlusion); |
| 758 this->EnterLayer(parent, &occlusion); | 751 this->EnterLayer(parent, &occlusion); |
| 759 | 752 |
| 760 EXPECT_EQ(gfx::Rect().ToString(), | 753 EXPECT_EQ(gfx::Rect().ToString(), |
| 761 occlusion.occlusion_from_outside_target().ToString()); | 754 occlusion.occlusion_from_outside_target().ToString()); |
| 762 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), | 755 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), |
| 763 occlusion.occlusion_from_inside_target().ToString()); | 756 occlusion.occlusion_from_inside_target().ToString()); |
| 764 | 757 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); | 808 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); |
| 816 child->SetMasksToBounds(true); | 809 child->SetMasksToBounds(true); |
| 817 typename Types::ContentLayerType* layer = | 810 typename Types::ContentLayerType* layer = |
| 818 this->CreateDrawingLayer(child, | 811 this->CreateDrawingLayer(child, |
| 819 this->identity_matrix, | 812 this->identity_matrix, |
| 820 gfx::PointF(10.f, 10.f), | 813 gfx::PointF(10.f, 10.f), |
| 821 gfx::Size(500, 500), | 814 gfx::Size(500, 500), |
| 822 true); | 815 true); |
| 823 this->CalcDrawEtc(parent); | 816 this->CalcDrawEtc(parent); |
| 824 | 817 |
| 825 TestOcclusionTrackerWithClip<typename Types::LayerType, | 818 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 826 typename Types::RenderSurfaceType> occlusion( | |
| 827 gfx::Rect(0, 0, 1000, 1000)); | 819 gfx::Rect(0, 0, 1000, 1000)); |
| 828 | 820 |
| 829 this->VisitLayer(layer, &occlusion); | 821 this->VisitLayer(layer, &occlusion); |
| 830 this->EnterContributingSurface(child, &occlusion); | 822 this->EnterContributingSurface(child, &occlusion); |
| 831 | 823 |
| 832 EXPECT_EQ(gfx::Rect().ToString(), | 824 EXPECT_EQ(gfx::Rect().ToString(), |
| 833 occlusion.occlusion_from_outside_target().ToString()); | 825 occlusion.occlusion_from_outside_target().ToString()); |
| 834 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), | 826 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), |
| 835 occlusion.occlusion_from_inside_target().ToString()); | 827 occlusion.occlusion_from_inside_target().ToString()); |
| 836 | 828 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( | 914 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( |
| 923 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); | 915 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); |
| 924 typename Types::ContentLayerType* occluder = | 916 typename Types::ContentLayerType* occluder = |
| 925 this->CreateDrawingLayer(parent, | 917 this->CreateDrawingLayer(parent, |
| 926 this->identity_matrix, | 918 this->identity_matrix, |
| 927 gfx::PointF(100.f, 100.f), | 919 gfx::PointF(100.f, 100.f), |
| 928 gfx::Size(500, 500), | 920 gfx::Size(500, 500), |
| 929 true); | 921 true); |
| 930 this->CalcDrawEtc(parent); | 922 this->CalcDrawEtc(parent); |
| 931 | 923 |
| 932 TestOcclusionTrackerWithClip<typename Types::LayerType, | 924 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 933 typename Types::RenderSurfaceType> occlusion( | |
| 934 gfx::Rect(0, 0, 1000, 1000)); | 925 gfx::Rect(0, 0, 1000, 1000)); |
| 935 | 926 |
| 936 this->VisitLayer(occluder, &occlusion); | 927 this->VisitLayer(occluder, &occlusion); |
| 937 this->EnterLayer(layer2, &occlusion); | 928 this->EnterLayer(layer2, &occlusion); |
| 938 | 929 |
| 939 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), | 930 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), |
| 940 occlusion.occlusion_from_outside_target().ToString()); | 931 occlusion.occlusion_from_outside_target().ToString()); |
| 941 EXPECT_EQ(gfx::Rect().ToString(), | 932 EXPECT_EQ(gfx::Rect().ToString(), |
| 942 occlusion.occlusion_from_inside_target().ToString()); | 933 occlusion.occlusion_from_inside_target().ToString()); |
| 943 | 934 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 // first, instead of |child|'s. This exercises different code in | 978 // first, instead of |child|'s. This exercises different code in |
| 988 // LeaveToRenderTarget, as the target surface has already been seen. | 979 // LeaveToRenderTarget, as the target surface has already been seen. |
| 989 typename Types::ContentLayerType* child2 = | 980 typename Types::ContentLayerType* child2 = |
| 990 this->CreateDrawingLayer(parent, | 981 this->CreateDrawingLayer(parent, |
| 991 this->identity_matrix, | 982 this->identity_matrix, |
| 992 gfx::PointF(30.f, 30.f), | 983 gfx::PointF(30.f, 30.f), |
| 993 gfx::Size(60, 20), | 984 gfx::Size(60, 20), |
| 994 true); | 985 true); |
| 995 this->CalcDrawEtc(root); | 986 this->CalcDrawEtc(root); |
| 996 | 987 |
| 997 TestOcclusionTrackerWithClip<typename Types::LayerType, | 988 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 998 typename Types::RenderSurfaceType> occlusion( | |
| 999 gfx::Rect(0, 0, 1000, 1000)); | 989 gfx::Rect(0, 0, 1000, 1000)); |
| 1000 | 990 |
| 1001 this->VisitLayer(child2, &occlusion); | 991 this->VisitLayer(child2, &occlusion); |
| 1002 | 992 |
| 1003 EXPECT_EQ(gfx::Rect().ToString(), | 993 EXPECT_EQ(gfx::Rect().ToString(), |
| 1004 occlusion.occlusion_from_outside_target().ToString()); | 994 occlusion.occlusion_from_outside_target().ToString()); |
| 1005 EXPECT_EQ(gfx::Rect(30, 30, 60, 20).ToString(), | 995 EXPECT_EQ(gfx::Rect(30, 30, 60, 20).ToString(), |
| 1006 occlusion.occlusion_from_inside_target().ToString()); | 996 occlusion.occlusion_from_inside_target().ToString()); |
| 1007 | 997 |
| 1008 this->VisitLayer(layer, &occlusion); | 998 this->VisitLayer(layer, &occlusion); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000)); | 1144 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000)); |
| 1155 typename Types::ContentLayerType* parent = this->CreateDrawingLayer( | 1145 typename Types::ContentLayerType* parent = this->CreateDrawingLayer( |
| 1156 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); | 1146 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); |
| 1157 typename Types::LayerType* child = this->CreateLayer( | 1147 typename Types::LayerType* child = this->CreateLayer( |
| 1158 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); | 1148 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); |
| 1159 child->SetMasksToBounds(true); | 1149 child->SetMasksToBounds(true); |
| 1160 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( | 1150 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( |
| 1161 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true); | 1151 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true); |
| 1162 this->CalcDrawEtc(root); | 1152 this->CalcDrawEtc(root); |
| 1163 | 1153 |
| 1164 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1154 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1165 typename Types::RenderSurfaceType> occlusion( | |
| 1166 gfx::Rect(0, 0, 1000, 1000)); | 1155 gfx::Rect(0, 0, 1000, 1000)); |
| 1167 | 1156 |
| 1168 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect( | 1157 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect( |
| 1169 layer_transform, layer->visible_content_rect()); | 1158 layer_transform, layer->visible_content_rect()); |
| 1170 | 1159 |
| 1171 this->VisitLayer(layer, &occlusion); | 1160 this->VisitLayer(layer, &occlusion); |
| 1172 this->EnterContributingSurface(child, &occlusion); | 1161 this->EnterContributingSurface(child, &occlusion); |
| 1173 | 1162 |
| 1174 EXPECT_EQ(gfx::Rect().ToString(), | 1163 EXPECT_EQ(gfx::Rect().ToString(), |
| 1175 occlusion.occlusion_from_outside_target().ToString()); | 1164 occlusion.occlusion_from_outside_target().ToString()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 gfx::Size(500, 500), | 1213 gfx::Size(500, 500), |
| 1225 true); | 1214 true); |
| 1226 typename Types::ContentLayerType* layer2 = | 1215 typename Types::ContentLayerType* layer2 = |
| 1227 this->CreateDrawingLayer(child, | 1216 this->CreateDrawingLayer(child, |
| 1228 this->identity_matrix, | 1217 this->identity_matrix, |
| 1229 gfx::PointF(10.f, 450.f), | 1218 gfx::PointF(10.f, 450.f), |
| 1230 gfx::Size(500, 60), | 1219 gfx::Size(500, 60), |
| 1231 true); | 1220 true); |
| 1232 this->CalcDrawEtc(root); | 1221 this->CalcDrawEtc(root); |
| 1233 | 1222 |
| 1234 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1223 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1235 typename Types::RenderSurfaceType> occlusion( | |
| 1236 gfx::Rect(0, 0, 1000, 1000)); | 1224 gfx::Rect(0, 0, 1000, 1000)); |
| 1237 | 1225 |
| 1238 this->VisitLayer(layer2, &occlusion); | 1226 this->VisitLayer(layer2, &occlusion); |
| 1239 this->VisitLayer(layer1, &occlusion); | 1227 this->VisitLayer(layer1, &occlusion); |
| 1240 this->VisitLayer(child, &occlusion); | 1228 this->VisitLayer(child, &occlusion); |
| 1241 this->EnterContributingSurface(child, &occlusion); | 1229 this->EnterContributingSurface(child, &occlusion); |
| 1242 | 1230 |
| 1243 EXPECT_EQ(gfx::Rect().ToString(), | 1231 EXPECT_EQ(gfx::Rect().ToString(), |
| 1244 occlusion.occlusion_from_outside_target().ToString()); | 1232 occlusion.occlusion_from_outside_target().ToString()); |
| 1245 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), | 1233 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 gfx::Size(510, 510), | 1332 gfx::Size(510, 510), |
| 1345 true); | 1333 true); |
| 1346 typename Types::ContentLayerType* layer2 = | 1334 typename Types::ContentLayerType* layer2 = |
| 1347 this->CreateDrawingLayer(child2, | 1335 this->CreateDrawingLayer(child2, |
| 1348 this->identity_matrix, | 1336 this->identity_matrix, |
| 1349 gfx::PointF(-10.f, -10.f), | 1337 gfx::PointF(-10.f, -10.f), |
| 1350 gfx::Size(510, 510), | 1338 gfx::Size(510, 510), |
| 1351 true); | 1339 true); |
| 1352 this->CalcDrawEtc(parent); | 1340 this->CalcDrawEtc(parent); |
| 1353 | 1341 |
| 1354 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1342 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1355 typename Types::RenderSurfaceType> occlusion( | |
| 1356 gfx::Rect(0, 0, 1000, 1000)); | 1343 gfx::Rect(0, 0, 1000, 1000)); |
| 1357 | 1344 |
| 1358 this->VisitLayer(layer2, &occlusion); | 1345 this->VisitLayer(layer2, &occlusion); |
| 1359 this->EnterContributingSurface(child2, &occlusion); | 1346 this->EnterContributingSurface(child2, &occlusion); |
| 1360 | 1347 |
| 1361 EXPECT_EQ(gfx::Rect().ToString(), | 1348 EXPECT_EQ(gfx::Rect().ToString(), |
| 1362 occlusion.occlusion_from_outside_target().ToString()); | 1349 occlusion.occlusion_from_outside_target().ToString()); |
| 1363 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), | 1350 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), |
| 1364 occlusion.occlusion_from_inside_target().ToString()); | 1351 occlusion.occlusion_from_inside_target().ToString()); |
| 1365 | 1352 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 gfx::Size(510, 510), | 1452 gfx::Size(510, 510), |
| 1466 true); | 1453 true); |
| 1467 typename Types::ContentLayerType* layer2 = | 1454 typename Types::ContentLayerType* layer2 = |
| 1468 this->CreateDrawingLayer(child2, | 1455 this->CreateDrawingLayer(child2, |
| 1469 this->identity_matrix, | 1456 this->identity_matrix, |
| 1470 gfx::PointF(-10.f, -10.f), | 1457 gfx::PointF(-10.f, -10.f), |
| 1471 gfx::Size(510, 510), | 1458 gfx::Size(510, 510), |
| 1472 true); | 1459 true); |
| 1473 this->CalcDrawEtc(parent); | 1460 this->CalcDrawEtc(parent); |
| 1474 | 1461 |
| 1475 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1462 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1476 typename Types::RenderSurfaceType> occlusion( | |
| 1477 gfx::Rect(0, 0, 1000, 1000)); | 1463 gfx::Rect(0, 0, 1000, 1000)); |
| 1478 | 1464 |
| 1479 this->VisitLayer(layer2, &occlusion); | 1465 this->VisitLayer(layer2, &occlusion); |
| 1480 this->EnterLayer(child2, &occlusion); | 1466 this->EnterLayer(child2, &occlusion); |
| 1481 | 1467 |
| 1482 EXPECT_EQ(gfx::Rect().ToString(), | 1468 EXPECT_EQ(gfx::Rect().ToString(), |
| 1483 occlusion.occlusion_from_outside_target().ToString()); | 1469 occlusion.occlusion_from_outside_target().ToString()); |
| 1484 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), | 1470 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), |
| 1485 occlusion.occlusion_from_inside_target().ToString()); | 1471 occlusion.occlusion_from_inside_target().ToString()); |
| 1486 | 1472 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 filters.Clear(); | 1575 filters.Clear(); |
| 1590 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); | 1576 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); |
| 1591 opaque_layer->SetFilters(filters); | 1577 opaque_layer->SetFilters(filters); |
| 1592 | 1578 |
| 1593 filters.Clear(); | 1579 filters.Clear(); |
| 1594 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); | 1580 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
| 1595 opacity_layer->SetFilters(filters); | 1581 opacity_layer->SetFilters(filters); |
| 1596 | 1582 |
| 1597 this->CalcDrawEtc(parent); | 1583 this->CalcDrawEtc(parent); |
| 1598 | 1584 |
| 1599 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1585 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1600 typename Types::RenderSurfaceType> occlusion( | |
| 1601 gfx::Rect(0, 0, 1000, 1000)); | 1586 gfx::Rect(0, 0, 1000, 1000)); |
| 1602 | 1587 |
| 1603 // Opacity layer won't contribute to occlusion. | 1588 // Opacity layer won't contribute to occlusion. |
| 1604 this->VisitLayer(opacity_layer, &occlusion); | 1589 this->VisitLayer(opacity_layer, &occlusion); |
| 1605 this->EnterContributingSurface(opacity_layer, &occlusion); | 1590 this->EnterContributingSurface(opacity_layer, &occlusion); |
| 1606 | 1591 |
| 1607 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1592 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
| 1608 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); | 1593 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); |
| 1609 | 1594 |
| 1610 // And has nothing to contribute to its parent surface. | 1595 // And has nothing to contribute to its parent surface. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 typename Types::LayerType* surface = | 1646 typename Types::LayerType* surface = |
| 1662 this->CreateDrawingSurface(parent, | 1647 this->CreateDrawingSurface(parent, |
| 1663 this->identity_matrix, | 1648 this->identity_matrix, |
| 1664 gfx::PointF(0.f, 100.f), | 1649 gfx::PointF(0.f, 100.f), |
| 1665 gfx::Size(50, 50), | 1650 gfx::Size(50, 50), |
| 1666 true); | 1651 true); |
| 1667 this->CreateReplicaLayer( | 1652 this->CreateReplicaLayer( |
| 1668 surface, this->identity_matrix, gfx::PointF(50.f, 50.f), gfx::Size()); | 1653 surface, this->identity_matrix, gfx::PointF(50.f, 50.f), gfx::Size()); |
| 1669 this->CalcDrawEtc(parent); | 1654 this->CalcDrawEtc(parent); |
| 1670 | 1655 |
| 1671 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1656 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1672 typename Types::RenderSurfaceType> occlusion( | |
| 1673 gfx::Rect(0, 0, 1000, 1000)); | 1657 gfx::Rect(0, 0, 1000, 1000)); |
| 1674 | 1658 |
| 1675 this->VisitLayer(surface, &occlusion); | 1659 this->VisitLayer(surface, &occlusion); |
| 1676 | 1660 |
| 1677 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), | 1661 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), |
| 1678 occlusion.occlusion_from_inside_target().ToString()); | 1662 occlusion.occlusion_from_inside_target().ToString()); |
| 1679 | 1663 |
| 1680 this->VisitContributingSurface(surface, &occlusion); | 1664 this->VisitContributingSurface(surface, &occlusion); |
| 1681 this->EnterLayer(parent, &occlusion); | 1665 this->EnterLayer(parent, &occlusion); |
| 1682 | 1666 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1703 typename Types::LayerType* surface = | 1687 typename Types::LayerType* surface = |
| 1704 this->CreateDrawingSurface(parent, | 1688 this->CreateDrawingSurface(parent, |
| 1705 this->identity_matrix, | 1689 this->identity_matrix, |
| 1706 gfx::PointF(0.f, 100.f), | 1690 gfx::PointF(0.f, 100.f), |
| 1707 gfx::Size(50, 50), | 1691 gfx::Size(50, 50), |
| 1708 true); | 1692 true); |
| 1709 this->CreateReplicaLayer( | 1693 this->CreateReplicaLayer( |
| 1710 surface, this->identity_matrix, gfx::PointF(50.f, 50.f), gfx::Size()); | 1694 surface, this->identity_matrix, gfx::PointF(50.f, 50.f), gfx::Size()); |
| 1711 this->CalcDrawEtc(parent); | 1695 this->CalcDrawEtc(parent); |
| 1712 | 1696 |
| 1713 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1697 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1714 typename Types::RenderSurfaceType> occlusion( | |
| 1715 gfx::Rect(0, 0, 1000, 1000)); | 1698 gfx::Rect(0, 0, 1000, 1000)); |
| 1716 | 1699 |
| 1717 this->VisitLayer(surface, &occlusion); | 1700 this->VisitLayer(surface, &occlusion); |
| 1718 | 1701 |
| 1719 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), | 1702 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), |
| 1720 occlusion.occlusion_from_inside_target().ToString()); | 1703 occlusion.occlusion_from_inside_target().ToString()); |
| 1721 | 1704 |
| 1722 this->VisitContributingSurface(surface, &occlusion); | 1705 this->VisitContributingSurface(surface, &occlusion); |
| 1723 this->EnterLayer(parent, &occlusion); | 1706 this->EnterLayer(parent, &occlusion); |
| 1724 | 1707 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1744 this->CreateDrawingSurface(parent, | 1727 this->CreateDrawingSurface(parent, |
| 1745 this->identity_matrix, | 1728 this->identity_matrix, |
| 1746 gfx::PointF(0.f, 100.f), | 1729 gfx::PointF(0.f, 100.f), |
| 1747 gfx::Size(50, 50), | 1730 gfx::Size(50, 50), |
| 1748 true); | 1731 true); |
| 1749 typename Types::LayerType* replica = this->CreateReplicaLayer( | 1732 typename Types::LayerType* replica = this->CreateReplicaLayer( |
| 1750 surface, this->identity_matrix, gfx::PointF(50.f, 50.f), gfx::Size()); | 1733 surface, this->identity_matrix, gfx::PointF(50.f, 50.f), gfx::Size()); |
| 1751 this->CreateMaskLayer(replica, gfx::Size(10, 10)); | 1734 this->CreateMaskLayer(replica, gfx::Size(10, 10)); |
| 1752 this->CalcDrawEtc(parent); | 1735 this->CalcDrawEtc(parent); |
| 1753 | 1736 |
| 1754 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1737 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1755 typename Types::RenderSurfaceType> occlusion( | |
| 1756 gfx::Rect(0, 0, 1000, 1000)); | 1738 gfx::Rect(0, 0, 1000, 1000)); |
| 1757 | 1739 |
| 1758 this->VisitLayer(surface, &occlusion); | 1740 this->VisitLayer(surface, &occlusion); |
| 1759 | 1741 |
| 1760 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), | 1742 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), |
| 1761 occlusion.occlusion_from_inside_target().ToString()); | 1743 occlusion.occlusion_from_inside_target().ToString()); |
| 1762 | 1744 |
| 1763 this->VisitContributingSurface(surface, &occlusion); | 1745 this->VisitContributingSurface(surface, &occlusion); |
| 1764 this->EnterLayer(parent, &occlusion); | 1746 this->EnterLayer(parent, &occlusion); |
| 1765 | 1747 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1782 typename Types::ContentLayerType* parent = this->CreateRoot( | 1764 typename Types::ContentLayerType* parent = this->CreateRoot( |
| 1783 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | 1765 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); |
| 1784 typename Types::ContentLayerType* layer = | 1766 typename Types::ContentLayerType* layer = |
| 1785 this->CreateDrawingSurface(parent, | 1767 this->CreateDrawingSurface(parent, |
| 1786 this->identity_matrix, | 1768 this->identity_matrix, |
| 1787 gfx::PointF(), | 1769 gfx::PointF(), |
| 1788 gfx::Size(200, 200), | 1770 gfx::Size(200, 200), |
| 1789 false); | 1771 false); |
| 1790 this->CalcDrawEtc(parent); | 1772 this->CalcDrawEtc(parent); |
| 1791 | 1773 |
| 1792 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1774 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1793 typename Types::RenderSurfaceType> occlusion( | |
| 1794 gfx::Rect(0, 0, 1000, 1000)); | 1775 gfx::Rect(0, 0, 1000, 1000)); |
| 1795 this->EnterLayer(layer, &occlusion); | 1776 this->EnterLayer(layer, &occlusion); |
| 1796 | 1777 |
| 1797 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1778 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
| 1798 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | 1779 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); |
| 1799 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | 1780 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); |
| 1800 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | 1781 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); |
| 1801 | 1782 |
| 1802 this->LeaveLayer(layer, &occlusion); | 1783 this->LeaveLayer(layer, &occlusion); |
| 1803 this->VisitContributingSurface(layer, &occlusion); | 1784 this->VisitContributingSurface(layer, &occlusion); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1819 typename Types::ContentLayerType* parent = this->CreateRoot( | 1800 typename Types::ContentLayerType* parent = this->CreateRoot( |
| 1820 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | 1801 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); |
| 1821 typename Types::ContentLayerType* layer = | 1802 typename Types::ContentLayerType* layer = |
| 1822 this->CreateDrawingLayer(parent, | 1803 this->CreateDrawingLayer(parent, |
| 1823 this->identity_matrix, | 1804 this->identity_matrix, |
| 1824 gfx::PointF(100.f, 100.f), | 1805 gfx::PointF(100.f, 100.f), |
| 1825 gfx::Size(200, 200), | 1806 gfx::Size(200, 200), |
| 1826 false); | 1807 false); |
| 1827 this->CalcDrawEtc(parent); | 1808 this->CalcDrawEtc(parent); |
| 1828 { | 1809 { |
| 1829 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1810 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1830 typename Types::RenderSurfaceType> occlusion( | |
| 1831 gfx::Rect(0, 0, 1000, 1000)); | 1811 gfx::Rect(0, 0, 1000, 1000)); |
| 1832 layer->SetOpaqueContentsRect(gfx::Rect(0, 0, 100, 100)); | 1812 layer->SetOpaqueContentsRect(gfx::Rect(0, 0, 100, 100)); |
| 1833 | 1813 |
| 1834 this->ResetLayerIterator(); | 1814 this->ResetLayerIterator(); |
| 1835 this->VisitLayer(layer, &occlusion); | 1815 this->VisitLayer(layer, &occlusion); |
| 1836 this->EnterLayer(parent, &occlusion); | 1816 this->EnterLayer(parent, &occlusion); |
| 1837 | 1817 |
| 1838 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), | 1818 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), |
| 1839 occlusion.occlusion_from_inside_target().ToString()); | 1819 occlusion.occlusion_from_inside_target().ToString()); |
| 1840 | 1820 |
| 1841 EXPECT_FALSE( | 1821 EXPECT_FALSE( |
| 1842 occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); | 1822 occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); |
| 1843 EXPECT_TRUE( | 1823 EXPECT_TRUE( |
| 1844 occlusion.OccludedLayer(parent, gfx::Rect(100, 100, 100, 100))); | 1824 occlusion.OccludedLayer(parent, gfx::Rect(100, 100, 100, 100))); |
| 1845 EXPECT_FALSE( | 1825 EXPECT_FALSE( |
| 1846 occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100))); | 1826 occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100))); |
| 1847 } | 1827 } |
| 1848 { | 1828 { |
| 1849 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1829 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1850 typename Types::RenderSurfaceType> occlusion( | |
| 1851 gfx::Rect(0, 0, 1000, 1000)); | 1830 gfx::Rect(0, 0, 1000, 1000)); |
| 1852 layer->SetOpaqueContentsRect(gfx::Rect(20, 20, 180, 180)); | 1831 layer->SetOpaqueContentsRect(gfx::Rect(20, 20, 180, 180)); |
| 1853 | 1832 |
| 1854 this->ResetLayerIterator(); | 1833 this->ResetLayerIterator(); |
| 1855 this->VisitLayer(layer, &occlusion); | 1834 this->VisitLayer(layer, &occlusion); |
| 1856 this->EnterLayer(parent, &occlusion); | 1835 this->EnterLayer(parent, &occlusion); |
| 1857 | 1836 |
| 1858 EXPECT_EQ(gfx::Rect(120, 120, 180, 180).ToString(), | 1837 EXPECT_EQ(gfx::Rect(120, 120, 180, 180).ToString(), |
| 1859 occlusion.occlusion_from_inside_target().ToString()); | 1838 occlusion.occlusion_from_inside_target().ToString()); |
| 1860 | 1839 |
| 1861 EXPECT_FALSE( | 1840 EXPECT_FALSE( |
| 1862 occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); | 1841 occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); |
| 1863 EXPECT_FALSE( | 1842 EXPECT_FALSE( |
| 1864 occlusion.OccludedLayer(parent, gfx::Rect(100, 100, 100, 100))); | 1843 occlusion.OccludedLayer(parent, gfx::Rect(100, 100, 100, 100))); |
| 1865 EXPECT_TRUE( | 1844 EXPECT_TRUE( |
| 1866 occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100))); | 1845 occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100))); |
| 1867 } | 1846 } |
| 1868 { | 1847 { |
| 1869 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1848 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1870 typename Types::RenderSurfaceType> occlusion( | |
| 1871 gfx::Rect(0, 0, 1000, 1000)); | 1849 gfx::Rect(0, 0, 1000, 1000)); |
| 1872 layer->SetOpaqueContentsRect(gfx::Rect(150, 150, 100, 100)); | 1850 layer->SetOpaqueContentsRect(gfx::Rect(150, 150, 100, 100)); |
| 1873 | 1851 |
| 1874 this->ResetLayerIterator(); | 1852 this->ResetLayerIterator(); |
| 1875 this->VisitLayer(layer, &occlusion); | 1853 this->VisitLayer(layer, &occlusion); |
| 1876 this->EnterLayer(parent, &occlusion); | 1854 this->EnterLayer(parent, &occlusion); |
| 1877 | 1855 |
| 1878 EXPECT_EQ(gfx::Rect(250, 250, 50, 50).ToString(), | 1856 EXPECT_EQ(gfx::Rect(250, 250, 50, 50).ToString(), |
| 1879 occlusion.occlusion_from_inside_target().ToString()); | 1857 occlusion.occlusion_from_inside_target().ToString()); |
| 1880 | 1858 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1904 typename Types::LayerType* container = this->CreateLayer( | 1882 typename Types::LayerType* container = this->CreateLayer( |
| 1905 parent, this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | 1883 parent, this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); |
| 1906 typename Types::ContentLayerType* layer = | 1884 typename Types::ContentLayerType* layer = |
| 1907 this->CreateDrawingLayer(container, | 1885 this->CreateDrawingLayer(container, |
| 1908 transform, | 1886 transform, |
| 1909 gfx::PointF(100.f, 100.f), | 1887 gfx::PointF(100.f, 100.f), |
| 1910 gfx::Size(200, 200), | 1888 gfx::Size(200, 200), |
| 1911 true); | 1889 true); |
| 1912 this->CalcDrawEtc(parent); | 1890 this->CalcDrawEtc(parent); |
| 1913 | 1891 |
| 1914 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1892 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1915 typename Types::RenderSurfaceType> occlusion( | |
| 1916 gfx::Rect(0, 0, 1000, 1000)); | 1893 gfx::Rect(0, 0, 1000, 1000)); |
| 1917 this->EnterLayer(layer, &occlusion); | 1894 this->EnterLayer(layer, &occlusion); |
| 1918 | 1895 |
| 1919 // The layer is rotated in 3d but without preserving 3d, so it only gets | 1896 // The layer is rotated in 3d but without preserving 3d, so it only gets |
| 1920 // resized. | 1897 // resized. |
| 1921 EXPECT_RECT_EQ( | 1898 EXPECT_RECT_EQ( |
| 1922 gfx::Rect(0, 0, 200, 200), | 1899 gfx::Rect(0, 0, 200, 200), |
| 1923 occlusion.UnoccludedLayerContentRect(layer, gfx::Rect(0, 0, 200, 200))); | 1900 occlusion.UnoccludedLayerContentRect(layer, gfx::Rect(0, 0, 200, 200))); |
| 1924 } | 1901 } |
| 1925 }; | 1902 }; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1955 gfx::PointF(50.f, 50.f), | 1932 gfx::PointF(50.f, 50.f), |
| 1956 gfx::Size(100, 100), | 1933 gfx::Size(100, 100), |
| 1957 true); | 1934 true); |
| 1958 parent->SetShouldFlattenTransform(false); | 1935 parent->SetShouldFlattenTransform(false); |
| 1959 parent->SetIs3dSorted(true); | 1936 parent->SetIs3dSorted(true); |
| 1960 child1->SetIs3dSorted(true); | 1937 child1->SetIs3dSorted(true); |
| 1961 child2->SetIs3dSorted(true); | 1938 child2->SetIs3dSorted(true); |
| 1962 | 1939 |
| 1963 this->CalcDrawEtc(parent); | 1940 this->CalcDrawEtc(parent); |
| 1964 | 1941 |
| 1965 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1942 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 1966 typename Types::RenderSurfaceType> occlusion( | |
| 1967 gfx::Rect(0, 0, 1000, 1000)); | 1943 gfx::Rect(0, 0, 1000, 1000)); |
| 1968 this->VisitLayer(child2, &occlusion); | 1944 this->VisitLayer(child2, &occlusion); |
| 1969 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1945 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
| 1970 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); | 1946 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); |
| 1971 | 1947 |
| 1972 this->VisitLayer(child1, &occlusion); | 1948 this->VisitLayer(child1, &occlusion); |
| 1973 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1949 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
| 1974 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); | 1950 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); |
| 1975 } | 1951 } |
| 1976 }; | 1952 }; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2002 gfx::PointF(100.f, 100.f), | 1978 gfx::PointF(100.f, 100.f), |
| 2003 gfx::Size(200, 200), | 1979 gfx::Size(200, 200), |
| 2004 true); | 1980 true); |
| 2005 container->SetShouldFlattenTransform(false); | 1981 container->SetShouldFlattenTransform(false); |
| 2006 container->SetIs3dSorted(true); | 1982 container->SetIs3dSorted(true); |
| 2007 layer->SetIs3dSorted(true); | 1983 layer->SetIs3dSorted(true); |
| 2008 layer->SetShouldFlattenTransform(false); | 1984 layer->SetShouldFlattenTransform(false); |
| 2009 | 1985 |
| 2010 this->CalcDrawEtc(parent); | 1986 this->CalcDrawEtc(parent); |
| 2011 | 1987 |
| 2012 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1988 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2013 typename Types::RenderSurfaceType> occlusion( | |
| 2014 gfx::Rect(0, 0, 1000, 1000)); | 1989 gfx::Rect(0, 0, 1000, 1000)); |
| 2015 this->EnterLayer(layer, &occlusion); | 1990 this->EnterLayer(layer, &occlusion); |
| 2016 | 1991 |
| 2017 EXPECT_RECT_EQ( | 1992 EXPECT_RECT_EQ( |
| 2018 gfx::Rect(0, 0, 200, 200), | 1993 gfx::Rect(0, 0, 200, 200), |
| 2019 occlusion.UnoccludedLayerContentRect(layer, gfx::Rect(0, 0, 200, 200))); | 1994 occlusion.UnoccludedLayerContentRect(layer, gfx::Rect(0, 0, 200, 200))); |
| 2020 } | 1995 } |
| 2021 }; | 1996 }; |
| 2022 | 1997 |
| 2023 // This test requires accumulating occlusion of 3d layers, which are skipped by | 1998 // This test requires accumulating occlusion of 3d layers, which are skipped by |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2047 typename Types::LayerType* container = this->CreateLayer( | 2022 typename Types::LayerType* container = this->CreateLayer( |
| 2048 parent, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500)); | 2023 parent, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500)); |
| 2049 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( | 2024 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( |
| 2050 container, transform, gfx::PointF(), gfx::Size(500, 500), true); | 2025 container, transform, gfx::PointF(), gfx::Size(500, 500), true); |
| 2051 container->SetShouldFlattenTransform(false); | 2026 container->SetShouldFlattenTransform(false); |
| 2052 container->SetIs3dSorted(true); | 2027 container->SetIs3dSorted(true); |
| 2053 layer->SetShouldFlattenTransform(false); | 2028 layer->SetShouldFlattenTransform(false); |
| 2054 layer->SetIs3dSorted(true); | 2029 layer->SetIs3dSorted(true); |
| 2055 this->CalcDrawEtc(parent); | 2030 this->CalcDrawEtc(parent); |
| 2056 | 2031 |
| 2057 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2032 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2058 typename Types::RenderSurfaceType> occlusion( | |
| 2059 gfx::Rect(0, 0, 1000, 1000)); | 2033 gfx::Rect(0, 0, 1000, 1000)); |
| 2060 this->EnterLayer(layer, &occlusion); | 2034 this->EnterLayer(layer, &occlusion); |
| 2061 | 2035 |
| 2062 // The bottom 11 pixel rows of this layer remain visible inside the | 2036 // The bottom 11 pixel rows of this layer remain visible inside the |
| 2063 // container, after translation to the target surface. When translated back, | 2037 // container, after translation to the target surface. When translated back, |
| 2064 // this will include many more pixels but must include at least the bottom | 2038 // this will include many more pixels but must include at least the bottom |
| 2065 // 11 rows. | 2039 // 11 rows. |
| 2066 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 2040 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
| 2067 layer, gfx::Rect(0, 26, 500, 474)). | 2041 layer, gfx::Rect(0, 26, 500, 474)). |
| 2068 Contains(gfx::Rect(0, 489, 500, 11))); | 2042 Contains(gfx::Rect(0, 489, 500, 11))); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2091 typename Types::ContentLayerType* parent = this->CreateRoot( | 2065 typename Types::ContentLayerType* parent = this->CreateRoot( |
| 2092 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); | 2066 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); |
| 2093 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( | 2067 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( |
| 2094 parent, transform, gfx::PointF(), gfx::Size(100, 100), true); | 2068 parent, transform, gfx::PointF(), gfx::Size(100, 100), true); |
| 2095 parent->SetShouldFlattenTransform(false); | 2069 parent->SetShouldFlattenTransform(false); |
| 2096 parent->SetIs3dSorted(true); | 2070 parent->SetIs3dSorted(true); |
| 2097 layer->SetShouldFlattenTransform(false); | 2071 layer->SetShouldFlattenTransform(false); |
| 2098 layer->SetIs3dSorted(true); | 2072 layer->SetIs3dSorted(true); |
| 2099 this->CalcDrawEtc(parent); | 2073 this->CalcDrawEtc(parent); |
| 2100 | 2074 |
| 2101 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2075 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2102 typename Types::RenderSurfaceType> occlusion( | |
| 2103 gfx::Rect(0, 0, 1000, 1000)); | 2076 gfx::Rect(0, 0, 1000, 1000)); |
| 2104 | 2077 |
| 2105 // The |layer| is entirely behind the camera and should not occlude. | 2078 // The |layer| is entirely behind the camera and should not occlude. |
| 2106 this->VisitLayer(layer, &occlusion); | 2079 this->VisitLayer(layer, &occlusion); |
| 2107 this->EnterLayer(parent, &occlusion); | 2080 this->EnterLayer(parent, &occlusion); |
| 2108 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); | 2081 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); |
| 2109 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 2082 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
| 2110 } | 2083 } |
| 2111 }; | 2084 }; |
| 2112 | 2085 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2133 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); | 2106 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); |
| 2134 parent->SetMasksToBounds(true); | 2107 parent->SetMasksToBounds(true); |
| 2135 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( | 2108 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( |
| 2136 parent, transform, gfx::PointF(), gfx::Size(100, 100), true); | 2109 parent, transform, gfx::PointF(), gfx::Size(100, 100), true); |
| 2137 parent->SetShouldFlattenTransform(false); | 2110 parent->SetShouldFlattenTransform(false); |
| 2138 parent->SetIs3dSorted(true); | 2111 parent->SetIs3dSorted(true); |
| 2139 layer->SetShouldFlattenTransform(false); | 2112 layer->SetShouldFlattenTransform(false); |
| 2140 layer->SetIs3dSorted(true); | 2113 layer->SetIs3dSorted(true); |
| 2141 this->CalcDrawEtc(parent); | 2114 this->CalcDrawEtc(parent); |
| 2142 | 2115 |
| 2143 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2116 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2144 typename Types::RenderSurfaceType> occlusion( | |
| 2145 gfx::Rect(0, 0, 1000, 1000)); | 2117 gfx::Rect(0, 0, 1000, 1000)); |
| 2146 | 2118 |
| 2147 // This is very close to the camera, so pixels in its visible_content_rect() | 2119 // This is very close to the camera, so pixels in its visible_content_rect() |
| 2148 // will actually go outside of the layer's clip rect. Ensure that those | 2120 // will actually go outside of the layer's clip rect. Ensure that those |
| 2149 // pixels don't occlude things outside the clip rect. | 2121 // pixels don't occlude things outside the clip rect. |
| 2150 this->VisitLayer(layer, &occlusion); | 2122 this->VisitLayer(layer, &occlusion); |
| 2151 this->EnterLayer(parent, &occlusion); | 2123 this->EnterLayer(parent, &occlusion); |
| 2152 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), | 2124 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), |
| 2153 occlusion.occlusion_from_inside_target().ToString()); | 2125 occlusion.occlusion_from_inside_target().ToString()); |
| 2154 EXPECT_EQ(gfx::Rect().ToString(), | 2126 EXPECT_EQ(gfx::Rect().ToString(), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 AddOpacityTransitionToController( | 2190 AddOpacityTransitionToController( |
| 2219 layer->layer_animation_controller(), 10.0, 0.f, 1.f, false); | 2191 layer->layer_animation_controller(), 10.0, 0.f, 1.f, false); |
| 2220 AddOpacityTransitionToController( | 2192 AddOpacityTransitionToController( |
| 2221 surface->layer_animation_controller(), 10.0, 0.f, 1.f, false); | 2193 surface->layer_animation_controller(), 10.0, 0.f, 1.f, false); |
| 2222 this->CalcDrawEtc(parent); | 2194 this->CalcDrawEtc(parent); |
| 2223 | 2195 |
| 2224 EXPECT_TRUE(layer->draw_opacity_is_animating()); | 2196 EXPECT_TRUE(layer->draw_opacity_is_animating()); |
| 2225 EXPECT_FALSE(surface->draw_opacity_is_animating()); | 2197 EXPECT_FALSE(surface->draw_opacity_is_animating()); |
| 2226 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); | 2198 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); |
| 2227 | 2199 |
| 2228 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2200 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2229 typename Types::RenderSurfaceType> occlusion( | |
| 2230 gfx::Rect(0, 0, 1000, 1000)); | 2201 gfx::Rect(0, 0, 1000, 1000)); |
| 2231 | 2202 |
| 2232 this->VisitLayer(topmost, &occlusion); | 2203 this->VisitLayer(topmost, &occlusion); |
| 2233 this->EnterLayer(parent2, &occlusion); | 2204 this->EnterLayer(parent2, &occlusion); |
| 2234 // This occlusion will affect all surfaces. | 2205 // This occlusion will affect all surfaces. |
| 2235 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), | 2206 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), |
| 2236 occlusion.occlusion_from_inside_target().ToString()); | 2207 occlusion.occlusion_from_inside_target().ToString()); |
| 2237 EXPECT_EQ(gfx::Rect().ToString(), | 2208 EXPECT_EQ(gfx::Rect().ToString(), |
| 2238 occlusion.occlusion_from_outside_target().ToString()); | 2209 occlusion.occlusion_from_outside_target().ToString()); |
| 2239 EXPECT_EQ(gfx::Rect(0, 0, 250, 300).ToString(), | 2210 EXPECT_EQ(gfx::Rect(0, 0, 250, 300).ToString(), |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2339 AddOpacityTransitionToController( | 2310 AddOpacityTransitionToController( |
| 2340 layer->layer_animation_controller(), 10.0, 1.f, 0.f, false); | 2311 layer->layer_animation_controller(), 10.0, 1.f, 0.f, false); |
| 2341 AddOpacityTransitionToController( | 2312 AddOpacityTransitionToController( |
| 2342 surface->layer_animation_controller(), 10.0, 1.f, 0.f, false); | 2313 surface->layer_animation_controller(), 10.0, 1.f, 0.f, false); |
| 2343 this->CalcDrawEtc(parent); | 2314 this->CalcDrawEtc(parent); |
| 2344 | 2315 |
| 2345 EXPECT_TRUE(layer->draw_opacity_is_animating()); | 2316 EXPECT_TRUE(layer->draw_opacity_is_animating()); |
| 2346 EXPECT_FALSE(surface->draw_opacity_is_animating()); | 2317 EXPECT_FALSE(surface->draw_opacity_is_animating()); |
| 2347 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); | 2318 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); |
| 2348 | 2319 |
| 2349 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2320 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2350 typename Types::RenderSurfaceType> occlusion( | |
| 2351 gfx::Rect(0, 0, 1000, 1000)); | 2321 gfx::Rect(0, 0, 1000, 1000)); |
| 2352 | 2322 |
| 2353 this->VisitLayer(topmost, &occlusion); | 2323 this->VisitLayer(topmost, &occlusion); |
| 2354 this->EnterLayer(parent2, &occlusion); | 2324 this->EnterLayer(parent2, &occlusion); |
| 2355 // This occlusion will affect all surfaces. | 2325 // This occlusion will affect all surfaces. |
| 2356 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), | 2326 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), |
| 2357 occlusion.occlusion_from_inside_target().ToString()); | 2327 occlusion.occlusion_from_inside_target().ToString()); |
| 2358 EXPECT_EQ(gfx::Rect().ToString(), | 2328 EXPECT_EQ(gfx::Rect().ToString(), |
| 2359 occlusion.occlusion_from_outside_target().ToString()); | 2329 occlusion.occlusion_from_outside_target().ToString()); |
| 2360 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), | 2330 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2461 EXPECT_TRUE( | 2431 EXPECT_TRUE( |
| 2462 surface->render_surface()->target_surface_transforms_are_animating()); | 2432 surface->render_surface()->target_surface_transforms_are_animating()); |
| 2463 EXPECT_TRUE( | 2433 EXPECT_TRUE( |
| 2464 surface->render_surface()->screen_space_transforms_are_animating()); | 2434 surface->render_surface()->screen_space_transforms_are_animating()); |
| 2465 // The surface owning layer doesn't animate against its own surface. | 2435 // The surface owning layer doesn't animate against its own surface. |
| 2466 EXPECT_FALSE(surface->draw_transform_is_animating()); | 2436 EXPECT_FALSE(surface->draw_transform_is_animating()); |
| 2467 EXPECT_TRUE(surface->screen_space_transform_is_animating()); | 2437 EXPECT_TRUE(surface->screen_space_transform_is_animating()); |
| 2468 EXPECT_TRUE(surface_child->draw_transform_is_animating()); | 2438 EXPECT_TRUE(surface_child->draw_transform_is_animating()); |
| 2469 EXPECT_TRUE(surface_child->screen_space_transform_is_animating()); | 2439 EXPECT_TRUE(surface_child->screen_space_transform_is_animating()); |
| 2470 | 2440 |
| 2471 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2441 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2472 typename Types::RenderSurfaceType> occlusion( | |
| 2473 gfx::Rect(0, 0, 1000, 1000)); | 2442 gfx::Rect(0, 0, 1000, 1000)); |
| 2474 | 2443 |
| 2475 this->VisitLayer(surface2, &occlusion); | 2444 this->VisitLayer(surface2, &occlusion); |
| 2476 this->EnterContributingSurface(surface2, &occlusion); | 2445 this->EnterContributingSurface(surface2, &occlusion); |
| 2477 | 2446 |
| 2478 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), | 2447 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), |
| 2479 occlusion.occlusion_from_inside_target().ToString()); | 2448 occlusion.occlusion_from_inside_target().ToString()); |
| 2480 | 2449 |
| 2481 this->LeaveContributingSurface(surface2, &occlusion); | 2450 this->LeaveContributingSurface(surface2, &occlusion); |
| 2482 this->EnterLayer(surface_child2, &occlusion); | 2451 this->EnterLayer(surface_child2, &occlusion); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2583 typename Types::ContentLayerType* surface2 = | 2552 typename Types::ContentLayerType* surface2 = |
| 2584 this->CreateDrawingSurface(parent, | 2553 this->CreateDrawingSurface(parent, |
| 2585 this->identity_matrix, | 2554 this->identity_matrix, |
| 2586 gfx::PointF(50.f, 50.f), | 2555 gfx::PointF(50.f, 50.f), |
| 2587 gfx::Size(300, 300), | 2556 gfx::Size(300, 300), |
| 2588 false); | 2557 false); |
| 2589 surface->SetOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); | 2558 surface->SetOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); |
| 2590 surface2->SetOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); | 2559 surface2->SetOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); |
| 2591 this->CalcDrawEtc(parent); | 2560 this->CalcDrawEtc(parent); |
| 2592 | 2561 |
| 2593 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2562 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2594 typename Types::RenderSurfaceType> occlusion( | |
| 2595 gfx::Rect(0, 0, 1000, 1000)); | 2563 gfx::Rect(0, 0, 1000, 1000)); |
| 2596 | 2564 |
| 2597 this->VisitLayer(surface2, &occlusion); | 2565 this->VisitLayer(surface2, &occlusion); |
| 2598 this->VisitContributingSurface(surface2, &occlusion); | 2566 this->VisitContributingSurface(surface2, &occlusion); |
| 2599 | 2567 |
| 2600 EXPECT_EQ(gfx::Rect().ToString(), | 2568 EXPECT_EQ(gfx::Rect().ToString(), |
| 2601 occlusion.occlusion_from_outside_target().ToString()); | 2569 occlusion.occlusion_from_outside_target().ToString()); |
| 2602 EXPECT_EQ(gfx::Rect(50, 50, 200, 200).ToString(), | 2570 EXPECT_EQ(gfx::Rect(50, 50, 200, 200).ToString(), |
| 2603 occlusion.occlusion_from_inside_target().ToString()); | 2571 occlusion.occlusion_from_inside_target().ToString()); |
| 2604 | 2572 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2632 parent->SetMasksToBounds(true); | 2600 parent->SetMasksToBounds(true); |
| 2633 typename Types::ContentLayerType* surface = | 2601 typename Types::ContentLayerType* surface = |
| 2634 this->CreateDrawingSurface(parent, | 2602 this->CreateDrawingSurface(parent, |
| 2635 this->identity_matrix, | 2603 this->identity_matrix, |
| 2636 gfx::PointF(), | 2604 gfx::PointF(), |
| 2637 gfx::Size(500, 300), | 2605 gfx::Size(500, 300), |
| 2638 false); | 2606 false); |
| 2639 surface->SetOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); | 2607 surface->SetOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); |
| 2640 this->CalcDrawEtc(parent); | 2608 this->CalcDrawEtc(parent); |
| 2641 | 2609 |
| 2642 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2610 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2643 typename Types::RenderSurfaceType> occlusion( | |
| 2644 gfx::Rect(0, 0, 1000, 1000)); | 2611 gfx::Rect(0, 0, 1000, 1000)); |
| 2645 | 2612 |
| 2646 this->VisitLayer(surface, &occlusion); | 2613 this->VisitLayer(surface, &occlusion); |
| 2647 this->VisitContributingSurface(surface, &occlusion); | 2614 this->VisitContributingSurface(surface, &occlusion); |
| 2648 | 2615 |
| 2649 EXPECT_EQ(gfx::Rect().ToString(), | 2616 EXPECT_EQ(gfx::Rect().ToString(), |
| 2650 occlusion.occlusion_from_outside_target().ToString()); | 2617 occlusion.occlusion_from_outside_target().ToString()); |
| 2651 EXPECT_EQ(gfx::Rect(0, 0, 300, 200).ToString(), | 2618 EXPECT_EQ(gfx::Rect(0, 0, 300, 200).ToString(), |
| 2652 occlusion.occlusion_from_inside_target().ToString()); | 2619 occlusion.occlusion_from_inside_target().ToString()); |
| 2653 } | 2620 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2675 gfx::PointF(0.f, 100.f), | 2642 gfx::PointF(0.f, 100.f), |
| 2676 gfx::Size(100, 100)); | 2643 gfx::Size(100, 100)); |
| 2677 typename Types::LayerType* topmost = | 2644 typename Types::LayerType* topmost = |
| 2678 this->CreateDrawingLayer(parent, | 2645 this->CreateDrawingLayer(parent, |
| 2679 this->identity_matrix, | 2646 this->identity_matrix, |
| 2680 gfx::PointF(0.f, 100.f), | 2647 gfx::PointF(0.f, 100.f), |
| 2681 gfx::Size(100, 100), | 2648 gfx::Size(100, 100), |
| 2682 true); | 2649 true); |
| 2683 this->CalcDrawEtc(parent); | 2650 this->CalcDrawEtc(parent); |
| 2684 | 2651 |
| 2685 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2652 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2686 typename Types::RenderSurfaceType> occlusion( | |
| 2687 gfx::Rect(0, 0, 1000, 1000)); | 2653 gfx::Rect(0, 0, 1000, 1000)); |
| 2688 | 2654 |
| 2689 // |topmost| occludes the replica, but not the surface itself. | 2655 // |topmost| occludes the replica, but not the surface itself. |
| 2690 this->VisitLayer(topmost, &occlusion); | 2656 this->VisitLayer(topmost, &occlusion); |
| 2691 | 2657 |
| 2692 EXPECT_EQ(gfx::Rect().ToString(), | 2658 EXPECT_EQ(gfx::Rect().ToString(), |
| 2693 occlusion.occlusion_from_outside_target().ToString()); | 2659 occlusion.occlusion_from_outside_target().ToString()); |
| 2694 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), | 2660 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), |
| 2695 occlusion.occlusion_from_inside_target().ToString()); | 2661 occlusion.occlusion_from_inside_target().ToString()); |
| 2696 | 2662 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2733 gfx::PointF(0.f, 100.f), | 2699 gfx::PointF(0.f, 100.f), |
| 2734 gfx::Size(100, 100)); | 2700 gfx::Size(100, 100)); |
| 2735 typename Types::LayerType* topmost = | 2701 typename Types::LayerType* topmost = |
| 2736 this->CreateDrawingLayer(parent, | 2702 this->CreateDrawingLayer(parent, |
| 2737 this->identity_matrix, | 2703 this->identity_matrix, |
| 2738 gfx::PointF(), | 2704 gfx::PointF(), |
| 2739 gfx::Size(100, 110), | 2705 gfx::Size(100, 110), |
| 2740 true); | 2706 true); |
| 2741 this->CalcDrawEtc(parent); | 2707 this->CalcDrawEtc(parent); |
| 2742 | 2708 |
| 2743 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2709 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2744 typename Types::RenderSurfaceType> occlusion( | |
| 2745 gfx::Rect(0, 0, 1000, 1000)); | 2710 gfx::Rect(0, 0, 1000, 1000)); |
| 2746 | 2711 |
| 2747 // |topmost| occludes the surface, but not the entire surface's replica. | 2712 // |topmost| occludes the surface, but not the entire surface's replica. |
| 2748 this->VisitLayer(topmost, &occlusion); | 2713 this->VisitLayer(topmost, &occlusion); |
| 2749 | 2714 |
| 2750 EXPECT_EQ(gfx::Rect().ToString(), | 2715 EXPECT_EQ(gfx::Rect().ToString(), |
| 2751 occlusion.occlusion_from_outside_target().ToString()); | 2716 occlusion.occlusion_from_outside_target().ToString()); |
| 2752 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), | 2717 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), |
| 2753 occlusion.occlusion_from_inside_target().ToString()); | 2718 occlusion.occlusion_from_inside_target().ToString()); |
| 2754 | 2719 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2797 typename Types::LayerType* over_surface = this->CreateDrawingLayer( | 2762 typename Types::LayerType* over_surface = this->CreateDrawingLayer( |
| 2798 parent, this->identity_matrix, gfx::PointF(), gfx::Size(40, 100), true); | 2763 parent, this->identity_matrix, gfx::PointF(), gfx::Size(40, 100), true); |
| 2799 typename Types::LayerType* over_replica = | 2764 typename Types::LayerType* over_replica = |
| 2800 this->CreateDrawingLayer(parent, | 2765 this->CreateDrawingLayer(parent, |
| 2801 this->identity_matrix, | 2766 this->identity_matrix, |
| 2802 gfx::PointF(0.f, 100.f), | 2767 gfx::PointF(0.f, 100.f), |
| 2803 gfx::Size(50, 100), | 2768 gfx::Size(50, 100), |
| 2804 true); | 2769 true); |
| 2805 this->CalcDrawEtc(parent); | 2770 this->CalcDrawEtc(parent); |
| 2806 | 2771 |
| 2807 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2772 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2808 typename Types::RenderSurfaceType> occlusion( | |
| 2809 gfx::Rect(0, 0, 1000, 1000)); | 2773 gfx::Rect(0, 0, 1000, 1000)); |
| 2810 | 2774 |
| 2811 // These occlude the surface and replica differently, so we can test each | 2775 // These occlude the surface and replica differently, so we can test each |
| 2812 // one. | 2776 // one. |
| 2813 this->VisitLayer(over_replica, &occlusion); | 2777 this->VisitLayer(over_replica, &occlusion); |
| 2814 this->VisitLayer(over_surface, &occlusion); | 2778 this->VisitLayer(over_surface, &occlusion); |
| 2815 | 2779 |
| 2816 EXPECT_EQ(gfx::Rect().ToString(), | 2780 EXPECT_EQ(gfx::Rect().ToString(), |
| 2817 occlusion.occlusion_from_outside_target().ToString()); | 2781 occlusion.occlusion_from_outside_target().ToString()); |
| 2818 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 100)) | 2782 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 100)) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2863 typename Types::LayerType* surface_child = | 2827 typename Types::LayerType* surface_child = |
| 2864 this->CreateDrawingSurface(surface, | 2828 this->CreateDrawingSurface(surface, |
| 2865 this->identity_matrix, | 2829 this->identity_matrix, |
| 2866 gfx::PointF(0.f, 10.f), | 2830 gfx::PointF(0.f, 10.f), |
| 2867 gfx::Size(100, 50), | 2831 gfx::Size(100, 50), |
| 2868 true); | 2832 true); |
| 2869 typename Types::LayerType* topmost = this->CreateDrawingLayer( | 2833 typename Types::LayerType* topmost = this->CreateDrawingLayer( |
| 2870 parent, this->identity_matrix, gfx::PointF(), gfx::Size(100, 50), true); | 2834 parent, this->identity_matrix, gfx::PointF(), gfx::Size(100, 50), true); |
| 2871 this->CalcDrawEtc(parent); | 2835 this->CalcDrawEtc(parent); |
| 2872 | 2836 |
| 2873 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2837 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2874 typename Types::RenderSurfaceType> occlusion( | |
| 2875 gfx::Rect(-100, -100, 1000, 1000)); | 2838 gfx::Rect(-100, -100, 1000, 1000)); |
| 2876 | 2839 |
| 2877 // |topmost| occludes everything partially so we know occlusion is happening | 2840 // |topmost| occludes everything partially so we know occlusion is happening |
| 2878 // at all. | 2841 // at all. |
| 2879 this->VisitLayer(topmost, &occlusion); | 2842 this->VisitLayer(topmost, &occlusion); |
| 2880 | 2843 |
| 2881 EXPECT_EQ(gfx::Rect().ToString(), | 2844 EXPECT_EQ(gfx::Rect().ToString(), |
| 2882 occlusion.occlusion_from_outside_target().ToString()); | 2845 occlusion.occlusion_from_outside_target().ToString()); |
| 2883 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), | 2846 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), |
| 2884 occlusion.occlusion_from_inside_target().ToString()); | 2847 occlusion.occlusion_from_inside_target().ToString()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2941 this->identity_matrix, gfx::PointF(), gfx::Size(100, 200)); | 2904 this->identity_matrix, gfx::PointF(), gfx::Size(100, 200)); |
| 2942 typename Types::LayerType* surface = | 2905 typename Types::LayerType* surface = |
| 2943 this->CreateDrawingSurface(parent, | 2906 this->CreateDrawingSurface(parent, |
| 2944 this->identity_matrix, | 2907 this->identity_matrix, |
| 2945 gfx::PointF(), | 2908 gfx::PointF(), |
| 2946 gfx::Size(100, 300), | 2909 gfx::Size(100, 300), |
| 2947 true); | 2910 true); |
| 2948 this->CalcDrawEtc(parent); | 2911 this->CalcDrawEtc(parent); |
| 2949 { | 2912 { |
| 2950 // Make a viewport rect that is larger than the root layer. | 2913 // Make a viewport rect that is larger than the root layer. |
| 2951 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2914 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2952 typename Types::RenderSurfaceType> occlusion( | |
| 2953 gfx::Rect(0, 0, 1000, 1000)); | 2915 gfx::Rect(0, 0, 1000, 1000)); |
| 2954 | 2916 |
| 2955 this->VisitLayer(surface, &occlusion); | 2917 this->VisitLayer(surface, &occlusion); |
| 2956 | 2918 |
| 2957 // The root layer always has a clip rect. So the parent of |surface| has a | 2919 // The root layer always has a clip rect. So the parent of |surface| has a |
| 2958 // clip rect giving the surface itself a clip rect. | 2920 // clip rect giving the surface itself a clip rect. |
| 2959 this->EnterContributingSurface(surface, &occlusion); | 2921 this->EnterContributingSurface(surface, &occlusion); |
| 2960 // Make sure the parent's clip rect clips the unoccluded region of the | 2922 // Make sure the parent's clip rect clips the unoccluded region of the |
| 2961 // child surface. | 2923 // child surface. |
| 2962 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), | 2924 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), |
| 2963 occlusion.UnoccludedContributingSurfaceContentRect( | 2925 occlusion.UnoccludedContributingSurfaceContentRect( |
| 2964 surface, false, gfx::Rect(0, 0, 100, 300))); | 2926 surface, false, gfx::Rect(0, 0, 100, 300))); |
| 2965 } | 2927 } |
| 2966 this->ResetLayerIterator(); | 2928 this->ResetLayerIterator(); |
| 2967 { | 2929 { |
| 2968 // Make a viewport rect that is smaller than the root layer. | 2930 // Make a viewport rect that is smaller than the root layer. |
| 2969 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2931 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 2970 typename Types::RenderSurfaceType> occlusion( | |
| 2971 gfx::Rect(0, 0, 100, 100)); | 2932 gfx::Rect(0, 0, 100, 100)); |
| 2972 | 2933 |
| 2973 this->VisitLayer(surface, &occlusion); | 2934 this->VisitLayer(surface, &occlusion); |
| 2974 | 2935 |
| 2975 // The root layer always has a clip rect. So the parent of |surface| has a | 2936 // The root layer always has a clip rect. So the parent of |surface| has a |
| 2976 // clip rect giving the surface itself a clip rect. | 2937 // clip rect giving the surface itself a clip rect. |
| 2977 this->EnterContributingSurface(surface, &occlusion); | 2938 this->EnterContributingSurface(surface, &occlusion); |
| 2978 // Make sure the viewport rect clips the unoccluded region of the child | 2939 // Make sure the viewport rect clips the unoccluded region of the child |
| 2979 // surface. | 2940 // surface. |
| 2980 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), | 2941 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3009 typename Types::LayerType* surface_child = | 2970 typename Types::LayerType* surface_child = |
| 3010 this->CreateDrawingSurface(surface, | 2971 this->CreateDrawingSurface(surface, |
| 3011 this->identity_matrix, | 2972 this->identity_matrix, |
| 3012 gfx::PointF(), | 2973 gfx::PointF(), |
| 3013 gfx::Size(100, 100), | 2974 gfx::Size(100, 100), |
| 3014 false); | 2975 false); |
| 3015 typename Types::LayerType* topmost = this->CreateDrawingLayer( | 2976 typename Types::LayerType* topmost = this->CreateDrawingLayer( |
| 3016 parent, this->identity_matrix, gfx::PointF(), gfx::Size(100, 50), true); | 2977 parent, this->identity_matrix, gfx::PointF(), gfx::Size(100, 50), true); |
| 3017 this->CalcDrawEtc(parent); | 2978 this->CalcDrawEtc(parent); |
| 3018 | 2979 |
| 3019 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2980 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3020 typename Types::RenderSurfaceType> occlusion( | |
| 3021 gfx::Rect(0, 0, 1000, 1000)); | 2981 gfx::Rect(0, 0, 1000, 1000)); |
| 3022 | 2982 |
| 3023 // |topmost| occludes everything partially so we know occlusion is happening | 2983 // |topmost| occludes everything partially so we know occlusion is happening |
| 3024 // at all. | 2984 // at all. |
| 3025 this->VisitLayer(topmost, &occlusion); | 2985 this->VisitLayer(topmost, &occlusion); |
| 3026 | 2986 |
| 3027 EXPECT_EQ(gfx::Rect().ToString(), | 2987 EXPECT_EQ(gfx::Rect().ToString(), |
| 3028 occlusion.occlusion_from_outside_target().ToString()); | 2988 occlusion.occlusion_from_outside_target().ToString()); |
| 3029 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), | 2989 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), |
| 3030 occlusion.occlusion_from_inside_target().ToString()); | 2990 occlusion.occlusion_from_inside_target().ToString()); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3113 filters.Append(FilterOperation::CreateBlurFilter(10.f)); | 3073 filters.Append(FilterOperation::CreateBlurFilter(10.f)); |
| 3114 filtered_surface->SetBackgroundFilters(filters); | 3074 filtered_surface->SetBackgroundFilters(filters); |
| 3115 | 3075 |
| 3116 // Save the distance of influence for the blur effect. | 3076 // Save the distance of influence for the blur effect. |
| 3117 int outset_top, outset_right, outset_bottom, outset_left; | 3077 int outset_top, outset_right, outset_bottom, outset_left; |
| 3118 filters.GetOutsets( | 3078 filters.GetOutsets( |
| 3119 &outset_top, &outset_right, &outset_bottom, &outset_left); | 3079 &outset_top, &outset_right, &outset_bottom, &outset_left); |
| 3120 | 3080 |
| 3121 this->CalcDrawEtc(parent); | 3081 this->CalcDrawEtc(parent); |
| 3122 | 3082 |
| 3123 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3083 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3124 typename Types::RenderSurfaceType> occlusion( | |
| 3125 gfx::Rect(0, 0, 1000, 1000)); | 3084 gfx::Rect(0, 0, 1000, 1000)); |
| 3126 | 3085 |
| 3127 // These layers occlude pixels directly beside the filtered_surface. Because | 3086 // These layers occlude pixels directly beside the filtered_surface. Because |
| 3128 // filtered surface blends pixels in a radius, it will need to see some of | 3087 // filtered surface blends pixels in a radius, it will need to see some of |
| 3129 // the pixels (up to radius far) underneath the occluding layers. | 3088 // the pixels (up to radius far) underneath the occluding layers. |
| 3130 this->VisitLayer(occluding_layer4, &occlusion); | 3089 this->VisitLayer(occluding_layer4, &occlusion); |
| 3131 this->VisitLayer(occluding_layer3, &occlusion); | 3090 this->VisitLayer(occluding_layer3, &occlusion); |
| 3132 this->VisitLayer(occluding_layer2, &occlusion); | 3091 this->VisitLayer(occluding_layer2, &occlusion); |
| 3133 this->VisitLayer(occluding_layer1, &occlusion); | 3092 this->VisitLayer(occluding_layer1, &occlusion); |
| 3134 | 3093 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3257 filtered_surface1->SetBackgroundFilters(filters); | 3216 filtered_surface1->SetBackgroundFilters(filters); |
| 3258 filtered_surface2->SetBackgroundFilters(filters); | 3217 filtered_surface2->SetBackgroundFilters(filters); |
| 3259 | 3218 |
| 3260 // Save the distance of influence for the blur effect. | 3219 // Save the distance of influence for the blur effect. |
| 3261 int outset_top, outset_right, outset_bottom, outset_left; | 3220 int outset_top, outset_right, outset_bottom, outset_left; |
| 3262 filters.GetOutsets( | 3221 filters.GetOutsets( |
| 3263 &outset_top, &outset_right, &outset_bottom, &outset_left); | 3222 &outset_top, &outset_right, &outset_bottom, &outset_left); |
| 3264 | 3223 |
| 3265 this->CalcDrawEtc(root); | 3224 this->CalcDrawEtc(root); |
| 3266 | 3225 |
| 3267 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3226 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3268 typename Types::RenderSurfaceType> occlusion( | |
| 3269 gfx::Rect(0, 0, 1000, 1000)); | 3227 gfx::Rect(0, 0, 1000, 1000)); |
| 3270 | 3228 |
| 3271 this->VisitLayer(occluding_layer_above, &occlusion); | 3229 this->VisitLayer(occluding_layer_above, &occlusion); |
| 3272 EXPECT_EQ(gfx::Rect().ToString(), | 3230 EXPECT_EQ(gfx::Rect().ToString(), |
| 3273 occlusion.occlusion_from_outside_target().ToString()); | 3231 occlusion.occlusion_from_outside_target().ToString()); |
| 3274 EXPECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2).ToString(), | 3232 EXPECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2).ToString(), |
| 3275 occlusion.occlusion_from_inside_target().ToString()); | 3233 occlusion.occlusion_from_inside_target().ToString()); |
| 3276 | 3234 |
| 3277 this->VisitLayer(filtered_surface2, &occlusion); | 3235 this->VisitLayer(filtered_surface2, &occlusion); |
| 3278 this->VisitContributingSurface(filtered_surface2, &occlusion); | 3236 this->VisitContributingSurface(filtered_surface2, &occlusion); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3338 gfx::PointF(300.f, 0.f), | 3296 gfx::PointF(300.f, 0.f), |
| 3339 gfx::Size()); | 3297 gfx::Size()); |
| 3340 | 3298 |
| 3341 // Filters make the layer own a surface. | 3299 // Filters make the layer own a surface. |
| 3342 FilterOperations filters; | 3300 FilterOperations filters; |
| 3343 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 3301 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
| 3344 filtered_surface->SetBackgroundFilters(filters); | 3302 filtered_surface->SetBackgroundFilters(filters); |
| 3345 | 3303 |
| 3346 this->CalcDrawEtc(parent); | 3304 this->CalcDrawEtc(parent); |
| 3347 | 3305 |
| 3348 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3306 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3349 typename Types::RenderSurfaceType> occlusion( | |
| 3350 gfx::Rect(0, 0, 1000, 1000)); | 3307 gfx::Rect(0, 0, 1000, 1000)); |
| 3351 | 3308 |
| 3352 // The surface has a background blur, so it blurs non-opaque pixels below | 3309 // The surface has a background blur, so it blurs non-opaque pixels below |
| 3353 // it. | 3310 // it. |
| 3354 this->VisitLayer(filtered_surface, &occlusion); | 3311 this->VisitLayer(filtered_surface, &occlusion); |
| 3355 this->VisitContributingSurface(filtered_surface, &occlusion); | 3312 this->VisitContributingSurface(filtered_surface, &occlusion); |
| 3356 | 3313 |
| 3357 this->VisitLayer(behind_replica_layer, &occlusion); | 3314 this->VisitLayer(behind_replica_layer, &occlusion); |
| 3358 this->VisitLayer(behind_surface_layer, &occlusion); | 3315 this->VisitLayer(behind_surface_layer, &occlusion); |
| 3359 | 3316 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3406 gfx::Size(50, 50), | 3363 gfx::Size(50, 50), |
| 3407 true); | 3364 true); |
| 3408 | 3365 |
| 3409 // Filters make the layer own a surface. | 3366 // Filters make the layer own a surface. |
| 3410 FilterOperations filters; | 3367 FilterOperations filters; |
| 3411 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 3368 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
| 3412 filtered_surface->SetBackgroundFilters(filters); | 3369 filtered_surface->SetBackgroundFilters(filters); |
| 3413 | 3370 |
| 3414 this->CalcDrawEtc(parent); | 3371 this->CalcDrawEtc(parent); |
| 3415 | 3372 |
| 3416 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3373 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3417 typename Types::RenderSurfaceType> occlusion( | |
| 3418 gfx::Rect(0, 0, 1000, 1000)); | 3374 gfx::Rect(0, 0, 1000, 1000)); |
| 3419 | 3375 |
| 3420 this->VisitLayer(occluding_layer, &occlusion); | 3376 this->VisitLayer(occluding_layer, &occlusion); |
| 3421 | 3377 |
| 3422 this->VisitLayer(filtered_surface, &occlusion); | 3378 this->VisitLayer(filtered_surface, &occlusion); |
| 3423 { | 3379 { |
| 3424 // The layers above the filtered surface occlude from outside. | 3380 // The layers above the filtered surface occlude from outside. |
| 3425 gfx::Rect occlusion_above_surface = gfx::Rect(0, 0, 50, 50); | 3381 gfx::Rect occlusion_above_surface = gfx::Rect(0, 0, 50, 50); |
| 3426 | 3382 |
| 3427 EXPECT_EQ(gfx::Rect().ToString(), | 3383 EXPECT_EQ(gfx::Rect().ToString(), |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3508 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 3464 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
| 3509 filtered_surface->SetBackgroundFilters(filters); | 3465 filtered_surface->SetBackgroundFilters(filters); |
| 3510 | 3466 |
| 3511 // Save the distance of influence for the blur effect. | 3467 // Save the distance of influence for the blur effect. |
| 3512 int outset_top, outset_right, outset_bottom, outset_left; | 3468 int outset_top, outset_right, outset_bottom, outset_left; |
| 3513 filters.GetOutsets( | 3469 filters.GetOutsets( |
| 3514 &outset_top, &outset_right, &outset_bottom, &outset_left); | 3470 &outset_top, &outset_right, &outset_bottom, &outset_left); |
| 3515 | 3471 |
| 3516 this->CalcDrawEtc(parent); | 3472 this->CalcDrawEtc(parent); |
| 3517 | 3473 |
| 3518 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3474 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3519 typename Types::RenderSurfaceType> occlusion( | |
| 3520 gfx::Rect(0, 0, 1000, 1000)); | 3475 gfx::Rect(0, 0, 1000, 1000)); |
| 3521 | 3476 |
| 3522 this->VisitLayer(beside_replica_layer, &occlusion); | 3477 this->VisitLayer(beside_replica_layer, &occlusion); |
| 3523 this->VisitLayer(beside_surface_layer, &occlusion); | 3478 this->VisitLayer(beside_surface_layer, &occlusion); |
| 3524 this->VisitLayer(above_replica_layer, &occlusion); | 3479 this->VisitLayer(above_replica_layer, &occlusion); |
| 3525 this->VisitLayer(above_surface_layer, &occlusion); | 3480 this->VisitLayer(above_surface_layer, &occlusion); |
| 3526 | 3481 |
| 3527 // The surface has a background blur, so it blurs non-opaque pixels below | 3482 // The surface has a background blur, so it blurs non-opaque pixels below |
| 3528 // it. | 3483 // it. |
| 3529 this->VisitLayer(filtered_surface, &occlusion); | 3484 this->VisitLayer(filtered_surface, &occlusion); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3582 typename Types::LayerType* large = this->CreateDrawingLayer( | 3537 typename Types::LayerType* large = this->CreateDrawingLayer( |
| 3583 parent, this->identity_matrix, gfx::PointF(), tracking_size, true); | 3538 parent, this->identity_matrix, gfx::PointF(), tracking_size, true); |
| 3584 typename Types::LayerType* small = | 3539 typename Types::LayerType* small = |
| 3585 this->CreateDrawingLayer(parent, | 3540 this->CreateDrawingLayer(parent, |
| 3586 this->identity_matrix, | 3541 this->identity_matrix, |
| 3587 gfx::PointF(), | 3542 gfx::PointF(), |
| 3588 below_tracking_size, | 3543 below_tracking_size, |
| 3589 true); | 3544 true); |
| 3590 this->CalcDrawEtc(parent); | 3545 this->CalcDrawEtc(parent); |
| 3591 | 3546 |
| 3592 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3547 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3593 typename Types::RenderSurfaceType> occlusion( | |
| 3594 gfx::Rect(0, 0, 1000, 1000)); | 3548 gfx::Rect(0, 0, 1000, 1000)); |
| 3595 occlusion.set_minimum_tracking_size(tracking_size); | 3549 occlusion.set_minimum_tracking_size(tracking_size); |
| 3596 | 3550 |
| 3597 // The small layer is not tracked because it is too small. | 3551 // The small layer is not tracked because it is too small. |
| 3598 this->VisitLayer(small, &occlusion); | 3552 this->VisitLayer(small, &occlusion); |
| 3599 | 3553 |
| 3600 EXPECT_EQ(gfx::Rect().ToString(), | 3554 EXPECT_EQ(gfx::Rect().ToString(), |
| 3601 occlusion.occlusion_from_outside_target().ToString()); | 3555 occlusion.occlusion_from_outside_target().ToString()); |
| 3602 EXPECT_EQ(gfx::Rect().ToString(), | 3556 EXPECT_EQ(gfx::Rect().ToString(), |
| 3603 occlusion.occlusion_from_inside_target().ToString()); | 3557 occlusion.occlusion_from_inside_target().ToString()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3630 this->identity_matrix, | 3584 this->identity_matrix, |
| 3631 gfx::PointF(10.f, 10.f), | 3585 gfx::PointF(10.f, 10.f), |
| 3632 gfx::Size(50, 50)); | 3586 gfx::Size(50, 50)); |
| 3633 clip->SetMasksToBounds(true); | 3587 clip->SetMasksToBounds(true); |
| 3634 typename Types::LayerType* scale = this->CreateLayer( | 3588 typename Types::LayerType* scale = this->CreateLayer( |
| 3635 clip, scale_transform, gfx::PointF(), gfx::Size(1, 1)); | 3589 clip, scale_transform, gfx::PointF(), gfx::Size(1, 1)); |
| 3636 typename Types::LayerType* scaled = this->CreateDrawingLayer( | 3590 typename Types::LayerType* scaled = this->CreateDrawingLayer( |
| 3637 scale, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500), true); | 3591 scale, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500), true); |
| 3638 this->CalcDrawEtc(parent); | 3592 this->CalcDrawEtc(parent); |
| 3639 | 3593 |
| 3640 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3594 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3641 typename Types::RenderSurfaceType> occlusion( | |
| 3642 gfx::Rect(0, 0, 1000, 1000)); | 3595 gfx::Rect(0, 0, 1000, 1000)); |
| 3643 | 3596 |
| 3644 this->VisitLayer(scaled, &occlusion); | 3597 this->VisitLayer(scaled, &occlusion); |
| 3645 | 3598 |
| 3646 EXPECT_EQ(gfx::Rect().ToString(), | 3599 EXPECT_EQ(gfx::Rect().ToString(), |
| 3647 occlusion.occlusion_from_outside_target().ToString()); | 3600 occlusion.occlusion_from_outside_target().ToString()); |
| 3648 EXPECT_EQ(gfx::Rect(10, 10, 50, 50).ToString(), | 3601 EXPECT_EQ(gfx::Rect(10, 10, 50, 50).ToString(), |
| 3649 occlusion.occlusion_from_inside_target().ToString()); | 3602 occlusion.occlusion_from_inside_target().ToString()); |
| 3650 } | 3603 } |
| 3651 }; | 3604 }; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3670 gfx::Size(50, 50)); | 3623 gfx::Size(50, 50)); |
| 3671 clip->SetMasksToBounds(true); | 3624 clip->SetMasksToBounds(true); |
| 3672 typename Types::LayerType* surface = this->CreateDrawingSurface( | 3625 typename Types::LayerType* surface = this->CreateDrawingSurface( |
| 3673 clip, this->identity_matrix, gfx::PointF(), gfx::Size(400, 30), false); | 3626 clip, this->identity_matrix, gfx::PointF(), gfx::Size(400, 30), false); |
| 3674 typename Types::LayerType* scale = this->CreateLayer( | 3627 typename Types::LayerType* scale = this->CreateLayer( |
| 3675 surface, scale_transform, gfx::PointF(), gfx::Size(1, 1)); | 3628 surface, scale_transform, gfx::PointF(), gfx::Size(1, 1)); |
| 3676 typename Types::LayerType* scaled = this->CreateDrawingLayer( | 3629 typename Types::LayerType* scaled = this->CreateDrawingLayer( |
| 3677 scale, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500), true); | 3630 scale, this->identity_matrix, gfx::PointF(), gfx::Size(500, 500), true); |
| 3678 this->CalcDrawEtc(parent); | 3631 this->CalcDrawEtc(parent); |
| 3679 | 3632 |
| 3680 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3633 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3681 typename Types::RenderSurfaceType> occlusion( | |
| 3682 gfx::Rect(0, 0, 1000, 1000)); | 3634 gfx::Rect(0, 0, 1000, 1000)); |
| 3683 | 3635 |
| 3684 this->VisitLayer(scaled, &occlusion); | 3636 this->VisitLayer(scaled, &occlusion); |
| 3685 this->VisitLayer(surface, &occlusion); | 3637 this->VisitLayer(surface, &occlusion); |
| 3686 this->VisitContributingSurface(surface, &occlusion); | 3638 this->VisitContributingSurface(surface, &occlusion); |
| 3687 | 3639 |
| 3688 EXPECT_EQ(gfx::Rect().ToString(), | 3640 EXPECT_EQ(gfx::Rect().ToString(), |
| 3689 occlusion.occlusion_from_outside_target().ToString()); | 3641 occlusion.occlusion_from_outside_target().ToString()); |
| 3690 EXPECT_EQ(gfx::Rect(10, 10, 50, 50).ToString(), | 3642 EXPECT_EQ(gfx::Rect(10, 10, 50, 50).ToString(), |
| 3691 occlusion.occlusion_from_inside_target().ToString()); | 3643 occlusion.occlusion_from_inside_target().ToString()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3711 gfx::Size(200, 400)); | 3663 gfx::Size(200, 400)); |
| 3712 this->AddCopyRequest(copy); | 3664 this->AddCopyRequest(copy); |
| 3713 typename Types::LayerType* copy_child = this->CreateDrawingLayer( | 3665 typename Types::LayerType* copy_child = this->CreateDrawingLayer( |
| 3714 copy, | 3666 copy, |
| 3715 this->identity_matrix, | 3667 this->identity_matrix, |
| 3716 gfx::PointF(), | 3668 gfx::PointF(), |
| 3717 gfx::Size(200, 400), | 3669 gfx::Size(200, 400), |
| 3718 true); | 3670 true); |
| 3719 this->CalcDrawEtc(root); | 3671 this->CalcDrawEtc(root); |
| 3720 | 3672 |
| 3721 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3673 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3722 typename Types::RenderSurfaceType> occlusion( | |
| 3723 gfx::Rect(0, 0, 1000, 1000)); | 3674 gfx::Rect(0, 0, 1000, 1000)); |
| 3724 | 3675 |
| 3725 this->VisitLayer(copy_child, &occlusion); | 3676 this->VisitLayer(copy_child, &occlusion); |
| 3726 EXPECT_EQ(gfx::Rect().ToString(), | 3677 EXPECT_EQ(gfx::Rect().ToString(), |
| 3727 occlusion.occlusion_from_outside_target().ToString()); | 3678 occlusion.occlusion_from_outside_target().ToString()); |
| 3728 EXPECT_EQ(gfx::Rect(200, 400).ToString(), | 3679 EXPECT_EQ(gfx::Rect(200, 400).ToString(), |
| 3729 occlusion.occlusion_from_inside_target().ToString()); | 3680 occlusion.occlusion_from_inside_target().ToString()); |
| 3730 | 3681 |
| 3731 // CopyRequests cause the layer to own a surface. | 3682 // CopyRequests cause the layer to own a surface. |
| 3732 this->VisitContributingSurface(copy, &occlusion); | 3683 this->VisitContributingSurface(copy, &occlusion); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3760 this->AddCopyRequest(copy); | 3711 this->AddCopyRequest(copy); |
| 3761 typename Types::LayerType* copy_child = this->CreateDrawingLayer( | 3712 typename Types::LayerType* copy_child = this->CreateDrawingLayer( |
| 3762 copy, this->identity_matrix, gfx::PointF(), gfx::Size(200, 400), true); | 3713 copy, this->identity_matrix, gfx::PointF(), gfx::Size(200, 400), true); |
| 3763 | 3714 |
| 3764 // The |copy| layer is hidden but since it is being copied, it will be | 3715 // The |copy| layer is hidden but since it is being copied, it will be |
| 3765 // drawn. | 3716 // drawn. |
| 3766 hide->SetHideLayerAndSubtree(true); | 3717 hide->SetHideLayerAndSubtree(true); |
| 3767 | 3718 |
| 3768 this->CalcDrawEtc(root); | 3719 this->CalcDrawEtc(root); |
| 3769 | 3720 |
| 3770 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3721 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3771 typename Types::RenderSurfaceType> occlusion( | |
| 3772 gfx::Rect(0, 0, 1000, 1000)); | 3722 gfx::Rect(0, 0, 1000, 1000)); |
| 3773 | 3723 |
| 3774 this->VisitLayer(copy_child, &occlusion); | 3724 this->VisitLayer(copy_child, &occlusion); |
| 3775 EXPECT_EQ(gfx::Rect().ToString(), | 3725 EXPECT_EQ(gfx::Rect().ToString(), |
| 3776 occlusion.occlusion_from_outside_target().ToString()); | 3726 occlusion.occlusion_from_outside_target().ToString()); |
| 3777 EXPECT_EQ(gfx::Rect(200, 400).ToString(), | 3727 EXPECT_EQ(gfx::Rect(200, 400).ToString(), |
| 3778 occlusion.occlusion_from_inside_target().ToString()); | 3728 occlusion.occlusion_from_inside_target().ToString()); |
| 3779 | 3729 |
| 3780 // CopyRequests cause the layer to own a surface. | 3730 // CopyRequests cause the layer to own a surface. |
| 3781 this->VisitContributingSurface(copy, &occlusion); | 3731 this->VisitContributingSurface(copy, &occlusion); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3800 void RunMyTest() { | 3750 void RunMyTest() { |
| 3801 typename Types::ContentLayerType* root = this->CreateRoot( | 3751 typename Types::ContentLayerType* root = this->CreateRoot( |
| 3802 this->identity_matrix, gfx::Point(), gfx::Size(400, 400)); | 3752 this->identity_matrix, gfx::Point(), gfx::Size(400, 400)); |
| 3803 typename Types::ContentLayerType* empty_layer = this->CreateDrawingLayer( | 3753 typename Types::ContentLayerType* empty_layer = this->CreateDrawingLayer( |
| 3804 root, this->identity_matrix, gfx::Point(), gfx::Size(200, 200), true); | 3754 root, this->identity_matrix, gfx::Point(), gfx::Size(200, 200), true); |
| 3805 this->SetDrawsContent(empty_layer, false); | 3755 this->SetDrawsContent(empty_layer, false); |
| 3806 empty_layer->SetTouchEventHandlerRegion(gfx::Rect(10, 10, 10, 10)); | 3756 empty_layer->SetTouchEventHandlerRegion(gfx::Rect(10, 10, 10, 10)); |
| 3807 | 3757 |
| 3808 this->CalcDrawEtc(root); | 3758 this->CalcDrawEtc(root); |
| 3809 | 3759 |
| 3810 TestOcclusionTrackerWithClip<typename Types::LayerType, | 3760 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |
| 3811 typename Types::RenderSurfaceType> occlusion( | |
| 3812 gfx::Rect(0, 0, 1000, 1000), false); | 3761 gfx::Rect(0, 0, 1000, 1000), false); |
| 3813 | 3762 |
| 3814 this->VisitLayer(empty_layer, &occlusion); | 3763 this->VisitLayer(empty_layer, &occlusion); |
| 3815 | 3764 |
| 3816 EXPECT_EQ(gfx::Rect().ToString(), | 3765 EXPECT_EQ(gfx::Rect().ToString(), |
| 3817 occlusion.occlusion_from_outside_target().ToString()); | 3766 occlusion.occlusion_from_outside_target().ToString()); |
| 3818 EXPECT_EQ(gfx::Rect().ToString(), | 3767 EXPECT_EQ(gfx::Rect().ToString(), |
| 3819 occlusion.occlusion_from_inside_target().ToString()); | 3768 occlusion.occlusion_from_inside_target().ToString()); |
| 3820 } | 3769 } |
| 3821 }; | 3770 }; |
| 3822 | 3771 |
| 3823 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude) | 3772 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude) |
| 3824 | 3773 |
| 3825 } // namespace | 3774 } // namespace |
| 3826 } // namespace cc | 3775 } // namespace cc |
| OLD | NEW |