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" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 bool record_metrics_for_frame) | 87 bool record_metrics_for_frame) |
88 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>( | 88 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>( |
89 viewport_rect, | 89 viewport_rect, |
90 record_metrics_for_frame) {} | 90 record_metrics_for_frame) {} |
91 explicit TestOcclusionTrackerWithClip(gfx::Rect viewport_rect) | 91 explicit TestOcclusionTrackerWithClip(gfx::Rect viewport_rect) |
92 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewport_rect, | 92 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewport_rect, |
93 false) {} | 93 false) {} |
94 | 94 |
95 bool OccludedLayer(const LayerType* layer, | 95 bool OccludedLayer(const LayerType* layer, |
96 gfx::Rect content_rect) const { | 96 gfx::Rect content_rect) const { |
| 97 DCHECK(layer->visible_content_rect().Contains(content_rect)); |
97 return this->Occluded(layer->render_target(), | 98 return this->Occluded(layer->render_target(), |
98 content_rect, | 99 content_rect, |
99 layer->draw_transform(), | 100 layer->draw_transform(), |
100 LayerImplDrawTransformIsUnknown(layer), | 101 LayerImplDrawTransformIsUnknown(layer)); |
101 layer->is_clipped(), | |
102 layer->clip_rect()); | |
103 } | 102 } |
104 | 103 |
105 // Gives an unoccluded sub-rect of |content_rect| in the content space of the | 104 // Gives an unoccluded sub-rect of |content_rect| in the content space of the |
106 // layer. Simple wrapper around UnoccludedContentRect. | 105 // layer. Simple wrapper around UnoccludedContentRect. |
107 gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, | 106 gfx::Rect UnoccludedLayerContentRect(const LayerType* layer, |
108 gfx::Rect content_rect) const { | 107 gfx::Rect content_rect) const { |
| 108 DCHECK(layer->visible_content_rect().Contains(content_rect)); |
109 return this->UnoccludedContentRect( | 109 return this->UnoccludedContentRect( |
110 layer->render_target(), | 110 layer->render_target(), |
111 content_rect, | 111 content_rect, |
112 layer->draw_transform(), | 112 layer->draw_transform(), |
113 LayerImplDrawTransformIsUnknown(layer), | 113 LayerImplDrawTransformIsUnknown(layer)); |
114 layer->is_clipped(), | |
115 layer->clip_rect()); | |
116 } | 114 } |
117 }; | 115 }; |
118 | 116 |
119 struct OcclusionTrackerTestMainThreadTypes { | 117 struct OcclusionTrackerTestMainThreadTypes { |
120 typedef Layer LayerType; | 118 typedef Layer LayerType; |
121 typedef FakeLayerTreeHost HostType; | 119 typedef FakeLayerTreeHost HostType; |
122 typedef RenderSurface RenderSurfaceType; | 120 typedef RenderSurface RenderSurfaceType; |
123 typedef TestContentLayer ContentLayerType; | 121 typedef TestContentLayer ContentLayerType; |
124 typedef scoped_refptr<Layer> LayerPtrType; | 122 typedef scoped_refptr<Layer> LayerPtrType; |
125 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; | 123 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 this->EnterLayer(parent, &occlusion, false); | 553 this->EnterLayer(parent, &occlusion, false); |
556 | 554 |
557 EXPECT_EQ(gfx::Rect().ToString(), | 555 EXPECT_EQ(gfx::Rect().ToString(), |
558 occlusion.occlusion_from_outside_target().ToString()); | 556 occlusion.occlusion_from_outside_target().ToString()); |
559 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), | 557 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), |
560 occlusion.occlusion_from_inside_target().ToString()); | 558 occlusion.occlusion_from_inside_target().ToString()); |
561 | 559 |
562 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | 560 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 30, 70, 70))); |
563 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(29, 30, 70, 70))); | 561 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(29, 30, 70, 70))); |
564 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(30, 29, 70, 70))); | 562 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(30, 29, 70, 70))); |
565 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(31, 30, 70, 70))); | 563 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(31, 30, 69, 70))); |
566 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 31, 70, 70))); | 564 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 31, 70, 69))); |
567 | 565 |
568 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 566 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
569 parent, gfx::Rect(30, 30, 70, 70)).IsEmpty()); | 567 parent, gfx::Rect(30, 30, 70, 70)).IsEmpty()); |
570 EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), | 568 EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), |
571 occlusion.UnoccludedLayerContentRect( | 569 occlusion.UnoccludedLayerContentRect( |
572 parent, gfx::Rect(29, 30, 70, 70))); | 570 parent, gfx::Rect(29, 30, 70, 70))); |
573 EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), | 571 EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), |
574 occlusion.UnoccludedLayerContentRect( | 572 occlusion.UnoccludedLayerContentRect( |
575 parent, gfx::Rect(29, 29, 70, 70))); | 573 parent, gfx::Rect(29, 29, 70, 70))); |
576 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), | 574 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), |
577 occlusion.UnoccludedLayerContentRect( | 575 occlusion.UnoccludedLayerContentRect( |
578 parent, gfx::Rect(30, 29, 70, 70))); | 576 parent, gfx::Rect(30, 29, 70, 70))); |
579 EXPECT_RECT_EQ(gfx::Rect(31, 29, 69, 1), | 577 EXPECT_RECT_EQ(gfx::Rect(31, 29, 69, 1), |
580 occlusion.UnoccludedLayerContentRect( | 578 occlusion.UnoccludedLayerContentRect( |
581 parent, gfx::Rect(31, 29, 70, 70))); | 579 parent, gfx::Rect(31, 29, 69, 70))); |
582 EXPECT_RECT_EQ(gfx::Rect(), | 580 EXPECT_RECT_EQ(gfx::Rect(), |
583 occlusion.UnoccludedLayerContentRect( | 581 occlusion.UnoccludedLayerContentRect( |
584 parent, gfx::Rect(31, 30, 70, 70))); | 582 parent, gfx::Rect(31, 30, 69, 70))); |
585 EXPECT_RECT_EQ(gfx::Rect(), | 583 EXPECT_RECT_EQ(gfx::Rect(), |
586 occlusion.UnoccludedLayerContentRect( | 584 occlusion.UnoccludedLayerContentRect( |
587 parent, gfx::Rect(31, 31, 70, 70))); | 585 parent, gfx::Rect(31, 31, 69, 69))); |
588 EXPECT_RECT_EQ(gfx::Rect(), | 586 EXPECT_RECT_EQ(gfx::Rect(), |
589 occlusion.UnoccludedLayerContentRect( | 587 occlusion.UnoccludedLayerContentRect( |
590 parent, gfx::Rect(30, 31, 70, 70))); | 588 parent, gfx::Rect(30, 31, 70, 69))); |
591 EXPECT_RECT_EQ(gfx::Rect(29, 31, 1, 69), | 589 EXPECT_RECT_EQ(gfx::Rect(29, 31, 1, 69), |
592 occlusion.UnoccludedLayerContentRect( | 590 occlusion.UnoccludedLayerContentRect( |
593 parent, gfx::Rect(29, 31, 70, 70))); | 591 parent, gfx::Rect(29, 31, 70, 69))); |
594 } | 592 } |
595 }; | 593 }; |
596 | 594 |
597 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); | 595 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); |
598 | 596 |
599 template <class Types> | 597 template <class Types> |
600 class OcclusionTrackerTestQuadsMismatchLayer | 598 class OcclusionTrackerTestQuadsMismatchLayer |
601 : public OcclusionTrackerTest<Types> { | 599 : public OcclusionTrackerTest<Types> { |
602 protected: | 600 protected: |
603 explicit OcclusionTrackerTestQuadsMismatchLayer(bool opaque_layers) | 601 explicit OcclusionTrackerTestQuadsMismatchLayer(bool opaque_layers) |
(...skipping 21 matching lines...) Expand all Loading... |
625 occlusion.occlusion_from_outside_target().ToString()); | 623 occlusion.occlusion_from_outside_target().ToString()); |
626 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), | 624 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), |
627 occlusion.occlusion_from_inside_target().ToString()); | 625 occlusion.occlusion_from_inside_target().ToString()); |
628 | 626 |
629 // This checks cases where the quads don't match their "containing" | 627 // This checks cases where the quads don't match their "containing" |
630 // layers, e.g. in terms of transforms or clip rect. This is typical for | 628 // layers, e.g. in terms of transforms or clip rect. This is typical for |
631 // DelegatedRendererLayer. | 629 // DelegatedRendererLayer. |
632 | 630 |
633 gfx::Transform quad_transform; | 631 gfx::Transform quad_transform; |
634 quad_transform.Translate(30.0, 30.0); | 632 quad_transform.Translate(30.0, 30.0); |
635 gfx::Rect clip_rect_in_target(0, 0, 100, 100); | |
636 | 633 |
637 EXPECT_TRUE(occlusion.UnoccludedContentRect(parent, | 634 EXPECT_TRUE(occlusion.UnoccludedContentRect(parent, |
638 gfx::Rect(0, 0, 10, 10), | 635 gfx::Rect(0, 0, 10, 10), |
639 quad_transform, | 636 quad_transform, |
640 false, | 637 false).IsEmpty()); |
641 true, | |
642 clip_rect_in_target).IsEmpty()); | |
643 EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), | 638 EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), |
644 occlusion.UnoccludedContentRect(parent, | 639 occlusion.UnoccludedContentRect(parent, |
645 gfx::Rect(0, 0, 10, 10), | 640 gfx::Rect(0, 0, 10, 10), |
646 quad_transform, | 641 quad_transform, |
647 true, | 642 true)); |
648 true, | |
649 clip_rect_in_target)); | |
650 EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), | 643 EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), |
651 occlusion.UnoccludedContentRect(parent, | 644 occlusion.UnoccludedContentRect(parent, |
652 gfx::Rect(40, 40, 10, 10), | 645 gfx::Rect(40, 40, 10, 10), |
653 quad_transform, | 646 quad_transform, |
654 false, | 647 false)); |
655 true, | |
656 clip_rect_in_target)); | |
657 EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), | 648 EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), |
658 occlusion.UnoccludedContentRect(parent, | 649 occlusion.UnoccludedContentRect(parent, |
659 gfx::Rect(35, 30, 10, 10), | 650 gfx::Rect(35, 30, 10, 10), |
660 quad_transform, | 651 quad_transform, |
661 false, | 652 false)); |
662 true, | |
663 clip_rect_in_target)); | |
664 EXPECT_RECT_EQ(gfx::Rect(40, 40, 5, 5), | |
665 occlusion.UnoccludedContentRect(parent, | |
666 gfx::Rect(40, 40, 10, 10), | |
667 quad_transform, | |
668 false, | |
669 true, | |
670 gfx::Rect(0, 0, 75, 75))); | |
671 } | 653 } |
672 }; | 654 }; |
673 | 655 |
674 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestQuadsMismatchLayer); | 656 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestQuadsMismatchLayer); |
675 | 657 |
676 template <class Types> | 658 template <class Types> |
677 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { | 659 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { |
678 protected: | 660 protected: |
679 explicit OcclusionTrackerTestRotatedChild(bool opaque_layers) | 661 explicit OcclusionTrackerTestRotatedChild(bool opaque_layers) |
680 : OcclusionTrackerTest<Types>(opaque_layers) {} | 662 : OcclusionTrackerTest<Types>(opaque_layers) {} |
(...skipping 24 matching lines...) Expand all Loading... |
705 this->EnterLayer(parent, &occlusion, false); | 687 this->EnterLayer(parent, &occlusion, false); |
706 | 688 |
707 EXPECT_EQ(gfx::Rect().ToString(), | 689 EXPECT_EQ(gfx::Rect().ToString(), |
708 occlusion.occlusion_from_outside_target().ToString()); | 690 occlusion.occlusion_from_outside_target().ToString()); |
709 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), | 691 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), |
710 occlusion.occlusion_from_inside_target().ToString()); | 692 occlusion.occlusion_from_inside_target().ToString()); |
711 | 693 |
712 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | 694 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 30, 70, 70))); |
713 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(29, 30, 70, 70))); | 695 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(29, 30, 70, 70))); |
714 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(30, 29, 70, 70))); | 696 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(30, 29, 70, 70))); |
715 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(31, 30, 70, 70))); | 697 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(31, 30, 69, 70))); |
716 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 31, 70, 70))); | 698 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 31, 70, 69))); |
717 | 699 |
718 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 700 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
719 parent, gfx::Rect(30, 30, 70, 70)).IsEmpty()); | 701 parent, gfx::Rect(30, 30, 70, 70)).IsEmpty()); |
720 EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), | 702 EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), |
721 occlusion.UnoccludedLayerContentRect( | 703 occlusion.UnoccludedLayerContentRect( |
722 parent, gfx::Rect(29, 30, 70, 70))); | 704 parent, gfx::Rect(29, 30, 69, 70))); |
723 EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), | 705 EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), |
724 occlusion.UnoccludedLayerContentRect( | 706 occlusion.UnoccludedLayerContentRect( |
725 parent, gfx::Rect(29, 29, 70, 70))); | 707 parent, gfx::Rect(29, 29, 70, 70))); |
726 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), | 708 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), |
727 occlusion.UnoccludedLayerContentRect( | 709 occlusion.UnoccludedLayerContentRect( |
728 parent, gfx::Rect(30, 29, 70, 70))); | 710 parent, gfx::Rect(30, 29, 70, 70))); |
729 EXPECT_RECT_EQ(gfx::Rect(31, 29, 69, 1), | 711 EXPECT_RECT_EQ(gfx::Rect(31, 29, 69, 1), |
730 occlusion.UnoccludedLayerContentRect( | 712 occlusion.UnoccludedLayerContentRect( |
731 parent, gfx::Rect(31, 29, 70, 70))); | 713 parent, gfx::Rect(31, 29, 69, 70))); |
732 EXPECT_RECT_EQ(gfx::Rect(), | 714 EXPECT_RECT_EQ(gfx::Rect(), |
733 occlusion.UnoccludedLayerContentRect( | 715 occlusion.UnoccludedLayerContentRect( |
734 parent, gfx::Rect(31, 30, 70, 70))); | 716 parent, gfx::Rect(31, 30, 69, 70))); |
735 EXPECT_RECT_EQ(gfx::Rect(), | 717 EXPECT_RECT_EQ(gfx::Rect(), |
736 occlusion.UnoccludedLayerContentRect( | 718 occlusion.UnoccludedLayerContentRect( |
737 parent, gfx::Rect(31, 31, 70, 70))); | 719 parent, gfx::Rect(31, 31, 69, 69))); |
738 EXPECT_RECT_EQ(gfx::Rect(), | 720 EXPECT_RECT_EQ(gfx::Rect(), |
739 occlusion.UnoccludedLayerContentRect( | 721 occlusion.UnoccludedLayerContentRect( |
740 parent, gfx::Rect(30, 31, 70, 70))); | 722 parent, gfx::Rect(30, 31, 70, 69))); |
741 EXPECT_RECT_EQ(gfx::Rect(29, 31, 1, 69), | 723 EXPECT_RECT_EQ(gfx::Rect(29, 31, 1, 69), |
742 occlusion.UnoccludedLayerContentRect( | 724 occlusion.UnoccludedLayerContentRect( |
743 parent, gfx::Rect(29, 31, 70, 70))); | 725 parent, gfx::Rect(29, 31, 70, 69))); |
744 } | 726 } |
745 }; | 727 }; |
746 | 728 |
747 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); | 729 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); |
748 | 730 |
749 template <class Types> | 731 template <class Types> |
750 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { | 732 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { |
751 protected: | 733 protected: |
752 explicit OcclusionTrackerTestTranslatedChild(bool opaque_layers) | 734 explicit OcclusionTrackerTestTranslatedChild(bool opaque_layers) |
753 : OcclusionTrackerTest<Types>(opaque_layers) {} | 735 : OcclusionTrackerTest<Types>(opaque_layers) {} |
(...skipping 22 matching lines...) Expand all Loading... |
776 this->EnterLayer(parent, &occlusion, false); | 758 this->EnterLayer(parent, &occlusion, false); |
777 | 759 |
778 EXPECT_EQ(gfx::Rect().ToString(), | 760 EXPECT_EQ(gfx::Rect().ToString(), |
779 occlusion.occlusion_from_outside_target().ToString()); | 761 occlusion.occlusion_from_outside_target().ToString()); |
780 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), | 762 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), |
781 occlusion.occlusion_from_inside_target().ToString()); | 763 occlusion.occlusion_from_inside_target().ToString()); |
782 | 764 |
783 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(50, 50, 50, 50))); | 765 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(50, 50, 50, 50))); |
784 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(49, 50, 50, 50))); | 766 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(49, 50, 50, 50))); |
785 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(50, 49, 50, 50))); | 767 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(50, 49, 50, 50))); |
786 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(51, 50, 50, 50))); | 768 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(51, 50, 49, 50))); |
787 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(50, 51, 50, 50))); | 769 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(50, 51, 50, 49))); |
788 | 770 |
789 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 771 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
790 parent, gfx::Rect(50, 50, 50, 50)).IsEmpty()); | 772 parent, gfx::Rect(50, 50, 50, 50)).IsEmpty()); |
791 EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), | 773 EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), |
792 occlusion.UnoccludedLayerContentRect( | 774 occlusion.UnoccludedLayerContentRect( |
793 parent, gfx::Rect(49, 50, 50, 50))); | 775 parent, gfx::Rect(49, 50, 50, 50))); |
794 EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), | 776 EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), |
795 occlusion.UnoccludedLayerContentRect( | 777 occlusion.UnoccludedLayerContentRect( |
796 parent, gfx::Rect(49, 49, 50, 50))); | 778 parent, gfx::Rect(49, 49, 50, 50))); |
797 EXPECT_RECT_EQ(gfx::Rect(50, 49, 50, 1), | 779 EXPECT_RECT_EQ(gfx::Rect(50, 49, 50, 1), |
798 occlusion.UnoccludedLayerContentRect( | 780 occlusion.UnoccludedLayerContentRect( |
799 parent, gfx::Rect(50, 49, 50, 50))); | 781 parent, gfx::Rect(50, 49, 50, 50))); |
800 EXPECT_RECT_EQ(gfx::Rect(51, 49, 49, 1), | 782 EXPECT_RECT_EQ(gfx::Rect(51, 49, 49, 1), |
801 occlusion.UnoccludedLayerContentRect( | 783 occlusion.UnoccludedLayerContentRect( |
802 parent, gfx::Rect(51, 49, 50, 50))); | 784 parent, gfx::Rect(51, 49, 49, 50))); |
803 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 785 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
804 parent, gfx::Rect(51, 50, 50, 50)).IsEmpty()); | 786 parent, gfx::Rect(51, 50, 49, 50)).IsEmpty()); |
805 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 787 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
806 parent, gfx::Rect(51, 51, 50, 50)).IsEmpty()); | 788 parent, gfx::Rect(51, 51, 49, 49)).IsEmpty()); |
807 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 789 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
808 parent, gfx::Rect(50, 51, 50, 50)).IsEmpty()); | 790 parent, gfx::Rect(50, 51, 50, 49)).IsEmpty()); |
809 EXPECT_RECT_EQ(gfx::Rect(49, 51, 1, 49), | 791 EXPECT_RECT_EQ(gfx::Rect(49, 51, 1, 49), |
810 occlusion.UnoccludedLayerContentRect( | 792 occlusion.UnoccludedLayerContentRect( |
811 parent, gfx::Rect(49, 51, 50, 50))); | 793 parent, gfx::Rect(49, 51, 50, 49))); |
812 } | 794 } |
813 }; | 795 }; |
814 | 796 |
815 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); | 797 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); |
816 | 798 |
817 template <class Types> | 799 template <class Types> |
818 class OcclusionTrackerTestChildInRotatedChild | 800 class OcclusionTrackerTestChildInRotatedChild |
819 : public OcclusionTrackerTest<Types> { | 801 : public OcclusionTrackerTest<Types> { |
820 protected: | 802 protected: |
821 explicit OcclusionTrackerTestChildInRotatedChild(bool opaque_layers) | 803 explicit OcclusionTrackerTestChildInRotatedChild(bool opaque_layers) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 this->EnterLayer(parent, &occlusion, false); | 838 this->EnterLayer(parent, &occlusion, false); |
857 | 839 |
858 EXPECT_EQ(gfx::Rect().ToString(), | 840 EXPECT_EQ(gfx::Rect().ToString(), |
859 occlusion.occlusion_from_outside_target().ToString()); | 841 occlusion.occlusion_from_outside_target().ToString()); |
860 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), | 842 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), |
861 occlusion.occlusion_from_inside_target().ToString()); | 843 occlusion.occlusion_from_inside_target().ToString()); |
862 | 844 |
863 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 40, 70, 60))); | 845 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 40, 70, 60))); |
864 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(29, 40, 70, 60))); | 846 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(29, 40, 70, 60))); |
865 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(30, 39, 70, 60))); | 847 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(30, 39, 70, 60))); |
866 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(31, 40, 70, 60))); | 848 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(31, 40, 69, 60))); |
867 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 41, 70, 60))); | 849 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 41, 70, 59))); |
868 | 850 |
869 /* Justification for the above occlusion from |layer|: | 851 /* Justification for the above occlusion from |layer|: |
870 100 | 852 100 |
871 +---------------------+ | 853 +---------------------+ |
872 | | | 854 | | |
873 | 30 | rotate(90) | 855 | 30 | rotate(90) |
874 | 30 + ---------------------------------+ | 856 | 30 + ---------------------------------+ |
875 100 | | 10 | | ==> | 857 100 | | 10 | | ==> |
876 | |10+---------------------------------+ | 858 | |10+---------------------------------+ |
877 | | | | | | | 859 | | | | | | |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 // This rect extends past top/right ends of |child2|. | 1071 // This rect extends past top/right ends of |child2|. |
1090 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 11), | 1072 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 11), |
1091 occlusion.UnoccludedLayerContentRect( | 1073 occlusion.UnoccludedLayerContentRect( |
1092 parent, gfx::Rect(30, 29, 70, 70))); | 1074 parent, gfx::Rect(30, 29, 70, 70))); |
1093 // This rect extends past left/right ends of |child2|. | 1075 // This rect extends past left/right ends of |child2|. |
1094 EXPECT_RECT_EQ(gfx::Rect(20, 39, 80, 60), | 1076 EXPECT_RECT_EQ(gfx::Rect(20, 39, 80, 60), |
1095 occlusion.UnoccludedLayerContentRect( | 1077 occlusion.UnoccludedLayerContentRect( |
1096 parent, gfx::Rect(20, 39, 80, 60))); | 1078 parent, gfx::Rect(20, 39, 80, 60))); |
1097 EXPECT_RECT_EQ(gfx::Rect(), | 1079 EXPECT_RECT_EQ(gfx::Rect(), |
1098 occlusion.UnoccludedLayerContentRect( | 1080 occlusion.UnoccludedLayerContentRect( |
1099 parent, gfx::Rect(31, 40, 70, 60))); | 1081 parent, gfx::Rect(31, 40, 69, 60))); |
1100 EXPECT_RECT_EQ(gfx::Rect(), | 1082 EXPECT_RECT_EQ(gfx::Rect(), |
1101 occlusion.UnoccludedLayerContentRect( | 1083 occlusion.UnoccludedLayerContentRect( |
1102 parent, gfx::Rect(30, 41, 70, 60))); | 1084 parent, gfx::Rect(30, 41, 70, 59))); |
1103 | 1085 |
1104 /* Justification for the above occlusion from |layer|: | 1086 /* Justification for the above occlusion from |layer|: |
1105 100 | 1087 100 |
1106 +---------------------+ | 1088 +---------------------+ |
1107 | | | 1089 | | |
1108 | 30 | rotate(90) | 1090 | 30 | rotate(90) |
1109 | 30 + ------------+--------------------+ | 1091 | 30 + ------------+--------------------+ |
1110 100 | | 10 | | | ==> | 1092 100 | | 10 | | | ==> |
1111 | |10+----------|----------------------+ | 1093 | |10+----------|----------------------+ |
1112 | + ------------+ | | | | 1094 | + ------------+ | | | |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 this->VisitLayer(child, &occlusion); | 1240 this->VisitLayer(child, &occlusion); |
1259 this->EnterContributingSurface(child, &occlusion, false); | 1241 this->EnterContributingSurface(child, &occlusion, false); |
1260 | 1242 |
1261 EXPECT_EQ(gfx::Rect().ToString(), | 1243 EXPECT_EQ(gfx::Rect().ToString(), |
1262 occlusion.occlusion_from_outside_target().ToString()); | 1244 occlusion.occlusion_from_outside_target().ToString()); |
1263 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), | 1245 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), |
1264 occlusion.occlusion_from_inside_target().ToString()); | 1246 occlusion.occlusion_from_inside_target().ToString()); |
1265 | 1247 |
1266 EXPECT_TRUE(occlusion.OccludedLayer(child, gfx::Rect(10, 430, 60, 70))); | 1248 EXPECT_TRUE(occlusion.OccludedLayer(child, gfx::Rect(10, 430, 60, 70))); |
1267 EXPECT_FALSE(occlusion.OccludedLayer(child, gfx::Rect(9, 430, 60, 70))); | 1249 EXPECT_FALSE(occlusion.OccludedLayer(child, gfx::Rect(9, 430, 60, 70))); |
1268 // These rects are occluded except for the part outside the bounds of the | 1250 EXPECT_TRUE(occlusion.OccludedLayer(child, gfx::Rect(11, 430, 59, 70))); |
1269 // target surface. | 1251 EXPECT_TRUE(occlusion.OccludedLayer(child, gfx::Rect(10, 431, 60, 69))); |
1270 EXPECT_TRUE(occlusion.OccludedLayer(child, gfx::Rect(10, 429, 60, 70))); | |
1271 EXPECT_TRUE(occlusion.OccludedLayer(child, gfx::Rect(11, 430, 60, 70))); | |
1272 EXPECT_TRUE(occlusion.OccludedLayer(child, gfx::Rect(10, 431, 60, 70))); | |
1273 | 1252 |
1274 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 1253 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
1275 child, gfx::Rect(10, 430, 60, 70)).IsEmpty()); | 1254 child, gfx::Rect(10, 430, 60, 70)).IsEmpty()); |
1276 EXPECT_RECT_EQ( | 1255 EXPECT_RECT_EQ( |
1277 gfx::Rect(9, 430, 1, 70), | 1256 gfx::Rect(9, 430, 1, 70), |
1278 occlusion.UnoccludedLayerContentRect(child, gfx::Rect(9, 430, 60, 70))); | 1257 occlusion.UnoccludedLayerContentRect(child, gfx::Rect(9, 430, 60, 70))); |
1279 // These rects are occluded except for the part outside the bounds of the | |
1280 // target surface. | |
1281 EXPECT_RECT_EQ(gfx::Rect(), | 1258 EXPECT_RECT_EQ(gfx::Rect(), |
1282 occlusion.UnoccludedLayerContentRect( | 1259 occlusion.UnoccludedLayerContentRect( |
1283 child, gfx::Rect(10, 429, 60, 70))); | 1260 child, gfx::Rect(11, 430, 59, 70))); |
1284 EXPECT_RECT_EQ(gfx::Rect(), | 1261 EXPECT_RECT_EQ(gfx::Rect(), |
1285 occlusion.UnoccludedLayerContentRect( | 1262 occlusion.UnoccludedLayerContentRect( |
1286 child, gfx::Rect(11, 430, 60, 70))); | 1263 child, gfx::Rect(10, 431, 60, 69))); |
1287 EXPECT_RECT_EQ(gfx::Rect(), | |
1288 occlusion.UnoccludedLayerContentRect( | |
1289 child, gfx::Rect(10, 431, 60, 70))); | |
1290 | 1264 |
1291 this->LeaveContributingSurface(child, &occlusion); | 1265 this->LeaveContributingSurface(child, &occlusion); |
1292 this->EnterLayer(parent, &occlusion, false); | 1266 this->EnterLayer(parent, &occlusion, false); |
1293 | 1267 |
1294 EXPECT_EQ(gfx::Rect().ToString(), | 1268 EXPECT_EQ(gfx::Rect().ToString(), |
1295 occlusion.occlusion_from_outside_target().ToString()); | 1269 occlusion.occlusion_from_outside_target().ToString()); |
1296 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), | 1270 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), |
1297 occlusion.occlusion_from_inside_target().ToString()); | 1271 occlusion.occlusion_from_inside_target().ToString()); |
1298 | 1272 |
1299 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 40, 70, 60))); | 1273 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(30, 40, 70, 60))); |
1300 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(29, 40, 70, 60))); | 1274 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(29, 40, 70, 60))); |
1301 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(30, 39, 70, 60))); | 1275 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(30, 39, 70, 60))); |
1302 | 1276 |
1303 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 1277 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
1304 parent, gfx::Rect(30, 40, 70, 60)).IsEmpty()); | 1278 parent, gfx::Rect(30, 40, 70, 60)).IsEmpty()); |
1305 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), | 1279 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), |
1306 occlusion.UnoccludedLayerContentRect( | 1280 occlusion.UnoccludedLayerContentRect( |
1307 parent, gfx::Rect(29, 40, 70, 60))); | 1281 parent, gfx::Rect(29, 40, 70, 60))); |
1308 EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), | 1282 EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), |
1309 occlusion.UnoccludedLayerContentRect( | 1283 occlusion.UnoccludedLayerContentRect( |
1310 parent, gfx::Rect(30, 39, 70, 60))); | 1284 parent, gfx::Rect(30, 39, 70, 60))); |
1311 EXPECT_RECT_EQ(gfx::Rect(), | 1285 EXPECT_RECT_EQ(gfx::Rect(), |
1312 occlusion.UnoccludedLayerContentRect( | 1286 occlusion.UnoccludedLayerContentRect( |
1313 parent, gfx::Rect(31, 40, 70, 60))); | 1287 parent, gfx::Rect(31, 40, 69, 60))); |
1314 EXPECT_RECT_EQ(gfx::Rect(), | 1288 EXPECT_RECT_EQ(gfx::Rect(), |
1315 occlusion.UnoccludedLayerContentRect( | 1289 occlusion.UnoccludedLayerContentRect( |
1316 parent, gfx::Rect(30, 41, 70, 60))); | 1290 parent, gfx::Rect(30, 41, 70, 59))); |
1317 | 1291 |
1318 /* Justification for the above occlusion from |layer1| and |layer2|: | 1292 /* Justification for the above occlusion from |layer1| and |layer2|: |
1319 | 1293 |
1320 +---------------------+ | 1294 +---------------------+ |
1321 | |30 Visible region of |layer1|: ///// | 1295 | |30 Visible region of |layer1|: ///// |
1322 | | Visible region of |layer2|: \\\\\ | 1296 | | Visible region of |layer2|: \\\\\ |
1323 | +---------------------------------+ | 1297 | +---------------------------------+ |
1324 | | |10 | | 1298 | | |10 | |
1325 | +---------------+-----------------+ | | 1299 | +---------------+-----------------+ | |
1326 | | |\\\\\\\\\\\\|//| 420 | | | 1300 | | |\\\\\\\\\\\\|//| 420 | | |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 gfx::Rect(0, 0, 1000, 1000)); | 1356 gfx::Rect(0, 0, 1000, 1000)); |
1383 | 1357 |
1384 this->VisitLayer(layer2, &occlusion); | 1358 this->VisitLayer(layer2, &occlusion); |
1385 this->EnterContributingSurface(child2, &occlusion, false); | 1359 this->EnterContributingSurface(child2, &occlusion, false); |
1386 | 1360 |
1387 EXPECT_EQ(gfx::Rect().ToString(), | 1361 EXPECT_EQ(gfx::Rect().ToString(), |
1388 occlusion.occlusion_from_outside_target().ToString()); | 1362 occlusion.occlusion_from_outside_target().ToString()); |
1389 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), | 1363 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), |
1390 occlusion.occlusion_from_inside_target().ToString()); | 1364 occlusion.occlusion_from_inside_target().ToString()); |
1391 | 1365 |
1392 EXPECT_TRUE(occlusion.OccludedLayer(child2, gfx::Rect(-10, 420, 70, 80))); | |
1393 EXPECT_TRUE(occlusion.OccludedLayer(child2, gfx::Rect(-11, 420, 70, 80))); | |
1394 EXPECT_TRUE(occlusion.OccludedLayer(child2, gfx::Rect(-10, 419, 70, 80))); | |
1395 EXPECT_TRUE(occlusion.OccludedLayer(child2, gfx::Rect(-10, 420, 71, 80))); | |
1396 EXPECT_TRUE(occlusion.OccludedLayer(child2, gfx::Rect(-10, 420, 70, 81))); | |
1397 | |
1398 // There is nothing above child2's surface in the z-order. | 1366 // There is nothing above child2's surface in the z-order. |
1399 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), | 1367 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), |
1400 occlusion.UnoccludedContributingSurfaceContentRect( | 1368 occlusion.UnoccludedContributingSurfaceContentRect( |
1401 child2, false, gfx::Rect(-10, 420, 70, 80))); | 1369 child2, false, gfx::Rect(-10, 420, 70, 80))); |
1402 | 1370 |
1403 this->LeaveContributingSurface(child2, &occlusion); | 1371 this->LeaveContributingSurface(child2, &occlusion); |
1404 this->VisitLayer(layer1, &occlusion); | 1372 this->VisitLayer(layer1, &occlusion); |
1405 this->EnterContributingSurface(child1, &occlusion, false); | 1373 this->EnterContributingSurface(child1, &occlusion, false); |
1406 | 1374 |
1407 EXPECT_EQ(gfx::Rect(0, 430, 70, 80).ToString(), | 1375 EXPECT_EQ(gfx::Rect(0, 430, 70, 80).ToString(), |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 // The replica should not be occluding the parent, since it has a mask | 1766 // The replica should not be occluding the parent, since it has a mask |
1799 // applied to it. | 1767 // applied to it. |
1800 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), | 1768 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), |
1801 occlusion.occlusion_from_inside_target().ToString()); | 1769 occlusion.occlusion_from_inside_target().ToString()); |
1802 } | 1770 } |
1803 }; | 1771 }; |
1804 | 1772 |
1805 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); | 1773 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); |
1806 | 1774 |
1807 template <class Types> | 1775 template <class Types> |
1808 class OcclusionTrackerTestLayerClipRectOutsideChild | |
1809 : public OcclusionTrackerTest<Types> { | |
1810 protected: | |
1811 explicit OcclusionTrackerTestLayerClipRectOutsideChild(bool opaque_layers) | |
1812 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
1813 void RunMyTest() { | |
1814 typename Types::ContentLayerType* parent = this->CreateRoot( | |
1815 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | |
1816 typename Types::ContentLayerType* clip = | |
1817 this->CreateDrawingLayer(parent, | |
1818 this->identity_matrix, | |
1819 gfx::PointF(200.f, 100.f), | |
1820 gfx::Size(100, 100), | |
1821 false); | |
1822 clip->SetMasksToBounds(true); | |
1823 typename Types::ContentLayerType* layer = | |
1824 this->CreateDrawingLayer(clip, | |
1825 this->identity_matrix, | |
1826 gfx::PointF(-200.f, -100.f), | |
1827 gfx::Size(200, 200), | |
1828 false); | |
1829 this->CalcDrawEtc(parent); | |
1830 | |
1831 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
1832 typename Types::RenderSurfaceType> occlusion( | |
1833 gfx::Rect(0, 0, 1000, 1000)); | |
1834 | |
1835 this->EnterLayer(layer, &occlusion, false); | |
1836 | |
1837 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
1838 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | |
1839 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | |
1840 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | |
1841 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(200, 100, 100, 100))); | |
1842 | |
1843 this->LeaveLayer(layer, &occlusion); | |
1844 this->EnterLayer(clip, &occlusion, false); | |
1845 | |
1846 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(-100, 0, 100, 100))); | |
1847 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(0, -100, 100, 100))); | |
1848 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(100, 0, 100, 100))); | |
1849 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(0, 100, 100, 100))); | |
1850 EXPECT_FALSE(occlusion.OccludedLayer(clip, gfx::Rect(0, 0, 100, 100))); | |
1851 | |
1852 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), | |
1853 occlusion.UnoccludedLayerContentRect( | |
1854 clip, gfx::Rect(-100, -100, 300, 300))); | |
1855 } | |
1856 }; | |
1857 | |
1858 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); | |
1859 | |
1860 template <class Types> | |
1861 class OcclusionTrackerTestViewportRectOutsideChild | |
1862 : public OcclusionTrackerTest<Types> { | |
1863 protected: | |
1864 explicit OcclusionTrackerTestViewportRectOutsideChild(bool opaque_layers) | |
1865 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
1866 void RunMyTest() { | |
1867 typename Types::ContentLayerType* parent = this->CreateRoot( | |
1868 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | |
1869 typename Types::ContentLayerType* layer = | |
1870 this->CreateDrawingSurface(parent, | |
1871 this->identity_matrix, | |
1872 gfx::PointF(), | |
1873 gfx::Size(200, 200), | |
1874 true); | |
1875 this->CalcDrawEtc(parent); | |
1876 | |
1877 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
1878 typename Types::RenderSurfaceType> occlusion( | |
1879 gfx::Rect(200, 100, 100, 100)); | |
1880 | |
1881 this->EnterLayer(layer, &occlusion, false); | |
1882 | |
1883 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
1884 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | |
1885 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | |
1886 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | |
1887 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(200, 100, 100, 100))); | |
1888 | |
1889 this->LeaveLayer(layer, &occlusion); | |
1890 this->VisitContributingSurface(layer, &occlusion); | |
1891 this->EnterLayer(parent, &occlusion, false); | |
1892 | |
1893 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 0, 100, 100))); | |
1894 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); | |
1895 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 0, 100, 100))); | |
1896 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); | |
1897 EXPECT_FALSE( | |
1898 occlusion.OccludedLayer(parent, gfx::Rect(200, 100, 100, 100))); | |
1899 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(200, 0, 100, 100))); | |
1900 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 200, 100, 100))); | |
1901 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 200, 100, 100))); | |
1902 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100))); | |
1903 | |
1904 EXPECT_RECT_EQ(gfx::Rect(200, 100, 100, 100), | |
1905 occlusion.UnoccludedLayerContentRect( | |
1906 parent, gfx::Rect(0, 0, 300, 300))); | |
1907 } | |
1908 }; | |
1909 | |
1910 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); | |
1911 | |
1912 template <class Types> | |
1913 class OcclusionTrackerTestLayerClipRectOverChild | |
1914 : public OcclusionTrackerTest<Types> { | |
1915 protected: | |
1916 explicit OcclusionTrackerTestLayerClipRectOverChild(bool opaque_layers) | |
1917 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
1918 void RunMyTest() { | |
1919 typename Types::ContentLayerType* parent = this->CreateRoot( | |
1920 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | |
1921 typename Types::ContentLayerType* clip = | |
1922 this->CreateDrawingLayer(parent, | |
1923 this->identity_matrix, | |
1924 gfx::PointF(100.f, 100.f), | |
1925 gfx::Size(100, 100), | |
1926 false); | |
1927 clip->SetMasksToBounds(true); | |
1928 typename Types::ContentLayerType* layer = | |
1929 this->CreateDrawingSurface(clip, | |
1930 this->identity_matrix, | |
1931 gfx::PointF(-100.f, -100.f), | |
1932 gfx::Size(200, 200), | |
1933 true); | |
1934 this->CalcDrawEtc(parent); | |
1935 | |
1936 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
1937 typename Types::RenderSurfaceType> occlusion( | |
1938 gfx::Rect(0, 0, 1000, 1000)); | |
1939 | |
1940 this->EnterLayer(layer, &occlusion, false); | |
1941 | |
1942 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
1943 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | |
1944 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | |
1945 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | |
1946 | |
1947 this->LeaveLayer(layer, &occlusion); | |
1948 this->VisitContributingSurface(layer, &occlusion); | |
1949 | |
1950 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), | |
1951 occlusion.occlusion_from_inside_target().ToString()); | |
1952 | |
1953 this->EnterLayer(clip, &occlusion, false); | |
1954 | |
1955 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(0, 0, 100, 100))); | |
1956 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(0, 100, 100, 100))); | |
1957 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(100, 0, 100, 100))); | |
1958 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(100, 100, 100, 100))); | |
1959 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(200, 100, 100, 100))); | |
1960 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(200, 0, 100, 100))); | |
1961 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(0, 200, 100, 100))); | |
1962 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(100, 200, 100, 100))); | |
1963 EXPECT_TRUE(occlusion.OccludedLayer(clip, gfx::Rect(200, 200, 100, 100))); | |
1964 | |
1965 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | |
1966 clip, gfx::Rect(0, 0, 300, 300)).IsEmpty()); | |
1967 } | |
1968 }; | |
1969 | |
1970 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); | |
1971 | |
1972 template <class Types> | |
1973 class OcclusionTrackerTestViewportRectOverChild | |
1974 : public OcclusionTrackerTest<Types> { | |
1975 protected: | |
1976 explicit OcclusionTrackerTestViewportRectOverChild(bool opaque_layers) | |
1977 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
1978 void RunMyTest() { | |
1979 typename Types::ContentLayerType* parent = this->CreateRoot( | |
1980 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | |
1981 typename Types::ContentLayerType* layer = | |
1982 this->CreateDrawingSurface(parent, | |
1983 this->identity_matrix, | |
1984 gfx::PointF(), | |
1985 gfx::Size(200, 200), | |
1986 true); | |
1987 this->CalcDrawEtc(parent); | |
1988 | |
1989 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
1990 typename Types::RenderSurfaceType> occlusion( | |
1991 gfx::Rect(100, 100, 100, 100)); | |
1992 | |
1993 this->EnterLayer(layer, &occlusion, false); | |
1994 | |
1995 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
1996 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | |
1997 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | |
1998 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | |
1999 | |
2000 this->LeaveLayer(layer, &occlusion); | |
2001 this->VisitContributingSurface(layer, &occlusion); | |
2002 this->EnterLayer(parent, &occlusion, false); | |
2003 | |
2004 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 0, 100, 100))); | |
2005 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); | |
2006 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 0, 100, 100))); | |
2007 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 100, 100, 100))); | |
2008 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(200, 100, 100, 100))); | |
2009 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(200, 0, 100, 100))); | |
2010 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 200, 100, 100))); | |
2011 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 200, 100, 100))); | |
2012 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100))); | |
2013 | |
2014 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | |
2015 parent, gfx::Rect(0, 0, 300, 300)).IsEmpty()); | |
2016 } | |
2017 }; | |
2018 | |
2019 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); | |
2020 | |
2021 template <class Types> | |
2022 class OcclusionTrackerTestLayerClipRectPartlyOverChild | |
2023 : public OcclusionTrackerTest<Types> { | |
2024 protected: | |
2025 explicit OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaque_layers) | |
2026 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
2027 void RunMyTest() { | |
2028 typename Types::ContentLayerType* parent = this->CreateRoot( | |
2029 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | |
2030 typename Types::ContentLayerType* clip = | |
2031 this->CreateDrawingLayer(parent, | |
2032 this->identity_matrix, | |
2033 gfx::PointF(50.f, 50.f), | |
2034 gfx::Size(200, 200), | |
2035 false); | |
2036 clip->SetMasksToBounds(true); | |
2037 typename Types::ContentLayerType* layer = | |
2038 this->CreateDrawingSurface(clip, | |
2039 this->identity_matrix, | |
2040 gfx::PointF(-50.f, -50.f), | |
2041 gfx::Size(200, 200), | |
2042 true); | |
2043 this->CalcDrawEtc(parent); | |
2044 | |
2045 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
2046 typename Types::RenderSurfaceType> occlusion( | |
2047 gfx::Rect(0, 0, 1000, 1000)); | |
2048 | |
2049 this->EnterLayer(layer, &occlusion, false); | |
2050 | |
2051 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
2052 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | |
2053 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | |
2054 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | |
2055 | |
2056 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 50))); | |
2057 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 50, 100))); | |
2058 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 50))); | |
2059 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 50, 100))); | |
2060 | |
2061 this->LeaveLayer(layer, &occlusion); | |
2062 this->VisitContributingSurface(layer, &occlusion); | |
2063 this->EnterLayer(clip, &occlusion, false); | |
2064 | |
2065 EXPECT_EQ(gfx::Rect(50, 50, 150, 150).ToString(), | |
2066 occlusion.occlusion_from_inside_target().ToString()); | |
2067 } | |
2068 }; | |
2069 | |
2070 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); | |
2071 | |
2072 template <class Types> | |
2073 class OcclusionTrackerTestViewportRectPartlyOverChild | |
2074 : public OcclusionTrackerTest<Types> { | |
2075 protected: | |
2076 explicit OcclusionTrackerTestViewportRectPartlyOverChild(bool opaque_layers) | |
2077 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
2078 void RunMyTest() { | |
2079 typename Types::ContentLayerType* parent = this->CreateRoot( | |
2080 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | |
2081 typename Types::ContentLayerType* layer = | |
2082 this->CreateDrawingSurface(parent, | |
2083 this->identity_matrix, | |
2084 gfx::PointF(), | |
2085 gfx::Size(200, 200), | |
2086 true); | |
2087 this->CalcDrawEtc(parent); | |
2088 | |
2089 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
2090 typename Types::RenderSurfaceType> occlusion( | |
2091 gfx::Rect(50, 50, 200, 200)); | |
2092 | |
2093 this->EnterLayer(layer, &occlusion, false); | |
2094 | |
2095 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
2096 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | |
2097 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | |
2098 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | |
2099 | |
2100 this->LeaveLayer(layer, &occlusion); | |
2101 this->VisitContributingSurface(layer, &occlusion); | |
2102 this->EnterLayer(parent, &occlusion, false); | |
2103 | |
2104 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 0, 100, 100))); | |
2105 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); | |
2106 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 0, 100, 100))); | |
2107 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 100, 100, 100))); | |
2108 EXPECT_FALSE( | |
2109 occlusion.OccludedLayer(parent, gfx::Rect(200, 100, 100, 100))); | |
2110 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(200, 0, 100, 100))); | |
2111 EXPECT_FALSE(occlusion.OccludedLayer(parent, gfx::Rect(0, 200, 100, 100))); | |
2112 EXPECT_FALSE( | |
2113 occlusion.OccludedLayer(parent, gfx::Rect(100, 200, 100, 100))); | |
2114 EXPECT_FALSE( | |
2115 occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100))); | |
2116 | |
2117 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), | |
2118 occlusion.UnoccludedLayerContentRect( | |
2119 parent, gfx::Rect(0, 0, 300, 300))); | |
2120 EXPECT_RECT_EQ(gfx::Rect(200, 50, 50, 50), | |
2121 occlusion.UnoccludedLayerContentRect( | |
2122 parent, gfx::Rect(0, 0, 300, 100))); | |
2123 EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), | |
2124 occlusion.UnoccludedLayerContentRect( | |
2125 parent, gfx::Rect(0, 100, 300, 100))); | |
2126 EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), | |
2127 occlusion.UnoccludedLayerContentRect( | |
2128 parent, gfx::Rect(200, 100, 100, 100))); | |
2129 EXPECT_RECT_EQ(gfx::Rect(100, 200, 100, 50), | |
2130 occlusion.UnoccludedLayerContentRect( | |
2131 parent, gfx::Rect(100, 200, 100, 100))); | |
2132 } | |
2133 }; | |
2134 | |
2135 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); | |
2136 | |
2137 template <class Types> | |
2138 class OcclusionTrackerTestViewportRectOverNothing | |
2139 : public OcclusionTrackerTest<Types> { | |
2140 protected: | |
2141 explicit OcclusionTrackerTestViewportRectOverNothing(bool opaque_layers) | |
2142 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
2143 void RunMyTest() { | |
2144 typename Types::ContentLayerType* parent = this->CreateRoot( | |
2145 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | |
2146 typename Types::ContentLayerType* layer = | |
2147 this->CreateDrawingSurface(parent, | |
2148 this->identity_matrix, | |
2149 gfx::PointF(), | |
2150 gfx::Size(200, 200), | |
2151 true); | |
2152 this->CalcDrawEtc(parent); | |
2153 | |
2154 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
2155 typename Types::RenderSurfaceType> occlusion( | |
2156 gfx::Rect(500, 500, 100, 100)); | |
2157 | |
2158 this->EnterLayer(layer, &occlusion, false); | |
2159 | |
2160 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
2161 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | |
2162 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | |
2163 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | |
2164 | |
2165 this->LeaveLayer(layer, &occlusion); | |
2166 this->VisitContributingSurface(layer, &occlusion); | |
2167 this->EnterLayer(parent, &occlusion, false); | |
2168 | |
2169 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 0, 100, 100))); | |
2170 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 100, 100, 100))); | |
2171 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 0, 100, 100))); | |
2172 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 100, 100, 100))); | |
2173 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(200, 100, 100, 100))); | |
2174 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(200, 0, 100, 100))); | |
2175 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(0, 200, 100, 100))); | |
2176 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(100, 200, 100, 100))); | |
2177 EXPECT_TRUE(occlusion.OccludedLayer(parent, gfx::Rect(200, 200, 100, 100))); | |
2178 | |
2179 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | |
2180 parent, gfx::Rect(0, 0, 300, 300)).IsEmpty()); | |
2181 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | |
2182 parent, gfx::Rect(0, 0, 300, 100)).IsEmpty()); | |
2183 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | |
2184 parent, gfx::Rect(0, 100, 300, 100)).IsEmpty()); | |
2185 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | |
2186 parent, gfx::Rect(200, 100, 100, 100)).IsEmpty()); | |
2187 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | |
2188 parent, gfx::Rect(100, 200, 100, 100)).IsEmpty()); | |
2189 } | |
2190 }; | |
2191 | |
2192 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing); | |
2193 | |
2194 template <class Types> | |
2195 class OcclusionTrackerTestLayerClipRectForLayerOffOrigin | |
2196 : public OcclusionTrackerTest<Types> { | |
2197 protected: | |
2198 explicit OcclusionTrackerTestLayerClipRectForLayerOffOrigin( | |
2199 bool opaque_layers) | |
2200 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
2201 void RunMyTest() { | |
2202 typename Types::ContentLayerType* parent = this->CreateRoot( | |
2203 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | |
2204 typename Types::ContentLayerType* layer = | |
2205 this->CreateDrawingSurface(parent, | |
2206 this->identity_matrix, | |
2207 gfx::PointF(), | |
2208 gfx::Size(200, 200), | |
2209 true); | |
2210 this->CalcDrawEtc(parent); | |
2211 | |
2212 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
2213 typename Types::RenderSurfaceType> occlusion( | |
2214 gfx::Rect(0, 0, 1000, 1000)); | |
2215 this->EnterLayer(layer, &occlusion, false); | |
2216 | |
2217 // This layer is translated when drawn into its target. So if the clip rect | |
2218 // given from the target surface is not in that target space, then after | |
2219 // translating these query rects into the target, they will fall outside the | |
2220 // clip and be considered occluded. | |
2221 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
2222 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | |
2223 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | |
2224 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | |
2225 } | |
2226 }; | |
2227 | |
2228 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin); | |
2229 | |
2230 template <class Types> | |
2231 class OcclusionTrackerTestOpaqueContentsRegionEmpty | 1776 class OcclusionTrackerTestOpaqueContentsRegionEmpty |
2232 : public OcclusionTrackerTest<Types> { | 1777 : public OcclusionTrackerTest<Types> { |
2233 protected: | 1778 protected: |
2234 explicit OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaque_layers) | 1779 explicit OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaque_layers) |
2235 : OcclusionTrackerTest<Types>(opaque_layers) {} | 1780 : OcclusionTrackerTest<Types>(opaque_layers) {} |
2236 void RunMyTest() { | 1781 void RunMyTest() { |
2237 typename Types::ContentLayerType* parent = this->CreateRoot( | 1782 typename Types::ContentLayerType* parent = this->CreateRoot( |
2238 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); | 1783 this->identity_matrix, gfx::PointF(), gfx::Size(300, 300)); |
2239 typename Types::ContentLayerType* layer = | 1784 typename Types::ContentLayerType* layer = |
2240 this->CreateDrawingSurface(parent, | 1785 this->CreateDrawingSurface(parent, |
2241 this->identity_matrix, | 1786 this->identity_matrix, |
2242 gfx::PointF(), | 1787 gfx::PointF(), |
2243 gfx::Size(200, 200), | 1788 gfx::Size(200, 200), |
2244 false); | 1789 false); |
2245 this->CalcDrawEtc(parent); | 1790 this->CalcDrawEtc(parent); |
2246 | 1791 |
2247 TestOcclusionTrackerWithClip<typename Types::LayerType, | 1792 TestOcclusionTrackerWithClip<typename Types::LayerType, |
2248 typename Types::RenderSurfaceType> occlusion( | 1793 typename Types::RenderSurfaceType> occlusion( |
2249 gfx::Rect(0, 0, 1000, 1000)); | 1794 gfx::Rect(0, 0, 1000, 1000)); |
2250 this->EnterLayer(layer, &occlusion, false); | 1795 this->EnterLayer(layer, &occlusion, false); |
2251 | 1796 |
2252 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1797 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
2253 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); | 1798 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 0, 100, 100))); |
2254 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); | 1799 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(0, 100, 100, 100))); |
2255 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); | 1800 EXPECT_FALSE(occlusion.OccludedLayer(layer, gfx::Rect(100, 100, 100, 100))); |
2256 | 1801 |
2257 // Occluded since its outside the surface bounds. | |
2258 EXPECT_TRUE(occlusion.OccludedLayer(layer, gfx::Rect(200, 100, 100, 100))); | |
2259 | |
2260 this->LeaveLayer(layer, &occlusion); | 1802 this->LeaveLayer(layer, &occlusion); |
2261 this->VisitContributingSurface(layer, &occlusion); | 1803 this->VisitContributingSurface(layer, &occlusion); |
2262 this->EnterLayer(parent, &occlusion, false); | 1804 this->EnterLayer(parent, &occlusion, false); |
2263 | 1805 |
2264 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1806 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
2265 } | 1807 } |
2266 }; | 1808 }; |
2267 | 1809 |
2268 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); | 1810 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); |
2269 | 1811 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 TestOcclusionTrackerWithClip<typename Types::LayerType, | 2050 TestOcclusionTrackerWithClip<typename Types::LayerType, |
2509 typename Types::RenderSurfaceType> occlusion( | 2051 typename Types::RenderSurfaceType> occlusion( |
2510 gfx::Rect(0, 0, 1000, 1000)); | 2052 gfx::Rect(0, 0, 1000, 1000)); |
2511 this->EnterLayer(layer, &occlusion, false); | 2053 this->EnterLayer(layer, &occlusion, false); |
2512 | 2054 |
2513 // The bottom 11 pixel rows of this layer remain visible inside the | 2055 // The bottom 11 pixel rows of this layer remain visible inside the |
2514 // container, after translation to the target surface. When translated back, | 2056 // container, after translation to the target surface. When translated back, |
2515 // this will include many more pixels but must include at least the bottom | 2057 // this will include many more pixels but must include at least the bottom |
2516 // 11 rows. | 2058 // 11 rows. |
2517 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( | 2059 EXPECT_TRUE(occlusion.UnoccludedLayerContentRect( |
2518 layer, gfx::Rect(0, 0, 500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); | 2060 layer, gfx::Rect(0, 26, 500, 474)). |
| 2061 Contains(gfx::Rect(0, 489, 500, 11))); |
2519 } | 2062 } |
2520 }; | 2063 }; |
2521 | 2064 |
2522 // This test requires accumulating occlusion of 3d layers, which are skipped by | 2065 // This test requires accumulating occlusion of 3d layers, which are skipped by |
2523 // the occlusion tracker on the main thread. So this test should run on the impl | 2066 // the occlusion tracker on the main thread. So this test should run on the impl |
2524 // thread. | 2067 // thread. |
2525 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); | 2068 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); |
2526 | 2069 |
2527 template <class Types> | 2070 template <class Types> |
2528 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude | 2071 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude |
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3788 // render surface is 1:1 with the screen. | 3331 // render surface is 1:1 with the screen. |
3789 EXPECT_EQ(expected_occlusion.ToString(), | 3332 EXPECT_EQ(expected_occlusion.ToString(), |
3790 occlusion.occlusion_from_outside_target().ToString()); | 3333 occlusion.occlusion_from_outside_target().ToString()); |
3791 } | 3334 } |
3792 }; | 3335 }; |
3793 | 3336 |
3794 ALL_OCCLUSIONTRACKER_TEST( | 3337 ALL_OCCLUSIONTRACKER_TEST( |
3795 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice); | 3338 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice); |
3796 | 3339 |
3797 template <class Types> | 3340 template <class Types> |
3798 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip | |
3799 : public OcclusionTrackerTest<Types> { | |
3800 protected: | |
3801 explicit | |
3802 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip( | |
3803 bool opaque_layers) | |
3804 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
3805 void RunMyTest() { | |
3806 // Make a surface and its replica, Each 50x50, that are completely | |
3807 // surrounded by opaque layers which are above them in the z-order. | |
3808 typename Types::ContentLayerType* parent = this->CreateRoot( | |
3809 this->identity_matrix, gfx::PointF(), gfx::Size(300, 150)); | |
3810 // We stick the filtered surface inside a clipping surface so that we can | |
3811 // make sure the clip is honored when exposing pixels for | |
3812 // the background filter. | |
3813 typename Types::LayerType* clipping_surface = | |
3814 this->CreateDrawingSurface(parent, | |
3815 this->identity_matrix, | |
3816 gfx::PointF(), | |
3817 gfx::Size(300, 70), | |
3818 false); | |
3819 clipping_surface->SetMasksToBounds(true); | |
3820 typename Types::LayerType* filtered_surface = | |
3821 this->CreateDrawingLayer(clipping_surface, | |
3822 this->identity_matrix, | |
3823 gfx::PointF(50.f, 50.f), | |
3824 gfx::Size(50, 50), | |
3825 false); | |
3826 this->CreateReplicaLayer(filtered_surface, | |
3827 this->identity_matrix, | |
3828 gfx::PointF(150.f, 0.f), | |
3829 gfx::Size()); | |
3830 typename Types::LayerType* occluding_layer1 = this->CreateDrawingLayer( | |
3831 parent, this->identity_matrix, gfx::PointF(), gfx::Size(300, 50), true); | |
3832 typename Types::LayerType* occluding_layer2 = | |
3833 this->CreateDrawingLayer(parent, | |
3834 this->identity_matrix, | |
3835 gfx::PointF(0.f, 100.f), | |
3836 gfx::Size(300, 50), | |
3837 true); | |
3838 typename Types::LayerType* occluding_layer3 = | |
3839 this->CreateDrawingLayer(parent, | |
3840 this->identity_matrix, | |
3841 gfx::PointF(0.f, 50.f), | |
3842 gfx::Size(50, 50), | |
3843 true); | |
3844 typename Types::LayerType* occluding_layer4 = | |
3845 this->CreateDrawingLayer(parent, | |
3846 this->identity_matrix, | |
3847 gfx::PointF(100.f, 50.f), | |
3848 gfx::Size(100, 50), | |
3849 true); | |
3850 typename Types::LayerType* occluding_layer5 = | |
3851 this->CreateDrawingLayer(parent, | |
3852 this->identity_matrix, | |
3853 gfx::PointF(250.f, 50.f), | |
3854 gfx::Size(50, 50), | |
3855 true); | |
3856 | |
3857 // Filters make the layer own a surface. This filter is large enough that it | |
3858 // goes outside the bottom of the clipping_surface. | |
3859 FilterOperations filters; | |
3860 filters.Append(FilterOperation::CreateBlurFilter(12.f)); | |
3861 filtered_surface->SetBackgroundFilters(filters); | |
3862 | |
3863 // Save the distance of influence for the blur effect. | |
3864 int outset_top, outset_right, outset_bottom, outset_left; | |
3865 filters.GetOutsets( | |
3866 &outset_top, &outset_right, &outset_bottom, &outset_left); | |
3867 | |
3868 this->CalcDrawEtc(parent); | |
3869 | |
3870 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
3871 typename Types::RenderSurfaceType> occlusion( | |
3872 gfx::Rect(0, 0, 1000, 1000)); | |
3873 | |
3874 // These layers occlude pixels directly beside the filtered_surface. Because | |
3875 // filtered surface blends pixels in a radius, it will need to see some of | |
3876 // the pixels (up to radius far) underneath the occluding layers. | |
3877 this->VisitLayer(occluding_layer5, &occlusion); | |
3878 this->VisitLayer(occluding_layer4, &occlusion); | |
3879 this->VisitLayer(occluding_layer3, &occlusion); | |
3880 this->VisitLayer(occluding_layer2, &occlusion); | |
3881 this->VisitLayer(occluding_layer1, &occlusion); | |
3882 | |
3883 Region expected_occlusion; | |
3884 expected_occlusion.Union(gfx::Rect(0, 0, 300, 50)); | |
3885 expected_occlusion.Union(gfx::Rect(0, 50, 50, 50)); | |
3886 expected_occlusion.Union(gfx::Rect(100, 50, 100, 50)); | |
3887 expected_occlusion.Union(gfx::Rect(250, 50, 50, 50)); | |
3888 expected_occlusion.Union(gfx::Rect(0, 100, 300, 50)); | |
3889 | |
3890 EXPECT_EQ(expected_occlusion.ToString(), | |
3891 occlusion.occlusion_from_inside_target().ToString()); | |
3892 EXPECT_EQ(gfx::Rect().ToString(), | |
3893 occlusion.occlusion_from_outside_target().ToString()); | |
3894 | |
3895 // Everything outside the surface/replica is occluded but the | |
3896 // surface/replica itself is not. | |
3897 this->VisitLayer(filtered_surface, &occlusion); | |
3898 | |
3899 // The filtered layer/replica does not occlude. | |
3900 Region expected_occlusion_outside_surface; | |
3901 expected_occlusion_outside_surface.Union(gfx::Rect(-50, -50, 300, 50)); | |
3902 expected_occlusion_outside_surface.Union(gfx::Rect(-50, 0, 50, 50)); | |
3903 expected_occlusion_outside_surface.Union(gfx::Rect(50, 0, 100, 50)); | |
3904 expected_occlusion_outside_surface.Union(gfx::Rect(200, 0, 50, 50)); | |
3905 expected_occlusion_outside_surface.Union(gfx::Rect(-50, 50, 300, 50)); | |
3906 | |
3907 EXPECT_EQ(expected_occlusion_outside_surface.ToString(), | |
3908 occlusion.occlusion_from_outside_target().ToString()); | |
3909 EXPECT_EQ(gfx::Rect().ToString(), | |
3910 occlusion.occlusion_from_inside_target().ToString()); | |
3911 | |
3912 // The surface has a background blur, so it needs pixels that are currently | |
3913 // considered occluded in order to be drawn. So the pixels it needs should | |
3914 // be removed some the occluded area so that when we get to the parent they | |
3915 // are drawn. | |
3916 this->VisitContributingSurface(filtered_surface, &occlusion); | |
3917 | |
3918 this->VisitLayer(clipping_surface, &occlusion); | |
3919 this->EnterContributingSurface(clipping_surface, &occlusion, false); | |
3920 | |
3921 Region expected_blurred_occlusion; | |
3922 expected_blurred_occlusion.Union(gfx::Rect(0, 0, 300, 50 - outset_top)); | |
3923 expected_blurred_occlusion.Union(gfx::Rect( | |
3924 0, 50 - outset_top, 50 - outset_left, 20 + outset_top + outset_bottom)); | |
3925 expected_blurred_occlusion.Union( | |
3926 gfx::Rect(100 + outset_right, | |
3927 50 - outset_top, | |
3928 100 - outset_right - outset_left, | |
3929 20 + outset_top + outset_bottom)); | |
3930 expected_blurred_occlusion.Union( | |
3931 gfx::Rect(250 + outset_right, | |
3932 50 - outset_top, | |
3933 50 - outset_right, | |
3934 20 + outset_top + outset_bottom)); | |
3935 expected_blurred_occlusion.Union(gfx::Rect(0, 100 + 5, 300, 50 - 5)); | |
3936 | |
3937 EXPECT_EQ(expected_blurred_occlusion.ToString(), | |
3938 occlusion.occlusion_from_outside_target().ToString()); | |
3939 EXPECT_EQ(gfx::Rect().ToString(), | |
3940 occlusion.occlusion_from_inside_target().ToString()); | |
3941 | |
3942 gfx::Rect outset_rect; | |
3943 gfx::Rect clipped_outset_rect; | |
3944 gfx::Rect test_rect; | |
3945 | |
3946 // Nothing in the (clipped) blur outsets for the filtered_surface is | |
3947 // occluded. | |
3948 outset_rect = gfx::Rect(50 - outset_left, | |
3949 50 - outset_top, | |
3950 50 + outset_left + outset_right, | |
3951 50 + outset_top + outset_bottom); | |
3952 clipped_outset_rect = outset_rect; | |
3953 clipped_outset_rect.Intersect(gfx::Rect(0 - outset_left, | |
3954 0 - outset_top, | |
3955 300 + outset_left + outset_right, | |
3956 70 + outset_top + outset_bottom)); | |
3957 clipped_outset_rect.Intersect(gfx::Rect(0, 0, 300, 70)); | |
3958 test_rect = outset_rect; | |
3959 EXPECT_RECT_EQ( | |
3960 clipped_outset_rect, | |
3961 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
3962 | |
3963 // Stuff outside the (clipped) blur outsets is still occluded though. | |
3964 test_rect = outset_rect; | |
3965 test_rect.Inset(0, 0, -1, 0); | |
3966 EXPECT_RECT_EQ( | |
3967 clipped_outset_rect, | |
3968 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
3969 test_rect = outset_rect; | |
3970 test_rect.Inset(0, 0, 0, -1); | |
3971 EXPECT_RECT_EQ( | |
3972 clipped_outset_rect, | |
3973 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
3974 test_rect = outset_rect; | |
3975 test_rect.Inset(-1, 0, 0, 0); | |
3976 EXPECT_RECT_EQ( | |
3977 clipped_outset_rect, | |
3978 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
3979 test_rect = outset_rect; | |
3980 test_rect.Inset(0, -1, 0, 0); | |
3981 EXPECT_RECT_EQ( | |
3982 clipped_outset_rect, | |
3983 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
3984 | |
3985 // Nothing in the (clipped) blur outsets for the filtered_surface's replica | |
3986 // is occluded. | |
3987 outset_rect = gfx::Rect(200 - outset_left, | |
3988 50 - outset_top, | |
3989 50 + outset_left + outset_right, | |
3990 50 + outset_top + outset_bottom); | |
3991 clipped_outset_rect = outset_rect; | |
3992 clipped_outset_rect.Intersect(gfx::Rect(0 - outset_left, | |
3993 0 - outset_top, | |
3994 300 + outset_left + outset_right, | |
3995 70 + outset_top + outset_bottom)); | |
3996 clipped_outset_rect.Intersect(gfx::Rect(0, 0, 300, 70)); | |
3997 test_rect = outset_rect; | |
3998 EXPECT_RECT_EQ( | |
3999 clipped_outset_rect, | |
4000 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
4001 | |
4002 // Stuff outside the (clipped) blur outsets is still occluded though. | |
4003 test_rect = outset_rect; | |
4004 test_rect.Inset(0, 0, -1, 0); | |
4005 EXPECT_RECT_EQ( | |
4006 clipped_outset_rect, | |
4007 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
4008 test_rect = outset_rect; | |
4009 test_rect.Inset(0, 0, 0, -1); | |
4010 EXPECT_RECT_EQ( | |
4011 clipped_outset_rect, | |
4012 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
4013 test_rect = outset_rect; | |
4014 test_rect.Inset(-1, 0, 0, 0); | |
4015 EXPECT_RECT_EQ( | |
4016 clipped_outset_rect, | |
4017 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
4018 test_rect = outset_rect; | |
4019 test_rect.Inset(0, -1, 0, 0); | |
4020 EXPECT_RECT_EQ( | |
4021 clipped_outset_rect, | |
4022 occlusion.UnoccludedLayerContentRect(clipping_surface, test_rect)); | |
4023 } | |
4024 }; | |
4025 | |
4026 ALL_OCCLUSIONTRACKER_TEST( | |
4027 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip); | |
4028 | |
4029 template <class Types> | |
4030 class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter | 3341 class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter |
4031 : public OcclusionTrackerTest<Types> { | 3342 : public OcclusionTrackerTest<Types> { |
4032 protected: | 3343 protected: |
4033 explicit OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter( | 3344 explicit OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter( |
4034 bool opaque_layers) | 3345 bool opaque_layers) |
4035 : OcclusionTrackerTest<Types>(opaque_layers) {} | 3346 : OcclusionTrackerTest<Types>(opaque_layers) {} |
4036 void RunMyTest() { | 3347 void RunMyTest() { |
4037 gfx::Transform scale_by_half; | 3348 gfx::Transform scale_by_half; |
4038 scale_by_half.Scale(0.5, 0.5); | 3349 scale_by_half.Scale(0.5, 0.5); |
4039 | 3350 |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4472 gfx::Rect(50, 50)).ToString()); | 3783 gfx::Rect(50, 50)).ToString()); |
4473 | 3784 |
4474 this->LeaveContributingSurface(unprevented, &occlusion); | 3785 this->LeaveContributingSurface(unprevented, &occlusion); |
4475 } | 3786 } |
4476 }; | 3787 }; |
4477 | 3788 |
4478 ALL_OCCLUSIONTRACKER_TEST( | 3789 ALL_OCCLUSIONTRACKER_TEST( |
4479 OcclusionTrackerTestPreventOcclusionOnContributingSurface) | 3790 OcclusionTrackerTestPreventOcclusionOnContributingSurface) |
4480 | 3791 |
4481 template <class Types> | 3792 template <class Types> |
4482 class OcclusionTrackerTestPreventOcclusionByClipping | |
4483 : public OcclusionTrackerTest<Types> { | |
4484 protected: | |
4485 explicit OcclusionTrackerTestPreventOcclusionByClipping(bool opaque_layers) | |
4486 : OcclusionTrackerTest<Types>(opaque_layers) {} | |
4487 void RunMyTest() { | |
4488 typename Types::ContentLayerType* parent = this->CreateRoot( | |
4489 this->identity_matrix, gfx::PointF(), gfx::Size(400, 400)); | |
4490 typename Types::LayerType* unprevented = this->CreateDrawingLayer( | |
4491 parent, this->identity_matrix, gfx::PointF(), gfx::Size(50, 50), false); | |
4492 typename Types::LayerType* prevented = this->CreateDrawingLayer( | |
4493 parent, this->identity_matrix, gfx::PointF(), gfx::Size(50, 50), false); | |
4494 this->CalcDrawEtc(parent); | |
4495 | |
4496 TestOcclusionTrackerWithClip<typename Types::LayerType, | |
4497 typename Types::RenderSurfaceType> occlusion( | |
4498 gfx::Rect(0, 0, 10, 10)); | |
4499 | |
4500 this->EnterLayer(prevented, &occlusion, true); | |
4501 | |
4502 // This layer is not occluded because it is prevented. | |
4503 EXPECT_FALSE(occlusion.OccludedLayer(prevented, | |
4504 gfx::Rect(50, 50))); | |
4505 | |
4506 EXPECT_EQ(gfx::Rect(50, 50).ToString(), | |
4507 occlusion.UnoccludedLayerContentRect( | |
4508 prevented, | |
4509 gfx::Rect(50, 50)).ToString()); | |
4510 | |
4511 this->LeaveLayer(prevented, &occlusion); | |
4512 this->EnterLayer(unprevented, &occlusion, false); | |
4513 | |
4514 // This layer is clipped by the screen space clip rect. | |
4515 EXPECT_EQ(gfx::Rect(10, 10).ToString(), | |
4516 occlusion.UnoccludedLayerContentRect( | |
4517 unprevented, | |
4518 gfx::Rect(50, 50)).ToString()); | |
4519 | |
4520 this->LeaveLayer(unprevented, &occlusion); | |
4521 } | |
4522 }; | |
4523 | |
4524 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestPreventOcclusionByClipping) | |
4525 | |
4526 template <class Types> | |
4527 class OcclusionTrackerTestScaledLayerIsClipped | 3793 class OcclusionTrackerTestScaledLayerIsClipped |
4528 : public OcclusionTrackerTest<Types> { | 3794 : public OcclusionTrackerTest<Types> { |
4529 protected: | 3795 protected: |
4530 explicit OcclusionTrackerTestScaledLayerIsClipped(bool opaque_layers) | 3796 explicit OcclusionTrackerTestScaledLayerIsClipped(bool opaque_layers) |
4531 : OcclusionTrackerTest<Types>(opaque_layers) {} | 3797 : OcclusionTrackerTest<Types>(opaque_layers) {} |
4532 void RunMyTest() { | 3798 void RunMyTest() { |
4533 gfx::Transform scale_transform; | 3799 gfx::Transform scale_transform; |
4534 scale_transform.Scale(512.0, 512.0); | 3800 scale_transform.Scale(512.0, 512.0); |
4535 | 3801 |
4536 typename Types::ContentLayerType* parent = this->CreateRoot( | 3802 typename Types::ContentLayerType* parent = this->CreateRoot( |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4694 occlusion.occlusion_from_outside_target().ToString()); | 3960 occlusion.occlusion_from_outside_target().ToString()); |
4695 EXPECT_EQ(gfx::Rect().ToString(), | 3961 EXPECT_EQ(gfx::Rect().ToString(), |
4696 occlusion.occlusion_from_inside_target().ToString()); | 3962 occlusion.occlusion_from_inside_target().ToString()); |
4697 } | 3963 } |
4698 }; | 3964 }; |
4699 | 3965 |
4700 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude) | 3966 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude) |
4701 | 3967 |
4702 } // namespace | 3968 } // namespace |
4703 } // namespace cc | 3969 } // namespace cc |
OLD | NEW |