Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: cc/occlusion_tracker_unittest.cc

Issue 11583005: cc: Make occlusion tracker always work in target space. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/occlusion_tracker.h" 5 #include "cc/occlusion_tracker.h"
6 6
7 #include <public/WebFilterOperation.h> 7 #include <public/WebFilterOperation.h>
8 #include <public/WebFilterOperations.h> 8 #include <public/WebFilterOperations.h>
9 9
10 #include "cc/layer.h" 10 #include "cc/layer.h"
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); 485 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100));
486 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true); 486 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true);
487 this->calcDrawEtc(parent); 487 this->calcDrawEtc(parent);
488 488
489 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 489 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
490 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 490 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
491 491
492 this->visitLayer(layer, occlusion); 492 this->visitLayer(layer, occlusion);
493 this->enterLayer(parent, occlusion); 493 this->enterLayer(parent, occlusion);
494 494
495 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 495 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
496 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInTar getSurface().ToString()); 496 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
497 497
498 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); 498 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
499 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70))) ; 499 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70))) ;
500 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70))) ; 500 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70))) ;
501 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70))) ; 501 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70))) ;
502 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70))) ; 502 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70))) ;
503 503
504 occlusion.useDefaultLayerClipRect(); 504 occlusion.useDefaultLayerClipRect();
505 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); 505 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
506 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70))) ; 506 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70))) ;
(...skipping 28 matching lines...) Expand all
535 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::Point(0, 0), gfx::Size(100, 100)); 535 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::Point(0, 0), gfx::Size(100, 100));
536 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare nt, layerTransform, gfx::PointF(0, 0), gfx::Size(90, 90), true); 536 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare nt, layerTransform, gfx::PointF(0, 0), gfx::Size(90, 90), true);
537 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye r1, layerTransform, gfx::PointF(0, 0), gfx::Size(50, 50), true); 537 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye r1, layerTransform, gfx::PointF(0, 0), gfx::Size(50, 50), true);
538 this->calcDrawEtc(parent); 538 this->calcDrawEtc(parent);
539 539
540 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 540 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
541 541
542 this->visitLayer(layer2, occlusion); 542 this->visitLayer(layer2, occlusion);
543 this->enterLayer(layer1, occlusion); 543 this->enterLayer(layer1, occlusion);
544 544
545 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 545 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
546 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionInTar getSurface().ToString()); 546 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
547 547
548 // This checks cases where the quads don't match their "containing" 548 // This checks cases where the quads don't match their "containing"
549 // layers, e.g. in terms of transforms or clip rect. This is typical for 549 // layers, e.g. in terms of transforms or clip rect. This is typical for
550 // DelegatedRendererLayer. 550 // DelegatedRendererLayer.
551 551
552 gfx::Transform quadTransform; 552 gfx::Transform quadTransform;
553 quadTransform.Translate(30, 30); 553 quadTransform.Translate(30, 30);
554 gfx::Rect clipRectInTarget(0, 0, 100, 100); 554 gfx::Rect clipRectInTarget(0, 0, 100, 100);
555 555
556 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10, 10), quadTransform, false, clipRectInTarget).IsEmpty()); 556 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10, 10), quadTransform, false, clipRectInTarget).IsEmpty());
(...skipping 20 matching lines...) Expand all
577 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); 577 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100));
578 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); 578 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true);
579 this->calcDrawEtc(parent); 579 this->calcDrawEtc(parent);
580 580
581 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 581 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
582 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 582 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
583 583
584 this->visitLayer(layer, occlusion); 584 this->visitLayer(layer, occlusion);
585 this->enterLayer(parent, occlusion); 585 this->enterLayer(parent, occlusion);
586 586
587 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 587 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
588 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInTar getSurface().ToString()); 588 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
589 589
590 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); 590 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
591 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70))) ; 591 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70))) ;
592 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70))) ; 592 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70))) ;
593 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70))) ; 593 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70))) ;
594 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70))) ; 594 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70))) ;
595 595
596 occlusion.useDefaultLayerClipRect(); 596 occlusion.useDefaultLayerClipRect();
597 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); 597 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
598 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70))) ; 598 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70))) ;
(...skipping 28 matching lines...) Expand all
627 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); 627 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100));
628 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); 628 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true);
629 this->calcDrawEtc(parent); 629 this->calcDrawEtc(parent);
630 630
631 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 631 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
632 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 632 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
633 633
634 this->visitLayer(layer, occlusion); 634 this->visitLayer(layer, occlusion);
635 this->enterLayer(parent, occlusion); 635 this->enterLayer(parent, occlusion);
636 636
637 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 637 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
638 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), occlusion.occlusionInTar getSurface().ToString()); 638 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
639 639
640 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); 640 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50)));
641 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50))) ; 641 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50))) ;
642 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50))) ; 642 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50))) ;
643 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50))) ; 643 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50))) ;
644 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50))) ; 644 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50))) ;
645 645
646 occlusion.useDefaultLayerClipRect(); 646 occlusion.useDefaultLayerClipRect();
647 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); 647 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50)));
648 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50))) ; 648 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50))) ;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 child->setMasksToBounds(true); 694 child->setMasksToBounds(true);
695 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); 695 typename Types::ContentLayerType* layer = this->createDrawingLayer(child , this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true);
696 this->calcDrawEtc(parent); 696 this->calcDrawEtc(parent);
697 697
698 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 698 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
699 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 699 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
700 700
701 this->visitLayer(layer, occlusion); 701 this->visitLayer(layer, occlusion);
702 this->enterContributingSurface(child, occlusion); 702 this->enterContributingSurface(child, occlusion);
703 703
704 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 704 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
705 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionInTa rgetSurface().ToString()); 705 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionFrom InsideTarget().ToString());
706 706
707 this->leaveContributingSurface(child, occlusion); 707 this->leaveContributingSurface(child, occlusion);
708 this->enterLayer(parent, occlusion); 708 this->enterLayer(parent, occlusion);
709 709
710 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 710 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
711 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionInTar getSurface().ToString()); 711 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
712 712
713 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); 713 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
714 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60))) ; 714 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60))) ;
715 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60))) ; 715 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60))) ;
716 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 40, 70, 60))) ; 716 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 40, 70, 60))) ;
717 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 41, 70, 60))) ; 717 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 41, 70, 60))) ;
718 718
719 occlusion.useDefaultLayerClipRect(); 719 occlusion.useDefaultLayerClipRect();
720 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); 720 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
721 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60))) ; 721 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60))) ;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 layer2Matrix.Translate(25, 25); 772 layer2Matrix.Translate(25, 25);
773 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true); 773 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true);
774 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true); 774 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true);
775 this->calcDrawEtc(parent); 775 this->calcDrawEtc(parent);
776 776
777 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 777 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
778 778
779 this->visitLayer(occluder, occlusion); 779 this->visitLayer(occluder, occlusion);
780 this->enterLayer(layer2, occlusion); 780 this->enterLayer(layer2, occlusion);
781 781
782 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusionI nScreenSpace().ToString()); 782 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusionF romOutsideTarget().ToString());
783 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T oString()); 783 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget(). ToString());
784 784
785 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContent Rect(layer2, gfx::Rect(0, 0, 25, 25))); 785 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContent Rect(layer2, gfx::Rect(0, 0, 25, 25)));
786 EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerConte ntRect(layer2, gfx::Rect(10, 25, 25, 25))); 786 EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerConte ntRect(layer2, gfx::Rect(10, 25, 25, 25)));
787 EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerConte ntRect(layer2, gfx::Rect(25, 10, 25, 25))); 787 EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerConte ntRect(layer2, gfx::Rect(25, 10, 25, 25)));
788 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 2 5, 25, 25)).IsEmpty()); 788 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 2 5, 25, 25)).IsEmpty());
789 } 789 }
790 }; 790 };
791 791
792 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface); 792 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface);
793 793
(...skipping 16 matching lines...) Expand all
810 // |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in 810 // |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in
811 // leaveToTargetRenderSurface, as the target surface has already been se en. 811 // leaveToTargetRenderSurface, as the target surface has already been se en.
812 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); 812 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true);
813 this->calcDrawEtc(parent); 813 this->calcDrawEtc(parent);
814 814
815 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 815 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
816 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000)); 816 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000));
817 817
818 this->visitLayer(child2, occlusion); 818 this->visitLayer(child2, occlusion);
819 819
820 EXPECT_EQ(gfx::Rect(30, 30, 60, 20).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 820 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
821 EXPECT_EQ(gfx::Rect(30, 30, 60, 20).ToString(), occlusion.occlusionInTar getSurface().ToString()); 821 EXPECT_EQ(gfx::Rect(30, 30, 60, 20).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
822 822
823 this->visitLayer(layer, occlusion); 823 this->visitLayer(layer, occlusion);
824 824
825 EXPECT_EQ(UnionRegions(gfx::Rect(30, 30, 60, 10), gfx::Rect(30, 40, 70, 60)).ToString(), occlusion.occlusionInScreenSpace().ToString()); 825 EXPECT_EQ(gfx::Rect(0, 440, 20, 60).ToString(), occlusion.occlusionFromO utsideTarget().ToString());
826 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionInTa rgetSurface().ToString()); 826 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionFrom InsideTarget().ToString());
827 827
828 this->enterContributingSurface(child, occlusion); 828 this->enterContributingSurface(child, occlusion);
829 829
830 EXPECT_EQ(UnionRegions(gfx::Rect(30, 30, 60, 10), gfx::Rect(30, 40, 70, 60)).ToString(), occlusion.occlusionInScreenSpace().ToString()); 830 EXPECT_EQ(gfx::Rect(0, 440, 20, 60).ToString(), occlusion.occlusionFromO utsideTarget().ToString());
831 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionInTa rgetSurface().ToString()); 831 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionFrom InsideTarget().ToString());
832 832
833 // Occlusion in |child2| should get merged with the |child| surface we a re leaving now. 833 // Occlusion in |child2| should get merged with the |child| surface we a re leaving now.
834 this->leaveContributingSurface(child, occlusion); 834 this->leaveContributingSurface(child, occlusion);
835 this->enterLayer(parent, occlusion); 835 this->enterLayer(parent, occlusion);
836 836
837 EXPECT_EQ(UnionRegions(gfx::Rect(30, 30, 60, 10), gfx::Rect(30, 40, 70, 60)).ToString(), occlusion.occlusionInScreenSpace().ToString()); 837 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
838 EXPECT_EQ(UnionRegions(gfx::Rect(30, 30, 60, 10), gfx::Rect(30, 40, 70, 60)).ToString(), occlusion.occlusionInTargetSurface().ToString()); 838 EXPECT_EQ(UnionRegions(gfx::Rect(30, 30, 60, 10), gfx::Rect(30, 40, 70, 60)).ToString(), occlusion.occlusionFromInsideTarget().ToString());
839 839
840 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))) ; 840 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))) ;
841 EXPECT_RECT_EQ(gfx::Rect(90, 30, 10, 10), occlusion.unoccludedLayerConte ntRect(parent, gfx::Rect(30, 30, 70, 70))); 841 EXPECT_RECT_EQ(gfx::Rect(90, 30, 10, 10), occlusion.unoccludedLayerConte ntRect(parent, gfx::Rect(30, 30, 70, 70)));
842 842
843 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 60, 10))); 843 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 60, 10)));
844 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 60, 10))) ; 844 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 60, 10))) ;
845 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 60, 10))) ; 845 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 60, 10))) ;
846 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 60, 10))) ; 846 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 60, 10))) ;
847 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 60, 10))); 847 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 60, 10)));
848 848
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 this->calcDrawEtc(parent); 917 this->calcDrawEtc(parent);
918 918
919 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 919 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
920 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 920 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
921 921
922 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); 922 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect());
923 923
924 this->visitLayer(layer, occlusion); 924 this->visitLayer(layer, occlusion);
925 this->enterContributingSurface(child, occlusion); 925 this->enterContributingSurface(child, occlusion);
926 926
927 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInScreenSpace().ToS tring()); 927 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
928 EXPECT_EQ(clippedLayerInChild.ToString(), occlusion.occlusionInTargetSur face().ToString()); 928 EXPECT_EQ(clippedLayerInChild.ToString(), occlusion.occlusionFromInsideT arget().ToString());
929 929
930 EXPECT_TRUE(occlusion.occludedLayer(child, clippedLayerInChild)); 930 EXPECT_TRUE(occlusion.occludedLayer(child, clippedLayerInChild));
931 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInCh ild).IsEmpty()); 931 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInCh ild).IsEmpty());
932 clippedLayerInChild += gfx::Vector2d(-1, 0); 932 clippedLayerInChild += gfx::Vector2d(-1, 0);
933 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); 933 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
934 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty()); 934 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty());
935 clippedLayerInChild += gfx::Vector2d(1, 0); 935 clippedLayerInChild += gfx::Vector2d(1, 0);
936 clippedLayerInChild += gfx::Vector2d(1, 0); 936 clippedLayerInChild += gfx::Vector2d(1, 0);
937 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); 937 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
938 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty()); 938 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty());
939 clippedLayerInChild += gfx::Vector2d(-1, 0); 939 clippedLayerInChild += gfx::Vector2d(-1, 0);
940 clippedLayerInChild += gfx::Vector2d(0, -1); 940 clippedLayerInChild += gfx::Vector2d(0, -1);
941 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); 941 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
942 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty()); 942 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty());
943 clippedLayerInChild += gfx::Vector2d(0, 1); 943 clippedLayerInChild += gfx::Vector2d(0, 1);
944 clippedLayerInChild += gfx::Vector2d(0, 1); 944 clippedLayerInChild += gfx::Vector2d(0, 1);
945 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); 945 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
946 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty()); 946 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty());
947 clippedLayerInChild += gfx::Vector2d(0, -1); 947 clippedLayerInChild += gfx::Vector2d(0, -1);
948 948
949 this->leaveContributingSurface(child, occlusion); 949 this->leaveContributingSurface(child, occlusion);
950 this->enterLayer(parent, occlusion); 950 this->enterLayer(parent, occlusion);
951 951
952 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInScreenSpace().ToS tring()); 952 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
953 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T oString()); 953 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget(). ToString());
954 954
955 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(75, 55, 1, 1))); 955 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(75, 55, 1, 1)));
956 EXPECT_RECT_EQ(gfx::Rect(75, 55, 1, 1), occlusion.unoccludedLayerContent Rect(parent, gfx::Rect(75, 55, 1, 1))); 956 EXPECT_RECT_EQ(gfx::Rect(75, 55, 1, 1), occlusion.unoccludedLayerContent Rect(parent, gfx::Rect(75, 55, 1, 1)));
957 } 957 }
958 }; 958 };
959 959
960 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis); 960 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis);
961 961
962 template<class Types> 962 template<class Types>
963 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker Test<Types> { 963 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker Test<Types> {
(...skipping 14 matching lines...) Expand all
978 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true); 978 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true);
979 this->calcDrawEtc(parent); 979 this->calcDrawEtc(parent);
980 980
981 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 981 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
982 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 982 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
983 983
984 this->visitLayer(layer2, occlusion); 984 this->visitLayer(layer2, occlusion);
985 this->visitLayer(layer1, occlusion); 985 this->visitLayer(layer1, occlusion);
986 this->enterContributingSurface(child, occlusion); 986 this->enterContributingSurface(child, occlusion);
987 987
988 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 988 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
989 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionInTa rgetSurface().ToString()); 989 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionFrom InsideTarget().ToString());
990 990
991 EXPECT_TRUE(occlusion.occludedLayer(child, gfx::Rect(10, 430, 60, 70))); 991 EXPECT_TRUE(occlusion.occludedLayer(child, gfx::Rect(10, 430, 60, 70)));
992 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(9, 430, 60, 70))); 992 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(9, 430, 60, 70)));
993 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 429, 60, 70))) ; 993 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 429, 60, 70))) ;
994 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(11, 430, 60, 70))) ; 994 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(11, 430, 60, 70))) ;
995 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 431, 60, 70))) ; 995 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 431, 60, 70))) ;
996 996
997 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, gfx::Rect(10, 43 0, 60, 70)).IsEmpty()); 997 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, gfx::Rect(10, 43 0, 60, 70)).IsEmpty());
998 EXPECT_RECT_EQ(gfx::Rect(9, 430, 1, 70), occlusion.unoccludedLayerConten tRect(child, gfx::Rect(9, 430, 60, 70))); 998 EXPECT_RECT_EQ(gfx::Rect(9, 430, 1, 70), occlusion.unoccludedLayerConten tRect(child, gfx::Rect(9, 430, 60, 70)));
999 EXPECT_RECT_EQ(gfx::Rect(10, 429, 60, 1), occlusion.unoccludedLayerConte ntRect(child, gfx::Rect(10, 429, 60, 70))); 999 EXPECT_RECT_EQ(gfx::Rect(10, 429, 60, 1), occlusion.unoccludedLayerConte ntRect(child, gfx::Rect(10, 429, 60, 70)));
1000 EXPECT_RECT_EQ(gfx::Rect(70, 430, 1, 70), occlusion.unoccludedLayerConte ntRect(child, gfx::Rect(11, 430, 60, 70))); 1000 EXPECT_RECT_EQ(gfx::Rect(70, 430, 1, 70), occlusion.unoccludedLayerConte ntRect(child, gfx::Rect(11, 430, 60, 70)));
1001 EXPECT_RECT_EQ(gfx::Rect(10, 500, 60, 1), occlusion.unoccludedLayerConte ntRect(child, gfx::Rect(10, 431, 60, 70))); 1001 EXPECT_RECT_EQ(gfx::Rect(10, 500, 60, 1), occlusion.unoccludedLayerConte ntRect(child, gfx::Rect(10, 431, 60, 70)));
1002 1002
1003 this->leaveContributingSurface(child, occlusion); 1003 this->leaveContributingSurface(child, occlusion);
1004 this->enterLayer(parent, occlusion); 1004 this->enterLayer(parent, occlusion);
1005 1005
1006 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1006 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
1007 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionInTar getSurface().ToString()); 1007 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
1008 1008
1009 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); 1009 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
1010 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60))) ; 1010 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60))) ;
1011 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60))) ; 1011 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60))) ;
1012 1012
1013 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 4 0, 70, 60)).IsEmpty()); 1013 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 4 0, 70, 60)).IsEmpty());
1014 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerConten tRect(parent, gfx::Rect(29, 40, 70, 60))); 1014 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerConten tRect(parent, gfx::Rect(29, 40, 70, 60)));
1015 EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), occlusion.unoccludedLayerConten tRect(parent, gfx::Rect(30, 39, 70, 60))); 1015 EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), occlusion.unoccludedLayerConten tRect(parent, gfx::Rect(30, 39, 70, 60)));
1016 EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerConte ntRect(parent, gfx::Rect(31, 40, 70, 60))); 1016 EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerConte ntRect(parent, gfx::Rect(31, 40, 70, 60)));
1017 EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerConte ntRect(parent, gfx::Rect(30, 41, 70, 60))); 1017 EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerConte ntRect(parent, gfx::Rect(30, 41, 70, 60)));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); 1063 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true);
1064 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); 1064 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true);
1065 this->calcDrawEtc(parent); 1065 this->calcDrawEtc(parent);
1066 1066
1067 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1067 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1068 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); 1068 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000));
1069 1069
1070 this->visitLayer(layer2, occlusion); 1070 this->visitLayer(layer2, occlusion);
1071 this->enterContributingSurface(child2, occlusion); 1071 this->enterContributingSurface(child2, occlusion);
1072 1072
1073 EXPECT_EQ(gfx::Rect(20, 30, 80, 70).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1073 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
1074 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), occlusion.occlusionInT argetSurface().ToString()); 1074 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), occlusion.occlusionFro mInsideTarget().ToString());
1075 1075
1076 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)) ); 1076 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)) );
1077 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80) )); 1077 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80) ));
1078 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80) )); 1078 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80) ));
1079 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80) )); 1079 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80) ));
1080 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81) )); 1080 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81) ));
1081 1081
1082 occlusion.useDefaultLayerClipRect(); 1082 occlusion.useDefaultLayerClipRect();
1083 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)) ); 1083 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)) );
1084 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)) ); 1084 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)) );
1085 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)) ); 1085 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)) );
1086 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)) ); 1086 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)) );
1087 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)) ); 1087 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)) );
1088 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); 1088 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000));
1089 1089
1090 // There is nothing above child2's surface in the z-order. 1090 // There is nothing above child2's surface in the z-order.
1091 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContribu tingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80))); 1091 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContribu tingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80)));
1092 1092
1093 this->leaveContributingSurface(child2, occlusion); 1093 this->leaveContributingSurface(child2, occlusion);
1094 this->visitLayer(layer1, occlusion); 1094 this->visitLayer(layer1, occlusion);
1095 this->enterContributingSurface(child1, occlusion); 1095 this->enterContributingSurface(child1, occlusion);
1096 1096
1097 EXPECT_EQ(UnionRegions(gfx::Rect(30, 20, 70, 10), gfx::Rect(20, 30, 80, 70)).ToString(), occlusion.occlusionInScreenSpace().ToString()); 1097 EXPECT_EQ(gfx::Rect(0, 430, 70, 80).ToString(), occlusion.occlusionFromO utsideTarget().ToString());
1098 EXPECT_EQ(gfx::Rect(-10, 430, 80, 70).ToString(), occlusion.occlusionInT argetSurface().ToString()); 1098 EXPECT_EQ(gfx::Rect(-10, 430, 80, 70).ToString(), occlusion.occlusionFro mInsideTarget().ToString());
1099 1099
1100 EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 70)) ); 1100 EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 70)) );
1101 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-11, 430, 80, 70) )); 1101 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-11, 430, 80, 70) ));
1102 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 429, 80, 70) )); 1102 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 429, 80, 70) ));
1103 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 81, 70) )); 1103 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 81, 70) ));
1104 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 71) )); 1104 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 71) ));
1105 1105
1106 // child2's contents will occlude child1 below it. 1106 // child2's contents will occlude child1 below it.
1107 EXPECT_RECT_EQ(gfx::Rect(-10, 430, 10, 70), occlusion.unoccludedContribu tingSurfaceContentRect(child1, false, gfx::Rect(-10, 430, 80, 70))); 1107 EXPECT_RECT_EQ(gfx::Rect(-10, 430, 10, 70), occlusion.unoccludedContribu tingSurfaceContentRect(child1, false, gfx::Rect(-10, 430, 80, 70)));
1108 1108
1109 this->leaveContributingSurface(child1, occlusion); 1109 this->leaveContributingSurface(child1, occlusion);
1110 this->enterLayer(parent, occlusion); 1110 this->enterLayer(parent, occlusion);
1111 1111
1112 EXPECT_EQ(UnionRegions(gfx::Rect(30, 20, 70, 10), gfx::Rect(20, 30, 80, 70)).ToString(), occlusion.occlusionInScreenSpace().ToString()); 1112 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
1113 EXPECT_EQ(UnionRegions(gfx::Rect(30, 20, 70, 10), gfx::Rect(20, 30, 80, 70)).ToString(), occlusion.occlusionInTargetSurface().ToString()); 1113 EXPECT_EQ(UnionRegions(gfx::Rect(30, 20, 70, 10), gfx::Rect(20, 30, 80, 70)).ToString(), occlusion.occlusionFromInsideTarget().ToString());
1114 1114
1115 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 20, 80, 80))) ; 1115 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 20, 80, 80))) ;
1116 1116
1117 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 20, 70, 80))); 1117 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 20, 70, 80)));
1118 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 20, 70, 80))) ; 1118 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 20, 70, 80))) ;
1119 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 19, 70, 80))) ; 1119 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 19, 70, 80))) ;
1120 1120
1121 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(20, 30, 80, 70))); 1121 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(20, 30, 80, 70)));
1122 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(19, 30, 80, 70))) ; 1122 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(19, 30, 80, 70))) ;
1123 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 29, 80, 70))) ; 1123 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 29, 80, 70))) ;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true); 1173 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true);
1174 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); 1174 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true);
1175 this->calcDrawEtc(parent); 1175 this->calcDrawEtc(parent);
1176 1176
1177 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1177 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1178 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000)); 1178 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000));
1179 1179
1180 this->visitLayer(layer2, occlusion); 1180 this->visitLayer(layer2, occlusion);
1181 this->enterLayer(child2, occlusion); 1181 this->enterLayer(child2, occlusion);
1182 1182
1183 EXPECT_EQ(gfx::Rect(20, 30, 80, 70).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1183 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
1184 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), occlusion.occlusionInT argetSurface().ToString()); 1184 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), occlusion.occlusionFro mInsideTarget().ToString());
1185 1185
1186 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)) ); 1186 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)) );
1187 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80) )); 1187 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80) ));
1188 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80) )); 1188 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80) ));
1189 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80) )); 1189 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80) ));
1190 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81) )); 1190 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81) ));
1191 1191
1192 this->leaveLayer(child2, occlusion); 1192 this->leaveLayer(child2, occlusion);
1193 this->enterContributingSurface(child2, occlusion); 1193 this->enterContributingSurface(child2, occlusion);
1194 1194
1195 // There is nothing above child2's surface in the z-order. 1195 // There is nothing above child2's surface in the z-order.
1196 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContribu tingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80))); 1196 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContribu tingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80)));
1197 1197
1198 this->leaveContributingSurface(child2, occlusion); 1198 this->leaveContributingSurface(child2, occlusion);
1199 this->visitLayer(layer1, occlusion); 1199 this->visitLayer(layer1, occlusion);
1200 this->enterContributingSurface(child1, occlusion); 1200 this->enterContributingSurface(child1, occlusion);
1201 1201
1202 EXPECT_EQ(gfx::Rect(10, 20, 90, 80).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1202 EXPECT_EQ(gfx::Rect(420, -10, 70, 80).ToString(), occlusion.occlusionFro mOutsideTarget().ToString());
1203 EXPECT_EQ(gfx::Rect(420, -20, 80, 90).ToString(), occlusion.occlusionInT argetSurface().ToString()); 1203 EXPECT_EQ(gfx::Rect(420, -20, 80, 90).ToString(), occlusion.occlusionFro mInsideTarget().ToString());
1204 1204
1205 EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(420, -20, 80, 90)) ); 1205 EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(420, -20, 80, 90)) );
1206 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(419, -20, 80, 90) )); 1206 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(419, -20, 80, 90) ));
1207 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -21, 80, 90) )); 1207 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -21, 80, 90) ));
1208 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -19, 80, 90) )); 1208 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -19, 80, 90) ));
1209 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(421, -20, 80, 90) )); 1209 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(421, -20, 80, 90) ));
1210 1210
1211 // child2's contents will occlude child1 below it. 1211 // child2's contents will occlude child1 below it.
1212 EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.unoccludedContribu tingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 80, 90))); 1212 EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.unoccludedContribu tingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 80, 90)));
1213 EXPECT_RECT_EQ(gfx::Rect(490, -10, 10, 80), occlusion.unoccludedContribu tingSurfaceContentRect(child1, false, gfx::Rect(420, -10, 80, 90))); 1213 EXPECT_RECT_EQ(gfx::Rect(490, -10, 10, 80), occlusion.unoccludedContribu tingSurfaceContentRect(child1, false, gfx::Rect(420, -10, 80, 90)));
1214 EXPECT_RECT_EQ(gfx::Rect(420, -20, 70, 10), occlusion.unoccludedContribu tingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 70, 90))); 1214 EXPECT_RECT_EQ(gfx::Rect(420, -20, 70, 10), occlusion.unoccludedContribu tingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 70, 90)));
1215 1215
1216 this->leaveContributingSurface(child1, occlusion); 1216 this->leaveContributingSurface(child1, occlusion);
1217 this->enterLayer(parent, occlusion); 1217 this->enterLayer(parent, occlusion);
1218 1218
1219 EXPECT_EQ(gfx::Rect(10, 20, 90, 80).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1219 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
1220 EXPECT_EQ(gfx::Rect(10, 20, 90, 80).ToString(), occlusion.occlusionInTar getSurface().ToString()); 1220 EXPECT_EQ(gfx::Rect(10, 20, 90, 80).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
1221 1221
1222 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(10, 20, 90, 80))); 1222 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(10, 20, 90, 80)));
1223 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(9, 20, 90, 80))); 1223 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(9, 20, 90, 80)));
1224 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 19, 90, 80))) ; 1224 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 19, 90, 80))) ;
1225 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(11, 20, 90, 80))) ; 1225 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(11, 20, 90, 80))) ;
1226 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 21, 90, 80))) ; 1226 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 21, 90, 80))) ;
1227 1227
1228 /* Justification for the above occlusion: 1228 /* Justification for the above occlusion:
1229 100 1229 100
1230 +---------------------+ 1230 +---------------------+
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 1284
1285 this->calcDrawEtc(parent); 1285 this->calcDrawEtc(parent);
1286 1286
1287 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1287 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1288 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1288 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1289 1289
1290 // Opacity layer won't contribute to occlusion. 1290 // Opacity layer won't contribute to occlusion.
1291 this->visitLayer(opacityLayer, occlusion); 1291 this->visitLayer(opacityLayer, occlusion);
1292 this->enterContributingSurface(opacityLayer, occlusion); 1292 this->enterContributingSurface(opacityLayer, occlusion);
1293 1293
1294 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); 1294 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1295 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); 1295 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty());
1296 1296
1297 // And has nothing to contribute to its parent surface. 1297 // And has nothing to contribute to its parent surface.
1298 this->leaveContributingSurface(opacityLayer, occlusion); 1298 this->leaveContributingSurface(opacityLayer, occlusion);
1299 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); 1299 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1300 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); 1300 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty());
1301 1301
1302 // Opaque layer will contribute to occlusion. 1302 // Opaque layer will contribute to occlusion.
1303 this->visitLayer(opaqueLayer, occlusion); 1303 this->visitLayer(opaqueLayer, occlusion);
1304 this->enterContributingSurface(opaqueLayer, occlusion); 1304 this->enterContributingSurface(opaqueLayer, occlusion);
1305 1305
1306 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1306 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1307 EXPECT_EQ(gfx::Rect(0, 430, 70, 70).ToString(), occlusion.occlusionInTar getSurface().ToString()); 1307 EXPECT_EQ(gfx::Rect(0, 430, 70, 70).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
1308 1308
1309 // And it gets translated to the parent surface. 1309 // And it gets translated to the parent surface.
1310 this->leaveContributingSurface(opaqueLayer, occlusion); 1310 this->leaveContributingSurface(opaqueLayer, occlusion);
1311 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1311 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1312 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInTar getSurface().ToString()); 1312 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
1313 1313
1314 // The blur layer needs to throw away any occlusion from outside its sub tree. 1314 // The blur layer needs to throw away any occlusion from outside its sub tree.
1315 this->enterLayer(blurLayer, occlusion); 1315 this->enterLayer(blurLayer, occlusion);
1316 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); 1316 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1317 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); 1317 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty());
1318 1318
1319 // And it won't contribute to occlusion. 1319 // And it won't contribute to occlusion.
1320 this->leaveLayer(blurLayer, occlusion); 1320 this->leaveLayer(blurLayer, occlusion);
1321 this->enterContributingSurface(blurLayer, occlusion); 1321 this->enterContributingSurface(blurLayer, occlusion);
1322 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); 1322 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1323 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); 1323 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty());
1324 1324
1325 // But the opaque layer's occlusion is preserved on the parent. 1325 // But the opaque layer's occlusion is preserved on the parent.
1326 this->leaveContributingSurface(blurLayer, occlusion); 1326 this->leaveContributingSurface(blurLayer, occlusion);
1327 this->enterLayer(parent, occlusion); 1327 this->enterLayer(parent, occlusion);
1328 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1328 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1329 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionInTar getSurface().ToString()); 1329 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
1330 } 1330 }
1331 }; 1331 };
1332 1332
1333 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); 1333 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters);
1334 1334
1335 template<class Types> 1335 template<class Types>
1336 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types > { 1336 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types > {
1337 protected: 1337 protected:
1338 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {} 1338 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker Test<Types>(opaqueLayers) {}
1339 void runMyTest() 1339 void runMyTest()
1340 { 1340 {
1341 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); 1341 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200));
1342 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); 1342 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true);
1343 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size()); 1343 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size());
1344 this->calcDrawEtc(parent); 1344 this->calcDrawEtc(parent);
1345 1345
1346 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1346 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1347 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1347 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1348 1348
1349 this->visitLayer(surface, occlusion); 1349 this->visitLayer(surface, occlusion);
1350 1350
1351 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1351 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns ideTarget().ToString());
1352 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionInTarge tSurface().ToString());
1353 1352
1354 this->visitContributingSurface(surface, occlusion); 1353 this->visitContributingSurface(surface, occlusion);
1355 this->enterLayer(parent, occlusion); 1354 this->enterLayer(parent, occlusion);
1356 1355
1357 // The surface and replica should both be occluding the parent. 1356 // The surface and replica should both be occluding the parent.
1358 EXPECT_EQ(UnionRegions(gfx::Rect(0, 100, 50, 50), gfx::Rect(50, 150, 50, 50)).ToString(), occlusion.occlusionInTargetSurface().ToString()); 1357 EXPECT_EQ(UnionRegions(gfx::Rect(0, 100, 50, 50), gfx::Rect(50, 150, 50, 50)).ToString(), occlusion.occlusionFromInsideTarget().ToString());
1359 } 1358 }
1360 }; 1359 };
1361 1360
1362 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); 1361 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude);
1363 1362
1364 template<class Types> 1363 template<class Types>
1365 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type s> { 1364 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type s> {
1366 protected: 1365 protected:
1367 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 1366 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
1368 void runMyTest() 1367 void runMyTest()
1369 { 1368 {
1370 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170)); 1369 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170));
1371 parent->setMasksToBounds(true); 1370 parent->setMasksToBounds(true);
1372 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); 1371 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true);
1373 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size()); 1372 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size());
1374 this->calcDrawEtc(parent); 1373 this->calcDrawEtc(parent);
1375 1374
1376 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1375 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1377 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1376 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1378 1377
1379 this->visitLayer(surface, occlusion); 1378 this->visitLayer(surface, occlusion);
1380 1379
1381 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1380 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns ideTarget().ToString());
1382 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionInTarge tSurface().ToString());
1383 1381
1384 this->visitContributingSurface(surface, occlusion); 1382 this->visitContributingSurface(surface, occlusion);
1385 this->enterLayer(parent, occlusion); 1383 this->enterLayer(parent, occlusion);
1386 1384
1387 // The surface and replica should both be occluding the parent. 1385 // The surface and replica should both be occluding the parent.
1388 EXPECT_EQ(UnionRegions(gfx::Rect(0, 100, 50, 50), gfx::Rect(50, 150, 50, 20)).ToString(), occlusion.occlusionInTargetSurface().ToString()); 1386 EXPECT_EQ(UnionRegions(gfx::Rect(0, 100, 50, 50), gfx::Rect(50, 150, 50, 20)).ToString(), occlusion.occlusionFromInsideTarget().ToString());
1389 } 1387 }
1390 }; 1388 };
1391 1389
1392 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); 1390 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping);
1393 1391
1394 template<class Types> 1392 template<class Types>
1395 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { 1393 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> {
1396 protected: 1394 protected:
1397 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {} 1395 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {}
1398 void runMyTest() 1396 void runMyTest()
1399 { 1397 {
1400 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); 1398 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200));
1401 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); 1399 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true);
1402 typename Types::LayerType* replica = this->createReplicaLayer(surface, t his->identityMatrix, gfx::PointF(50, 50), gfx::Size()); 1400 typename Types::LayerType* replica = this->createReplicaLayer(surface, t his->identityMatrix, gfx::PointF(50, 50), gfx::Size());
1403 this->createMaskLayer(replica, gfx::Size(10, 10)); 1401 this->createMaskLayer(replica, gfx::Size(10, 10));
1404 this->calcDrawEtc(parent); 1402 this->calcDrawEtc(parent);
1405 1403
1406 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1404 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1407 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1405 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1408 1406
1409 this->visitLayer(surface, occlusion); 1407 this->visitLayer(surface, occlusion);
1410 1408
1411 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 1409 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns ideTarget().ToString());
1412 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionInTarge tSurface().ToString());
1413 1410
1414 this->visitContributingSurface(surface, occlusion); 1411 this->visitContributingSurface(surface, occlusion);
1415 this->enterLayer(parent, occlusion); 1412 this->enterLayer(parent, occlusion);
1416 1413
1417 // The replica should not be occluding the parent, since it has a mask a pplied to it. 1414 // The replica should not be occluding the parent, since it has a mask a pplied to it.
1418 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), occlusion.occlusionInTar getSurface().ToString()); 1415 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
1419 } 1416 }
1420 }; 1417 };
1421 1418
1422 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); 1419 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask);
1423 1420
1424 template<class Types> 1421 template<class Types>
1425 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes t<Types> { 1422 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes t<Types> {
1426 protected: 1423 protected:
1427 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {} 1424 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion TrackerTest<Types>(opaqueLayers) {}
1428 void runMyTest() 1425 void runMyTest()
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 1812
1816 // Test without any clip rect. 1813 // Test without any clip rect.
1817 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 1814 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
1818 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100 ))); 1815 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100 )));
1819 occlusion.useDefaultLayerClipRect(); 1816 occlusion.useDefaultLayerClipRect();
1820 1817
1821 this->leaveLayer(layer, occlusion); 1818 this->leaveLayer(layer, occlusion);
1822 this->visitContributingSurface(layer, occlusion); 1819 this->visitContributingSurface(layer, occlusion);
1823 this->enterLayer(parent, occlusion); 1820 this->enterLayer(parent, occlusion);
1824 1821
1825 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); 1822 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1826 } 1823 }
1827 }; 1824 };
1828 1825
1829 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); 1826 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty);
1830 1827
1831 template<class Types> 1828 template<class Types>
1832 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker Test<Types> { 1829 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker Test<Types> {
1833 protected: 1830 protected:
1834 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 1831 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
1835 void runMyTest() 1832 void runMyTest()
1836 { 1833 {
1837 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); 1834 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300));
1838 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(200, 200), false); 1835 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(200, 200), false);
1839 this->calcDrawEtc(parent); 1836 this->calcDrawEtc(parent);
1840 1837
1841 { 1838 {
1842 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1839 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1843 layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100)); 1840 layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100));
1844 1841
1845 this->resetLayerIterator(); 1842 this->resetLayerIterator();
1846 this->visitLayer(layer, occlusion); 1843 this->visitLayer(layer, occlusion);
1847 this->enterLayer(parent, occlusion); 1844 this->enterLayer(parent, occlusion);
1848 1845
1849 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlus ionInScreenSpace().ToString()); 1846 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlus ionFromInsideTarget().ToString());
1850 1847
1851 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))); 1848 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
1852 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100))); 1849 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
1853 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100 , 100))); 1850 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100 , 100)));
1854 } 1851 }
1855 1852
1856 { 1853 {
1857 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1854 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1858 layer->setOpaqueContentsRect(gfx::Rect(20, 20, 180, 180)); 1855 layer->setOpaqueContentsRect(gfx::Rect(20, 20, 180, 180));
1859 1856
1860 this->resetLayerIterator(); 1857 this->resetLayerIterator();
1861 this->visitLayer(layer, occlusion); 1858 this->visitLayer(layer, occlusion);
1862 this->enterLayer(parent, occlusion); 1859 this->enterLayer(parent, occlusion);
1863 1860
1864 EXPECT_EQ(gfx::Rect(120, 120, 180, 180).ToString(), occlusion.occlus ionInScreenSpace().ToString()); 1861 EXPECT_EQ(gfx::Rect(120, 120, 180, 180).ToString(), occlusion.occlus ionFromInsideTarget().ToString());
1865 1862
1866 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))); 1863 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
1867 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100 , 100))); 1864 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100 , 100)));
1868 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100))); 1865 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
1869 } 1866 }
1870 1867
1871 { 1868 {
1872 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1869 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1873 layer->setOpaqueContentsRect(gfx::Rect(150, 150, 100, 100)); 1870 layer->setOpaqueContentsRect(gfx::Rect(150, 150, 100, 100));
1874 1871
1875 this->resetLayerIterator(); 1872 this->resetLayerIterator();
1876 this->visitLayer(layer, occlusion); 1873 this->visitLayer(layer, occlusion);
1877 this->enterLayer(parent, occlusion); 1874 this->enterLayer(parent, occlusion);
1878 1875
1879 EXPECT_EQ(gfx::Rect(250, 250, 50, 50).ToString(), occlusion.occlusio nInScreenSpace().ToString()); 1876 EXPECT_EQ(gfx::Rect(250, 250, 50, 50).ToString(), occlusion.occlusio nFromInsideTarget().ToString());
1880 1877
1881 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))); 1878 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
1882 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100 , 100))); 1879 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100 , 100)));
1883 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100 , 100))); 1880 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100 , 100)));
1884 } 1881 }
1885 } 1882 }
1886 }; 1883 };
1887 1884
1888 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); 1885 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty);
1889 1886
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 1928
1932 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); 1929 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300));
1933 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare nt, translationToBack, gfx::PointF(0, 0), gfx::Size(100, 100), true); 1930 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare nt, translationToBack, gfx::PointF(0, 0), gfx::Size(100, 100), true);
1934 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, translationToFront, gfx::PointF(50, 50), gfx::Size(100, 100), true); 1931 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare nt, translationToFront, gfx::PointF(50, 50), gfx::Size(100, 100), true);
1935 parent->setPreserves3D(true); 1932 parent->setPreserves3D(true);
1936 1933
1937 this->calcDrawEtc(parent); 1934 this->calcDrawEtc(parent);
1938 1935
1939 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 1936 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
1940 this->visitLayer(child2, occlusion); 1937 this->visitLayer(child2, occlusion);
1941 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); 1938 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1942 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); 1939 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty());
1943 1940
1944 this->visitLayer(child1, occlusion); 1941 this->visitLayer(child1, occlusion);
1945 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); 1942 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
1946 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); 1943 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty());
1947 } 1944 }
1948 }; 1945 };
1949 1946
1950 // This test will have different layer ordering on the impl thread; the test wil l only work on the main thread. 1947 // This test will have different layer ordering on the impl thread; the test wil l only work on the main thread.
1951 MAIN_THREAD_TEST(OcclusionTrackerTestUnsorted3dLayers); 1948 MAIN_THREAD_TEST(OcclusionTrackerTestUnsorted3dLayers);
1952 1949
1953 template<class Types> 1950 template<class Types>
1954 class OcclusionTrackerTestPerspectiveTransform : public OcclusionTrackerTest<Typ es> { 1951 class OcclusionTrackerTestPerspectiveTransform : public OcclusionTrackerTest<Typ es> {
1955 protected: 1952 protected:
1956 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack erTest<Types>(opaqueLayers) {} 1953 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack erTest<Types>(opaqueLayers) {}
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); 2026 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true);
2030 parent->setPreserves3D(true); 2027 parent->setPreserves3D(true);
2031 layer->setPreserves3D(true); 2028 layer->setPreserves3D(true);
2032 this->calcDrawEtc(parent); 2029 this->calcDrawEtc(parent);
2033 2030
2034 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2031 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2035 2032
2036 // The |layer| is entirely behind the camera and should not occlude. 2033 // The |layer| is entirely behind the camera and should not occlude.
2037 this->visitLayer(layer, occlusion); 2034 this->visitLayer(layer, occlusion);
2038 this->enterLayer(parent, occlusion); 2035 this->enterLayer(parent, occlusion);
2039 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); 2036 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty());
2040 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); 2037 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty());
2041 } 2038 }
2042 }; 2039 };
2043 2040
2044 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read. 2041 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read.
2045 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); 2042 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude);
2046 2043
2047 template<class Types> 2044 template<class Types>
2048 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra ckerTest<Types> { 2045 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra ckerTest<Types> {
2049 protected: 2046 protected:
2050 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {} 2047 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc clusionTrackerTest<Types>(opaqueLayers) {}
(...skipping 11 matching lines...) Expand all
2062 parent->setPreserves3D(true); 2059 parent->setPreserves3D(true);
2063 layer->setPreserves3D(true); 2060 layer->setPreserves3D(true);
2064 this->calcDrawEtc(parent); 2061 this->calcDrawEtc(parent);
2065 2062
2066 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2063 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2067 2064
2068 // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect. 2065 // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect.
2069 // Ensure that those pixels don't occlude things outside the clipRect. 2066 // Ensure that those pixels don't occlude things outside the clipRect.
2070 this->visitLayer(layer, occlusion); 2067 this->visitLayer(layer, occlusion);
2071 this->enterLayer(parent, occlusion); 2068 this->enterLayer(parent, occlusion);
2072 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2069 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2073 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 2070 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2074 } 2071 }
2075 }; 2072 };
2076 2073
2077 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read. 2074 // This test requires accumulating occlusion of 3d layers, which are skipped by the occlusion tracker on the main thread. So this test should run on the impl th read.
2078 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); 2075 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect);
2079 2076
2080 template<class Types> 2077 template<class Types>
2081 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke rTest<Types> { 2078 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke rTest<Types> {
2082 protected: 2079 protected:
2083 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {} 2080 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu sionTrackerTest<Types>(opaqueLayers) {}
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 EXPECT_FALSE(surface->drawTransformIsAnimating()); 2206 EXPECT_FALSE(surface->drawTransformIsAnimating());
2210 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating()); 2207 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating());
2211 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); 2208 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating());
2212 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); 2209 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating());
2213 2210
2214 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2211 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2215 2212
2216 this->visitLayer(surface2, occlusion); 2213 this->visitLayer(surface2, occlusion);
2217 this->enterContributingSurface(surface2, occlusion); 2214 this->enterContributingSurface(surface2, occlusion);
2218 2215
2219 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), occlusion.occlusionInScre enSpace().ToString()); 2216 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), occlusion.occlusionFromIn sideTarget().ToString());
2220 2217
2221 this->leaveContributingSurface(surface2, occlusion); 2218 this->leaveContributingSurface(surface2, occlusion);
2222 this->enterLayer(surfaceChild2, occlusion); 2219 this->enterLayer(surfaceChild2, occlusion);
2223 2220
2224 // surfaceChild2 is moving in screen space but not relative to its targe t, so occlusion should happen in its target space only. 2221 // surfaceChild2 is moving in screen space but not relative to its targe t, so occlusion should happen in its target space only.
2225 // It also means that things occluding in screen space (e.g. surface2) c annot occlude this layer. 2222 // It also means that things occluding from outside the target (e.g. sur face2) cannot occlude this layer.
2223 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2224
2226 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.unoccludedLayerConte ntRect(surfaceChild2, gfx::Rect(0, 0, 100, 300))); 2225 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.unoccludedLayerConte ntRect(surfaceChild2, gfx::Rect(0, 0, 100, 300)));
2227 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 3 00))); 2226 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 3 00)));
2228 2227
2229 this->leaveLayer(surfaceChild2, occlusion); 2228 this->leaveLayer(surfaceChild2, occlusion);
2230 this->enterLayer(surfaceChild, occlusion); 2229 this->enterLayer(surfaceChild, occlusion);
2231 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 100, 300))); 2230 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 100, 300)));
2232 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), occlusion.occlusionInScre enSpace().ToString()); 2231 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2233 EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2232 EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2234 EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerCon tentRect(surface, gfx::Rect(0, 0, 300, 300))); 2233 EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerCon tentRect(surface, gfx::Rect(0, 0, 300, 300)));
2235 2234
2236 // The surfaceChild is occluded by the surfaceChild2, but is moving rela tive its target and the screen, so it 2235 // The surfaceChild is occluded by the surfaceChild2, but is moving rela tive its target, so it can't be occluded.
2237 // can't be occluded.
2238 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 300), occlusion.unoccludedLayerConte ntRect(surfaceChild, gfx::Rect(0, 0, 200, 300))); 2236 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 300), occlusion.unoccludedLayerConte ntRect(surfaceChild, gfx::Rect(0, 0, 200, 300)));
2239 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 3 00))); 2237 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 3 00)));
2240 2238
2241 this->leaveLayer(surfaceChild, occlusion); 2239 this->leaveLayer(surfaceChild, occlusion);
2242 this->enterLayer(surface, occlusion); 2240 this->enterLayer(surface, occlusion);
2243 // The surfaceChild is moving in screen space but not relative to its ta rget, so occlusion should happen in its target space only. 2241 // The surfaceChild is moving in screen space but not relative to its ta rget, so occlusion should happen from within the target only.
2244 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), occlusion.occlusionInScre enSpace().ToString()); 2242 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2245 EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2243 EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2246 EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerCon tentRect(surface, gfx::Rect(0, 0, 300, 300))); 2244 EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerCon tentRect(surface, gfx::Rect(0, 0, 300, 300)));
2247 2245
2248 this->leaveLayer(surface, occlusion); 2246 this->leaveLayer(surface, occlusion);
2249 // The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen in its target space only. 2247 // The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen within the target only.
2250 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), occlusion.occlusionInScre enSpace().ToString()); 2248 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2251 EXPECT_EQ(gfx::Rect(0, 0, 300, 300).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2249 EXPECT_EQ(gfx::Rect(0, 0, 300, 300).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2252 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedLayerContentRe ct(surface, gfx::Rect(0, 0, 300, 300))); 2250 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedLayerContentRe ct(surface, gfx::Rect(0, 0, 300, 300)));
2253 2251
2254 this->enterContributingSurface(surface, occlusion); 2252 this->enterContributingSurface(surface, occlusion);
2255 // The contributing |surface| is animating so it can't be occluded. 2253 // The contributing |surface| is animating so it can't be occluded.
2256 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.unoccludedContributi ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300))); 2254 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.unoccludedContributi ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300)));
2257 this->leaveContributingSurface(surface, occlusion); 2255 this->leaveContributingSurface(surface, occlusion);
2258 2256
2259 this->enterLayer(layer, occlusion); 2257 this->enterLayer(layer, occlusion);
2260 // The |surface| is moving in the screen and in its target, so all occlu sion within the surface is lost when leaving it. 2258 // The |surface| is moving in the screen and in its target, so all occlu sion within the surface is lost when leaving it.
2261 EXPECT_RECT_EQ(gfx::Rect(50, 0, 250, 300), occlusion.unoccludedLayerCont entRect(parent, gfx::Rect(0, 0, 300, 300))); 2259 EXPECT_RECT_EQ(gfx::Rect(50, 0, 250, 300), occlusion.unoccludedLayerCont entRect(parent, gfx::Rect(0, 0, 300, 300)));
(...skipping 23 matching lines...) Expand all
2285 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(300, 300), false); 2283 typename Types::ContentLayerType* surface2 = this->createDrawingSurface( parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(300, 300), false);
2286 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); 2284 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
2287 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); 2285 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
2288 this->calcDrawEtc(parent); 2286 this->calcDrawEtc(parent);
2289 2287
2290 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2288 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2291 2289
2292 this->visitLayer(surface2, occlusion); 2290 this->visitLayer(surface2, occlusion);
2293 this->visitContributingSurface(surface2, occlusion); 2291 this->visitContributingSurface(surface2, occlusion);
2294 2292
2295 EXPECT_EQ(gfx::Rect(50, 50, 200, 200).ToString(), occlusion.occlusionInS creenSpace().ToString()); 2293 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2296 EXPECT_EQ(gfx::Rect(50, 50, 200, 200).ToString(), occlusion.occlusionInT argetSurface().ToString()); 2294 EXPECT_EQ(gfx::Rect(50, 50, 200, 200).ToString(), occlusion.occlusionFro mInsideTarget().ToString());
2297 2295
2298 // Clear any stored occlusion. 2296 // Clear any stored occlusion.
2299 occlusion.setOcclusionInScreenSpace(Region()); 2297 occlusion.setOcclusionFromOutsideTarget(Region());
2300 occlusion.setOcclusionInTargetSurface(Region()); 2298 occlusion.setOcclusionFromInsideTarget(Region());
2301 2299
2302 this->visitLayer(surface, occlusion); 2300 this->visitLayer(surface, occlusion);
2303 this->visitContributingSurface(surface, occlusion); 2301 this->visitContributingSurface(surface, occlusion);
2304 2302
2305 EXPECT_EQ(gfx::Rect(0, 0, 400, 400).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 2303 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2306 EXPECT_EQ(gfx::Rect(0, 0, 400, 400).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2304 EXPECT_EQ(gfx::Rect(0, 0, 400, 400).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2307 } 2305 }
2308 }; 2306 };
2309 2307
2310 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent ); 2308 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent );
2311 2309
2312 template<class Types> 2310 template<class Types>
2313 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus ionTrackerTest<Types> { 2311 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus ionTrackerTest<Types> {
2314 protected: 2312 protected:
2315 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers ) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2313 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers ) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2316 void runMyTest() 2314 void runMyTest()
2317 { 2315 {
2318 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); 2316 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300));
2319 parent->setMasksToBounds(true); 2317 parent->setMasksToBounds(true);
2320 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(500, 300), false); 2318 typename Types::ContentLayerType* surface = this->createDrawingSurface(p arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(500, 300), false);
2321 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); 2319 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200));
2322 this->calcDrawEtc(parent); 2320 this->calcDrawEtc(parent);
2323 2321
2324 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2322 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2325 2323
2326 this->visitLayer(surface, occlusion); 2324 this->visitLayer(surface, occlusion);
2327 this->visitContributingSurface(surface, occlusion); 2325 this->visitContributingSurface(surface, occlusion);
2328 2326
2329 EXPECT_EQ(gfx::Rect(0, 0, 300, 200).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 2327 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2330 EXPECT_EQ(gfx::Rect(0, 0, 300, 200).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2328 EXPECT_EQ(gfx::Rect(0, 0, 300, 200).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2331 } 2329 }
2332 }; 2330 };
2333 2331
2334 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip ping); 2332 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip ping);
2335 2333
2336 template<class Types> 2334 template<class Types>
2337 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { 2335 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> {
2338 protected: 2336 protected:
2339 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {} 2337 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes t<Types>(opaqueLayers) {}
2340 void runMyTest() 2338 void runMyTest()
2341 { 2339 {
2342 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); 2340 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200));
2343 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); 2341 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true);
2344 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1 00), gfx::Size(100, 100)); 2342 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1 00), gfx::Size(100, 100));
2345 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, gfx::PointF(0, 100), gfx::Size(100, 100), true); 2343 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, gfx::PointF(0, 100), gfx::Size(100, 100), true);
2346 this->calcDrawEtc(parent); 2344 this->calcDrawEtc(parent);
2347 2345
2348 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2346 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2349 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2347 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2350 2348
2351 // |topmost| occludes the replica, but not the surface itself. 2349 // |topmost| occludes the replica, but not the surface itself.
2352 this->visitLayer(topmost, occlusion); 2350 this->visitLayer(topmost, occlusion);
2353 2351
2354 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusionInS creenSpace().ToString()); 2352 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2355 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusionInT argetSurface().ToString()); 2353 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusionFro mInsideTarget().ToString());
2356 2354
2357 this->visitLayer(surface, occlusion); 2355 this->visitLayer(surface, occlusion);
2358 2356
2359 EXPECT_EQ(gfx::Rect(0, 0, 100, 200).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 2357 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusionFro mOutsideTarget().ToString());
2360 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2358 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2361 2359
2362 this->enterContributingSurface(surface, occlusion); 2360 this->enterContributingSurface(surface, occlusion);
2363 2361
2364 // Surface is not occluded so it shouldn't think it is. 2362 // Surface is not occluded so it shouldn't think it is.
2365 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedContributi ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); 2363 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedContributi ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
2366 } 2364 }
2367 }; 2365 };
2368 2366
2369 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); 2367 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded);
2370 2368
2371 template<class Types> 2369 template<class Types>
2372 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker Test<Types> { 2370 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker Test<Types> {
2373 protected: 2371 protected:
2374 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {} 2372 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus ionTrackerTest<Types>(opaqueLayers) {}
2375 void runMyTest() 2373 void runMyTest()
2376 { 2374 {
2377 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); 2375 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200));
2378 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); 2376 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true);
2379 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1 00), gfx::Size(100, 100)); 2377 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1 00), gfx::Size(100, 100));
2380 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 110), true); 2378 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 110), true);
2381 this->calcDrawEtc(parent); 2379 this->calcDrawEtc(parent);
2382 2380
2383 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2381 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2384 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2382 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2385 2383
2386 // |topmost| occludes the surface, but not the entire surface's replica. 2384 // |topmost| occludes the surface, but not the entire surface's replica.
2387 this->visitLayer(topmost, occlusion); 2385 this->visitLayer(topmost, occlusion);
2388 2386
2389 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 2387 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2390 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2388 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2391 2389
2392 this->visitLayer(surface, occlusion); 2390 this->visitLayer(surface, occlusion);
2393 2391
2394 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionInScr eenSpace().ToString()); 2392 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionFromO utsideTarget().ToString());
2395 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2393 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2396 2394
2397 this->enterContributingSurface(surface, occlusion); 2395 this->enterContributingSurface(surface, occlusion);
2398 2396
2399 // Surface is occluded, but only the top 10px of the replica. 2397 // Surface is occluded, but only the top 10px of the replica.
2400 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedContributingSu rfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); 2398 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedContributingSu rfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
2401 EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 90), occlusion.unoccludedContributi ngSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100))); 2399 EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 90), occlusion.unoccludedContributi ngSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100)));
2402 } 2400 }
2403 }; 2401 };
2404 2402
2405 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); 2403 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded);
(...skipping 11 matching lines...) Expand all
2417 typename Types::LayerType* overReplica = this->createDrawingLayer(parent , this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 100), true); 2415 typename Types::LayerType* overReplica = this->createDrawingLayer(parent , this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 100), true);
2418 this->calcDrawEtc(parent); 2416 this->calcDrawEtc(parent);
2419 2417
2420 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2418 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2421 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2419 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2422 2420
2423 // These occlude the surface and replica differently, so we can test eac h one. 2421 // These occlude the surface and replica differently, so we can test eac h one.
2424 this->visitLayer(overReplica, occlusion); 2422 this->visitLayer(overReplica, occlusion);
2425 this->visitLayer(overSurface, occlusion); 2423 this->visitLayer(overSurface, occlusion);
2426 2424
2427 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 1 00)).ToString(), occlusion.occlusionInScreenSpace().ToString()); 2425 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2428 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 1 00)).ToString(), occlusion.occlusionInTargetSurface().ToString()); 2426 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 1 00)).ToString(), occlusion.occlusionFromInsideTarget().ToString());
2429 2427
2430 this->visitLayer(surface, occlusion); 2428 this->visitLayer(surface, occlusion);
2431 2429
2432 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 100, 50, 100)).ToString(), occlusion.occlusionInScreenSpace().ToString()); 2430 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 1 00)).ToString(), occlusion.occlusionFromOutsideTarget().ToString());
2433 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2431 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2434 2432
2435 this->enterContributingSurface(surface, occlusion); 2433 this->enterContributingSurface(surface, occlusion);
2436 2434
2437 // Surface and replica are occluded different amounts. 2435 // Surface and replica are occluded different amounts.
2438 EXPECT_RECT_EQ(gfx::Rect(40, 0, 60, 100), occlusion.unoccludedContributi ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); 2436 EXPECT_RECT_EQ(gfx::Rect(40, 0, 60, 100), occlusion.unoccludedContributi ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
2439 EXPECT_RECT_EQ(gfx::Rect(50, 0, 50, 100), occlusion.unoccludedContributi ngSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100))); 2437 EXPECT_RECT_EQ(gfx::Rect(50, 0, 50, 100), occlusion.unoccludedContributi ngSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100)));
2440 } 2438 }
2441 }; 2439 };
2442 2440
2443 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent ly); 2441 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent ly);
(...skipping 10 matching lines...) Expand all
2454 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); 2452 typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true);
2455 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, gfx::PointF(0, 10), gfx::Size(100, 50), true); 2453 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, gfx::PointF(0, 10), gfx::Size(100, 50), true);
2456 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); 2454 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true);
2457 this->calcDrawEtc(parent); 2455 this->calcDrawEtc(parent);
2458 2456
2459 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000)); 2457 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000));
2460 2458
2461 // |topmost| occludes everything partially so we know occlusion is happe ning at all. 2459 // |topmost| occludes everything partially so we know occlusion is happe ning at all.
2462 this->visitLayer(topmost, occlusion); 2460 this->visitLayer(topmost, occlusion);
2463 2461
2464 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), occlusion.occlusionInScre enSpace().ToString()); 2462 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2465 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), occlusion.occlusionInTarg etSurface().ToString()); 2463 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), occlusion.occlusionFromIn sideTarget().ToString());
2466 2464
2467 this->visitLayer(surfaceChild, occlusion); 2465 this->visitLayer(surfaceChild, occlusion);
2468 2466
2469 // surfaceChild increases the occlusion in the screen by a narrow sliver . 2467 // surfaceChild increases the occlusion in the screen by a narrow sliver .
2470 EXPECT_EQ(gfx::Rect(0, 0, 100, 60).ToString(), occlusion.occlusionInScre enSpace().ToString()); 2468 EXPECT_EQ(gfx::Rect(0, -10, 100, 50).ToString(), occlusion.occlusionFrom OutsideTarget().ToString());
2471 // In its own surface, surfaceChild is at 0,0 as is its occlusion. 2469 // In its own surface, surfaceChild is at 0,0 as is its occlusion.
2472 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), occlusion.occlusionInTarg etSurface().ToString()); 2470 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), occlusion.occlusionFromIn sideTarget().ToString());
2473 2471
2474 // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not 2472 // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not
2475 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa rent of |surfaceChild| exercises different code paths 2473 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa rent of |surfaceChild| exercises different code paths
2476 // as its parent does not have a clipRect. 2474 // as its parent does not have a clipRect.
2477 2475
2478 this->enterContributingSurface(surfaceChild, occlusion); 2476 this->enterContributingSurface(surfaceChild, occlusion);
2479 // The surfaceChild's parent does not have a clipRect as it owns a rende r surface. Make sure the unoccluded rect 2477 // The surfaceChild's parent does not have a clipRect as it owns a rende r surface. Make sure the unoccluded rect
2480 // does not get clipped away inappropriately. 2478 // does not get clipped away inappropriately.
2481 EXPECT_RECT_EQ(gfx::Rect(0, 40, 100, 10), occlusion.unoccludedContributi ngSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 50))); 2479 EXPECT_RECT_EQ(gfx::Rect(0, 40, 100, 10), occlusion.unoccludedContributi ngSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 50)));
2482 this->leaveContributingSurface(surfaceChild, occlusion); 2480 this->leaveContributingSurface(surfaceChild, occlusion);
2483 2481
2484 // When the surfaceChild's occlusion is transformed up to its parent, ma ke sure it is not clipped away inappropriately also. 2482 // When the surfaceChild's occlusion is transformed up to its parent, ma ke sure it is not clipped away inappropriately also.
2485 this->enterLayer(surface, occlusion); 2483 this->enterLayer(surface, occlusion);
2486 EXPECT_EQ(gfx::Rect(0, 0, 100, 60).ToString(), occlusion.occlusionInScre enSpace().ToString()); 2484 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), occlusion.occlusionFromOu tsideTarget().ToString());
2487 EXPECT_EQ(gfx::Rect(0, 10, 100, 50).ToString(), occlusion.occlusionInTar getSurface().ToString()); 2485 EXPECT_EQ(gfx::Rect(0, 10, 100, 50).ToString(), occlusion.occlusionFromI nsideTarget().ToString());
2488 this->leaveLayer(surface, occlusion); 2486 this->leaveLayer(surface, occlusion);
2489 2487
2490 this->enterContributingSurface(surface, occlusion); 2488 this->enterContributingSurface(surface, occlusion);
2491 // The surface's parent does have a clipRect as it is the root layer. 2489 // The surface's parent does have a clipRect as it is the root layer.
2492 EXPECT_RECT_EQ(gfx::Rect(0, 50, 100, 50), occlusion.unoccludedContributi ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); 2490 EXPECT_RECT_EQ(gfx::Rect(0, 50, 100, 50), occlusion.unoccludedContributi ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
2493 } 2491 }
2494 }; 2492 };
2495 2493
2496 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); 2494 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface);
2497 2495
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false); 2547 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur face, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false);
2550 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); 2548 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true);
2551 this->calcDrawEtc(parent); 2549 this->calcDrawEtc(parent);
2552 2550
2553 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2551 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2554 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2552 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2555 2553
2556 // |topmost| occludes everything partially so we know occlusion is happe ning at all. 2554 // |topmost| occludes everything partially so we know occlusion is happe ning at all.
2557 this->visitLayer(topmost, occlusion); 2555 this->visitLayer(topmost, occlusion);
2558 2556
2559 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), occlusion.occlusionInScree nSpace().ToString()); 2557 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2560 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), occlusion.occlusionInTarge tSurface().ToString()); 2558 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), occlusion.occlusionFromIns ideTarget().ToString());
2561 2559
2562 // surfaceChild is not opaque and does not occlude, so we have a non-emp ty unoccluded area on surface. 2560 // surfaceChild is not opaque and does not occlude, so we have a non-emp ty unoccluded area on surface.
2563 this->visitLayer(surfaceChild, occlusion); 2561 this->visitLayer(surfaceChild, occlusion);
2564 2562
2565 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), occlusion.occlusionInScree nSpace().ToString()); 2563 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), occlusion.occlusionFromOut sideTarget().ToString());
2566 EXPECT_EQ(gfx::Rect(0, 0, 0, 0).ToString(), occlusion.occlusionInTargetS urface().ToString()); 2564 EXPECT_EQ(gfx::Rect(0, 0, 0, 0).ToString(), occlusion.occlusionFromInsid eTarget().ToString());
2567 2565
2568 // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not 2566 // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not
2569 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa rent of |surfaceChild| exercises different code paths 2567 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa rent of |surfaceChild| exercises different code paths
2570 // as its parent does not have a clipRect. 2568 // as its parent does not have a clipRect.
2571 2569
2572 this->enterContributingSurface(surfaceChild, occlusion); 2570 this->enterContributingSurface(surfaceChild, occlusion);
2573 // The surfaceChild's parent does not have a clipRect as it owns a rende r surface. 2571 // The surfaceChild's parent does not have a clipRect as it owns a rende r surface.
2574 EXPECT_RECT_EQ(gfx::Rect(0, 50, 80, 50), occlusion.unoccludedContributin gSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 100))); 2572 EXPECT_EQ(gfx::Rect(0, 50, 80, 50).ToString(), occlusion.unoccludedContr ibutingSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 100)).ToStri ng());
2575 this->leaveContributingSurface(surfaceChild, occlusion); 2573 this->leaveContributingSurface(surfaceChild, occlusion);
2576 2574
2577 this->visitLayer(surface, occlusion); 2575 this->visitLayer(surface, occlusion);
2578 this->enterContributingSurface(surface, occlusion); 2576 this->enterContributingSurface(surface, occlusion);
2579 // The surface's parent does have a clipRect as it is the root layer. 2577 // The surface's parent does have a clipRect as it is the root layer.
2580 EXPECT_RECT_EQ(gfx::Rect(0, 50, 80, 50), occlusion.unoccludedContributin gSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); 2578 EXPECT_EQ(gfx::Rect(0, 50, 80, 50).ToString(), occlusion.unoccludedContr ibutingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)).ToString()) ;
2581 } 2579 }
2582 }; 2580 };
2583 2581
2584 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfClippingSurface); 2582 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfClippingSurface);
2585 2583
2586 template<class Types> 2584 template<class Types>
2587 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public Oc clusionTrackerTest<Types> { 2585 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public Oc clusionTrackerTest<Types> {
2588 protected: 2586 protected:
2589 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa yers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2587 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa yers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2590 void runMyTest() 2588 void runMyTest()
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 this->visitLayer(occludingLayer2, occlusion); 2624 this->visitLayer(occludingLayer2, occlusion);
2627 this->visitLayer(occludingLayer1, occlusion); 2625 this->visitLayer(occludingLayer1, occlusion);
2628 2626
2629 Region expectedOcclusion; 2627 Region expectedOcclusion;
2630 expectedOcclusion.Union(gfx::Rect(0, 0, 300, 50)); 2628 expectedOcclusion.Union(gfx::Rect(0, 0, 300, 50));
2631 expectedOcclusion.Union(gfx::Rect(0, 50, 50, 50)); 2629 expectedOcclusion.Union(gfx::Rect(0, 50, 50, 50));
2632 expectedOcclusion.Union(gfx::Rect(100, 50, 100, 50)); 2630 expectedOcclusion.Union(gfx::Rect(100, 50, 100, 50));
2633 expectedOcclusion.Union(gfx::Rect(250, 50, 50, 50)); 2631 expectedOcclusion.Union(gfx::Rect(250, 50, 50, 50));
2634 expectedOcclusion.Union(gfx::Rect(0, 100, 300, 50)); 2632 expectedOcclusion.Union(gfx::Rect(0, 100, 300, 50));
2635 2633
2636 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionInScreenSpace ().ToString()); 2634 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionFromInsideTar get().ToString());
2637 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionInTargetSurfa ce().ToString()); 2635 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2638 2636
2639 // Everything outside the surface/replica is occluded but the surface/re plica itself is not. 2637 // Everything outside the surface/replica is occluded but the surface/re plica itself is not.
2640 this->enterLayer(filteredSurface, occlusion); 2638 this->enterLayer(filteredSurface, occlusion);
2641 EXPECT_RECT_EQ(gfx::Rect(1, 0, 99, 100), occlusion.unoccludedLayerConten tRect(filteredSurface, gfx::Rect(1, 0, 100, 100))); 2639 EXPECT_RECT_EQ(gfx::Rect(1, 0, 99, 100), occlusion.unoccludedLayerConten tRect(filteredSurface, gfx::Rect(1, 0, 100, 100)));
2642 EXPECT_RECT_EQ(gfx::Rect(0, 1, 100, 99), occlusion.unoccludedLayerConten tRect(filteredSurface, gfx::Rect(0, 1, 100, 100))); 2640 EXPECT_RECT_EQ(gfx::Rect(0, 1, 100, 99), occlusion.unoccludedLayerConten tRect(filteredSurface, gfx::Rect(0, 1, 100, 100)));
2643 EXPECT_RECT_EQ(gfx::Rect(0, 0, 99, 100), occlusion.unoccludedLayerConten tRect(filteredSurface, gfx::Rect(-1, 0, 100, 100))); 2641 EXPECT_RECT_EQ(gfx::Rect(0, 0, 99, 100), occlusion.unoccludedLayerConten tRect(filteredSurface, gfx::Rect(-1, 0, 100, 100)));
2644 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 99), occlusion.unoccludedLayerConten tRect(filteredSurface, gfx::Rect(0, -1, 100, 100))); 2642 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 99), occlusion.unoccludedLayerConten tRect(filteredSurface, gfx::Rect(0, -1, 100, 100)));
2645 2643
2646 EXPECT_RECT_EQ(gfx::Rect(300 + 1, 0, 99, 100), occlusion.unoccludedLayer ContentRect(filteredSurface, gfx::Rect(300 + 1, 0, 100, 100))); 2644 EXPECT_RECT_EQ(gfx::Rect(300 + 1, 0, 99, 100), occlusion.unoccludedLayer ContentRect(filteredSurface, gfx::Rect(300 + 1, 0, 100, 100)));
2647 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 1, 100, 99), occlusion.unoccludedLayer ContentRect(filteredSurface, gfx::Rect(300 + 0, 1, 100, 100))); 2645 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 1, 100, 99), occlusion.unoccludedLayer ContentRect(filteredSurface, gfx::Rect(300 + 0, 1, 100, 100)));
2648 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 99, 100), occlusion.unoccludedLayer ContentRect(filteredSurface, gfx::Rect(300 - 1, 0, 100, 100))); 2646 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 99, 100), occlusion.unoccludedLayer ContentRect(filteredSurface, gfx::Rect(300 - 1, 0, 100, 100)));
2649 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 100, 99), occlusion.unoccludedLayer ContentRect(filteredSurface, gfx::Rect(300 + 0, -1, 100, 100))); 2647 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 100, 99), occlusion.unoccludedLayer ContentRect(filteredSurface, gfx::Rect(300 + 0, -1, 100, 100)));
2650 this->leaveLayer(filteredSurface, occlusion); 2648 this->leaveLayer(filteredSurface, occlusion);
2651 2649
2652 // The filtered layer/replica does not occlude. 2650 // The filtered layer/replica does not occlude.
2653 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionInScreenSpace ().ToString()); 2651 Region expectedOcclusionOutsideSurface;
2654 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T oString()); 2652 expectedOcclusionOutsideSurface.Union(gfx::Rect(-50, -50, 300, 50));
2653 expectedOcclusionOutsideSurface.Union(gfx::Rect(-50, 0, 50, 50));
2654 expectedOcclusionOutsideSurface.Union(gfx::Rect(50, 0, 100, 50));
2655 expectedOcclusionOutsideSurface.Union(gfx::Rect(200, 0, 50, 50));
2656 expectedOcclusionOutsideSurface.Union(gfx::Rect(-50, 50, 300, 50));
2657
2658 EXPECT_EQ(expectedOcclusionOutsideSurface.ToString(), occlusion.occlusio nFromOutsideTarget().ToString());
2659 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget(). ToString());
2655 2660
2656 // The surface has a background blur, so it needs pixels that are curren tly considered occluded in order to be drawn. So the pixels 2661 // The surface has a background blur, so it needs pixels that are curren tly considered occluded in order to be drawn. So the pixels
2657 // it needs should be removed some the occluded area so that when we get to the parent they are drawn. 2662 // it needs should be removed some the occluded area so that when we get to the parent they are drawn.
2658 this->visitContributingSurface(filteredSurface, occlusion); 2663 this->visitContributingSurface(filteredSurface, occlusion);
2659 2664
2660 this->enterLayer(parent, occlusion); 2665 this->enterLayer(parent, occlusion);
2661 2666
2662 Region expectedBlurredOcclusion; 2667 Region expectedBlurredOcclusion;
2663 expectedBlurredOcclusion.Union(gfx::Rect(0, 0, 300, 50 - outsetTop)); 2668 expectedBlurredOcclusion.Union(gfx::Rect(0, 0, 300, 50 - outsetTop));
2664 expectedBlurredOcclusion.Union(gfx::Rect(0, 50 - outsetTop, 50 - outsetL eft, 50 + outsetTop + outsetBottom)); 2669 expectedBlurredOcclusion.Union(gfx::Rect(0, 50 - outsetTop, 50 - outsetL eft, 50 + outsetTop + outsetBottom));
2665 expectedBlurredOcclusion.Union(gfx::Rect(100 + outsetRight, 50 - outsetT op, 100 - outsetRight - outsetLeft, 50 + outsetTop + outsetBottom)); 2670 expectedBlurredOcclusion.Union(gfx::Rect(100 + outsetRight, 50 - outsetT op, 100 - outsetRight - outsetLeft, 50 + outsetTop + outsetBottom));
2666 expectedBlurredOcclusion.Union(gfx::Rect(250 + outsetRight, 50 - outsetT op, 50 - outsetRight, 50 + outsetTop + outsetBottom)); 2671 expectedBlurredOcclusion.Union(gfx::Rect(250 + outsetRight, 50 - outsetT op, 50 - outsetRight, 50 + outsetTop + outsetBottom));
2667 expectedBlurredOcclusion.Union(gfx::Rect(0, 100 + outsetBottom, 300, 50 - outsetBottom)); 2672 expectedBlurredOcclusion.Union(gfx::Rect(0, 100 + outsetBottom, 300, 50 - outsetBottom));
2668 2673
2669 EXPECT_EQ(expectedBlurredOcclusion.ToString(), occlusion.occlusionInScre enSpace().ToString()); 2674 EXPECT_EQ(expectedBlurredOcclusion.ToString(), occlusion.occlusionFromIn sideTarget().ToString());
2670 EXPECT_EQ(expectedBlurredOcclusion.ToString(), occlusion.occlusionInTarg etSurface().ToString()); 2675 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2671 2676
2672 gfx::Rect outsetRect; 2677 gfx::Rect outsetRect;
2673 gfx::Rect testRect; 2678 gfx::Rect testRect;
2674 2679
2675 // Nothing in the blur outsets for the filteredSurface is occluded. 2680 // Nothing in the blur outsets for the filteredSurface is occluded.
2676 outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); 2681 outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
2677 testRect = outsetRect; 2682 testRect = outsetRect;
2678 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2683 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2679 2684
2680 // Stuff outside the blur outsets is still occluded though. 2685 // Stuff outside the blur outsets is still occluded though.
2681 testRect = outsetRect; 2686 testRect = outsetRect;
2682 testRect.Inset(0, 0, -1, 0); 2687 testRect.Inset(0, 0, -1, 0);
2683 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2688 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2684 testRect = outsetRect; 2689 testRect = outsetRect;
2685 testRect.Inset(0, 0, 0, -1); 2690 testRect.Inset(0, 0, 0, -1);
2686 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2691 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2687 testRect = outsetRect; 2692 testRect = outsetRect;
2688 testRect.Inset(-1, 0, 0, 0); 2693 testRect.Inset(-1, 0, 0, 0);
2689 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2694 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2690 testRect = outsetRect; 2695 testRect = outsetRect;
2691 testRect.Inset(0, -1, 0, 0); 2696 testRect.Inset(0, -1, 0, 0);
2692 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2697 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2693 2698
2694 // Nothing in the blur outsets for the filteredSurface's replica is occl uded. 2699 // Nothing in the blur outsets for the filteredSurface's replica is occl uded.
2695 outsetRect = gfx::Rect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); 2700 outsetRect = gfx::Rect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
2696 testRect = outsetRect; 2701 testRect = outsetRect;
2697 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2702 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2698 2703
2699 // Stuff outside the blur outsets is still occluded though. 2704 // Stuff outside the blur outsets is still occluded though.
2700 testRect = outsetRect; 2705 testRect = outsetRect;
2701 testRect.Inset(0, 0, -1, 0); 2706 testRect.Inset(0, 0, -1, 0);
2702 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2707 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2703 testRect = outsetRect; 2708 testRect = outsetRect;
2704 testRect.Inset(0, 0, 0, -1); 2709 testRect.Inset(0, 0, 0, -1);
2705 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2710 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2706 testRect = outsetRect; 2711 testRect = outsetRect;
2707 testRect.Inset(-1, 0, 0, 0); 2712 testRect.Inset(-1, 0, 0, 0);
2708 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2713 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2709 testRect = outsetRect; 2714 testRect = outsetRect;
2710 testRect.Inset(0, -1, 0, 0); 2715 testRect.Inset(0, -1, 0, 0);
2711 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect)); 2716 EXPECT_EQ(outsetRect.ToString(), occlusion.unoccludedLayerContentRect(pa rent, testRect).ToString());
2712 } 2717 }
2713 }; 2718 };
2714 2719
2715 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgrou ndFilter); 2720 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgrou ndFilter);
2716 2721
2717 template<class Types> 2722 template<class Types>
2718 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl usionTrackerTest<Types> { 2723 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl usionTrackerTest<Types> {
2719 protected: 2724 protected:
2720 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2725 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye rs) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2721 void runMyTest() 2726 void runMyTest()
(...skipping 18 matching lines...) Expand all
2740 // Save the distance of influence for the blur effect. 2745 // Save the distance of influence for the blur effect.
2741 int outsetTop, outsetRight, outsetBottom, outsetLeft; 2746 int outsetTop, outsetRight, outsetBottom, outsetLeft;
2742 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); 2747 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
2743 2748
2744 this->calcDrawEtc(root); 2749 this->calcDrawEtc(root);
2745 2750
2746 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2751 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2747 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2752 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2748 2753
2749 this->visitLayer(occludingLayerAbove, occlusion); 2754 this->visitLayer(occludingLayerAbove, occlusion);
2750 EXPECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2).ToString(), occlus ion.occlusionInScreenSpace().ToString()); 2755 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2751 EXPECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2).ToString(), occlus ion.occlusionInTargetSurface().ToString()); 2756 EXPECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2).ToString(), occlus ion.occlusionFromInsideTarget().ToString());
2752 2757
2753 this->visitLayer(filteredSurface2, occlusion); 2758 this->visitLayer(filteredSurface2, occlusion);
2754 this->visitContributingSurface(filteredSurface2, occlusion); 2759 this->visitContributingSurface(filteredSurface2, occlusion);
2755 this->visitLayer(filteredSurface1, occlusion); 2760 this->visitLayer(filteredSurface1, occlusion);
2756 this->visitContributingSurface(filteredSurface1, occlusion); 2761 this->visitContributingSurface(filteredSurface1, occlusion);
2757 2762
2758 // Test expectations in the target. 2763 // Test expectations in the target.
2759 gfx::Rect expectedOcclusion = gfx::Rect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 / 2 - (outset Top + outsetBottom) * 2); 2764 gfx::Rect expectedOcclusion = gfx::Rect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 / 2 - (outset Top + outsetBottom) * 2);
2760 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionInTargetSurfa ce().ToString()); 2765 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionFromInsideTar get().ToString());
2761 2766
2762 // Test expectations in the screen are the same as in the target, as the render surface is 1:1 with the screen. 2767 // Test expectations in the screen are the same as in the target, as the render surface is 1:1 with the screen.
2763 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionInScreenSpace ().ToString()); 2768 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionFromOutsideTa rget().ToString());
2764 } 2769 }
2765 }; 2770 };
2766 2771
2767 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio nTwice); 2772 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio nTwice);
2768 2773
2769 template<class Types> 2774 template<class Types>
2770 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p ublic OcclusionTrackerTest<Types> { 2775 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p ublic OcclusionTrackerTest<Types> {
2771 protected: 2776 protected:
2772 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2777 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2773 void runMyTest() 2778 void runMyTest()
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 this->visitLayer(occludingLayer2, occlusion); 2813 this->visitLayer(occludingLayer2, occlusion);
2809 this->visitLayer(occludingLayer1, occlusion); 2814 this->visitLayer(occludingLayer1, occlusion);
2810 2815
2811 Region expectedOcclusion; 2816 Region expectedOcclusion;
2812 expectedOcclusion.Union(gfx::Rect(0, 0, 300, 50)); 2817 expectedOcclusion.Union(gfx::Rect(0, 0, 300, 50));
2813 expectedOcclusion.Union(gfx::Rect(0, 50, 50, 50)); 2818 expectedOcclusion.Union(gfx::Rect(0, 50, 50, 50));
2814 expectedOcclusion.Union(gfx::Rect(100, 50, 100, 50)); 2819 expectedOcclusion.Union(gfx::Rect(100, 50, 100, 50));
2815 expectedOcclusion.Union(gfx::Rect(250, 50, 50, 50)); 2820 expectedOcclusion.Union(gfx::Rect(250, 50, 50, 50));
2816 expectedOcclusion.Union(gfx::Rect(0, 100, 300, 50)); 2821 expectedOcclusion.Union(gfx::Rect(0, 100, 300, 50));
2817 2822
2818 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionInScreenSpace ().ToString()); 2823 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionFromInsideTar get().ToString());
2819 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionInTargetSurfa ce().ToString()); 2824 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2820 2825
2821 // Everything outside the surface/replica is occluded but the surface/re plica itself is not. 2826 // Everything outside the surface/replica is occluded but the surface/re plica itself is not.
2822 this->enterLayer(filteredSurface, occlusion); 2827 this->enterLayer(filteredSurface, occlusion);
2823 EXPECT_RECT_EQ(gfx::Rect(1, 0, 49, 50), occlusion.unoccludedLayerContent Rect(filteredSurface, gfx::Rect(1, 0, 50, 50))); 2828 EXPECT_RECT_EQ(gfx::Rect(1, 0, 49, 50), occlusion.unoccludedLayerContent Rect(filteredSurface, gfx::Rect(1, 0, 50, 50)));
2824 EXPECT_RECT_EQ(gfx::Rect(0, 1, 50, 49), occlusion.unoccludedLayerContent Rect(filteredSurface, gfx::Rect(0, 1, 50, 50))); 2829 EXPECT_RECT_EQ(gfx::Rect(0, 1, 50, 49), occlusion.unoccludedLayerContent Rect(filteredSurface, gfx::Rect(0, 1, 50, 50)));
2825 EXPECT_RECT_EQ(gfx::Rect(0, 0, 49, 50), occlusion.unoccludedLayerContent Rect(filteredSurface, gfx::Rect(-1, 0, 50, 50))); 2830 EXPECT_RECT_EQ(gfx::Rect(0, 0, 49, 50), occlusion.unoccludedLayerContent Rect(filteredSurface, gfx::Rect(-1, 0, 50, 50)));
2826 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 49), occlusion.unoccludedLayerContent Rect(filteredSurface, gfx::Rect(0, -1, 50, 50))); 2831 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 49), occlusion.unoccludedLayerContent Rect(filteredSurface, gfx::Rect(0, -1, 50, 50)));
2827 2832
2828 EXPECT_RECT_EQ(gfx::Rect(150 + 1, 0, 49, 50), occlusion.unoccludedLayerC ontentRect(filteredSurface, gfx::Rect(150 + 1, 0, 50, 50))); 2833 EXPECT_RECT_EQ(gfx::Rect(150 + 1, 0, 49, 50), occlusion.unoccludedLayerC ontentRect(filteredSurface, gfx::Rect(150 + 1, 0, 50, 50)));
2829 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 1, 50, 49), occlusion.unoccludedLayerC ontentRect(filteredSurface, gfx::Rect(150 + 0, 1, 50, 50))); 2834 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 1, 50, 49), occlusion.unoccludedLayerC ontentRect(filteredSurface, gfx::Rect(150 + 0, 1, 50, 50)));
2830 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 49, 50), occlusion.unoccludedLayerC ontentRect(filteredSurface, gfx::Rect(150 - 1, 0, 50, 50))); 2835 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 49, 50), occlusion.unoccludedLayerC ontentRect(filteredSurface, gfx::Rect(150 - 1, 0, 50, 50)));
2831 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 50, 49), occlusion.unoccludedLayerC ontentRect(filteredSurface, gfx::Rect(150 + 0, -1, 50, 50))); 2836 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 50, 49), occlusion.unoccludedLayerC ontentRect(filteredSurface, gfx::Rect(150 + 0, -1, 50, 50)));
2832 this->leaveLayer(filteredSurface, occlusion); 2837 this->leaveLayer(filteredSurface, occlusion);
2833 2838
2834 // The filtered layer/replica does not occlude. 2839 // The filtered layer/replica does not occlude.
2835 EXPECT_EQ(expectedOcclusion.ToString(), occlusion.occlusionInScreenSpace ().ToString()); 2840 Region expectedOcclusionOutsideSurface;
2836 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T oString()); 2841 expectedOcclusionOutsideSurface.Union(gfx::Rect(-50, -50, 300, 50));
2842 expectedOcclusionOutsideSurface.Union(gfx::Rect(-50, 0, 50, 50));
2843 expectedOcclusionOutsideSurface.Union(gfx::Rect(50, 0, 100, 50));
2844 expectedOcclusionOutsideSurface.Union(gfx::Rect(200, 0, 50, 50));
2845 expectedOcclusionOutsideSurface.Union(gfx::Rect(-50, 50, 300, 50));
2846
2847 EXPECT_EQ(expectedOcclusionOutsideSurface.ToString(), occlusion.occlusio nFromOutsideTarget().ToString());
2848 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget(). ToString());
2837 2849
2838 // The surface has a background blur, so it needs pixels that are curren tly considered occluded in order to be drawn. So the pixels 2850 // The surface has a background blur, so it needs pixels that are curren tly considered occluded in order to be drawn. So the pixels
2839 // it needs should be removed some the occluded area so that when we get to the parent they are drawn. 2851 // it needs should be removed some the occluded area so that when we get to the parent they are drawn.
2840 this->visitContributingSurface(filteredSurface, occlusion); 2852 this->visitContributingSurface(filteredSurface, occlusion);
2841 2853
2842 this->enterContributingSurface(clippingSurface, occlusion); 2854 this->enterContributingSurface(clippingSurface, occlusion);
2843 2855
2844 Region expectedBlurredOcclusion; 2856 Region expectedBlurredOcclusion;
2845 expectedBlurredOcclusion.Union(gfx::Rect(0, 0, 300, 50 - outsetTop)); 2857 expectedBlurredOcclusion.Union(gfx::Rect(0, 0, 300, 50 - outsetTop));
2846 expectedBlurredOcclusion.Union(gfx::Rect(0, 50 - outsetTop, 50 - outsetL eft, 20 + outsetTop + outsetBottom)); 2858 expectedBlurredOcclusion.Union(gfx::Rect(0, 50 - outsetTop, 50 - outsetL eft, 20 + outsetTop + outsetBottom));
2847 expectedBlurredOcclusion.Union(gfx::Rect(100 + outsetRight, 50 - outsetT op, 100 - outsetRight - outsetLeft, 20 + outsetTop + outsetBottom)); 2859 expectedBlurredOcclusion.Union(gfx::Rect(100 + outsetRight, 50 - outsetT op, 100 - outsetRight - outsetLeft, 20 + outsetTop + outsetBottom));
2848 expectedBlurredOcclusion.Union(gfx::Rect(250 + outsetRight, 50 - outsetT op, 50 - outsetRight, 20 + outsetTop + outsetBottom)); 2860 expectedBlurredOcclusion.Union(gfx::Rect(250 + outsetRight, 50 - outsetT op, 50 - outsetRight, 20 + outsetTop + outsetBottom));
2849 expectedBlurredOcclusion.Union(gfx::Rect(0, 100 + 5, 300, 50 - 5)); 2861 expectedBlurredOcclusion.Union(gfx::Rect(0, 100 + 5, 300, 50 - 5));
2850 2862
2851 EXPECT_EQ(expectedBlurredOcclusion.ToString(), occlusion.occlusionInScre enSpace().ToString()); 2863 EXPECT_EQ(expectedBlurredOcclusion.ToString(), occlusion.occlusionFromOu tsideTarget().ToString());
2852 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T oString()); 2864 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget(). ToString());
2853 2865
2854 gfx::Rect outsetRect; 2866 gfx::Rect outsetRect;
2855 gfx::Rect clippedOutsetRect; 2867 gfx::Rect clippedOutsetRect;
2856 gfx::Rect testRect; 2868 gfx::Rect testRect;
2857 2869
2858 // Nothing in the (clipped) blur outsets for the filteredSurface is occl uded. 2870 // Nothing in the (clipped) blur outsets for the filteredSurface is occl uded.
2859 outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); 2871 outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
2860 clippedOutsetRect = gfx::IntersectRects(outsetRect, gfx::Rect(0 - outset Left, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBott om)); 2872 clippedOutsetRect = gfx::IntersectRects(outsetRect, gfx::Rect(0 - outset Left, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBott om));
2861 testRect = outsetRect; 2873 testRect = outsetRect;
2862 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(c lippingSurface, testRect)); 2874 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(c lippingSurface, testRect));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2933 2945
2934 this->visitLayer(behindReplicaLayer, occlusion); 2946 this->visitLayer(behindReplicaLayer, occlusion);
2935 this->visitLayer(behindSurfaceLayer, occlusion); 2947 this->visitLayer(behindSurfaceLayer, occlusion);
2936 2948
2937 // The layers behind the surface are not blurred, and their occlusion do es not change, until we leave the surface. 2949 // The layers behind the surface are not blurred, and their occlusion do es not change, until we leave the surface.
2938 // So it should not be modified by the filter here. 2950 // So it should not be modified by the filter here.
2939 gfx::Rect occlusionBehindSurface = gfx::Rect(60, 60, 30, 30); 2951 gfx::Rect occlusionBehindSurface = gfx::Rect(60, 60, 30, 30);
2940 gfx::Rect occlusionBehindReplica = gfx::Rect(210, 60, 30, 30); 2952 gfx::Rect occlusionBehindReplica = gfx::Rect(210, 60, 30, 30);
2941 2953
2942 Region expectedOpaqueBounds = UnionRegions(occlusionBehindSurface, occlu sionBehindReplica); 2954 Region expectedOpaqueBounds = UnionRegions(occlusionBehindSurface, occlu sionBehindReplica);
2943 EXPECT_EQ(expectedOpaqueBounds.ToString(), occlusion.occlusionInScreenSp ace().ToString()); 2955 EXPECT_EQ(expectedOpaqueBounds.ToString(), occlusion.occlusionFromInside Target().ToString());
2944 EXPECT_EQ(expectedOpaqueBounds.ToString(), occlusion.occlusionInTargetSu rface().ToString()); 2956
2957 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
2945 } 2958 }
2946 }; 2959 };
2947 2960
2948 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionBelowBackground Filter); 2961 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionBelowBackground Filter);
2949 2962
2950 template<class Types> 2963 template<class Types>
2951 class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : publ ic OcclusionTrackerTest<Types> { 2964 class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : publ ic OcclusionTrackerTest<Types> {
2952 protected: 2965 protected:
2953 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 2966 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
2954 void runMyTest() 2967 void runMyTest()
(...skipping 16 matching lines...) Expand all
2971 filteredSurface->setBackgroundFilters(filters); 2984 filteredSurface->setBackgroundFilters(filters);
2972 2985
2973 this->calcDrawEtc(parent); 2986 this->calcDrawEtc(parent);
2974 2987
2975 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 2988 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
2976 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 2989 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
2977 2990
2978 this->visitLayer(aboveReplicaLayer, occlusion); 2991 this->visitLayer(aboveReplicaLayer, occlusion);
2979 this->visitLayer(aboveSurfaceLayer, occlusion); 2992 this->visitLayer(aboveSurfaceLayer, occlusion);
2980 2993
2994 this->visitLayer(filteredSurface, occlusion);
2995
2996 {
2997 // The layers above the filtered surface occlude from outside.
2998 gfx::Rect occlusionAboveSurface = gfx::Rect(0, 0, 50, 50);
2999 gfx::Rect occlusionAboveReplica = gfx::Rect(150, 0, 50, 50);
3000 Region expectedOpaqueRegion = UnionRegions(occlusionAboveSurface, oc clusionAboveReplica);
3001
3002 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarge t().ToString());
3003 EXPECT_EQ(expectedOpaqueRegion.ToString(), occlusion.occlusionFromOu tsideTarget().ToString());
3004 }
3005
2981 // The surface has a background blur, so it blurs non-opaque pixels belo w it. 3006 // The surface has a background blur, so it blurs non-opaque pixels belo w it.
2982 this->visitLayer(filteredSurface, occlusion);
2983 this->visitContributingSurface(filteredSurface, occlusion); 3007 this->visitContributingSurface(filteredSurface, occlusion);
2984 3008
2985 // The filter is completely occluded, so it should not blur anything and reduce any occlusion. 3009 {
2986 gfx::Rect occlusionAboveSurface = gfx::Rect(50, 50, 50, 50); 3010 // The filter is completely occluded, so it should not blur anything and reduce any occlusion.
2987 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 50, 50); 3011 gfx::Rect occlusionAboveSurface = gfx::Rect(50, 50, 50, 50);
3012 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 50, 50);
3013 Region expectedOpaqueRegion = UnionRegions(occlusionAboveSurface, oc clusionAboveReplica);
2988 3014
2989 Region expectedOpaqueRegion = UnionRegions(occlusionAboveSurface, occlus ionAboveReplica); 3015 EXPECT_EQ(expectedOpaqueRegion.ToString(), occlusion.occlusionFromIn sideTarget().ToString());
2990 EXPECT_EQ(expectedOpaqueRegion, occlusion.occlusionInScreenSpace()); 3016 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarg et().ToString());
2991 EXPECT_EQ(expectedOpaqueRegion, occlusion.occlusionInTargetSurface()); 3017 }
2992 } 3018 }
2993 }; 3019 };
2994 3020
2995 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionIfBackgroundFil terIsOccluded); 3021 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionIfBackgroundFil terIsOccluded);
2996 3022
2997 template<class Types> 3023 template<class Types>
2998 class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded : public OcclusionTrackerTest<Types> { 3024 class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded : public OcclusionTrackerTest<Types> {
2999 protected: 3025 protected:
3000 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} 3026 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
3001 void runMyTest() 3027 void runMyTest()
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 30 - outsetLeft, 50 ); 3071 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 30 - outsetLeft, 50 );
3046 gfx::Rect occlusionBesideSurface = gfx::Rect(90, 40, 10, 10); 3072 gfx::Rect occlusionBesideSurface = gfx::Rect(90, 40, 10, 10);
3047 gfx::Rect occlusionBesideReplica = gfx::Rect(200, 40, 10, 10); 3073 gfx::Rect occlusionBesideReplica = gfx::Rect(200, 40, 10, 10);
3048 3074
3049 Region expectedOcclusion; 3075 Region expectedOcclusion;
3050 expectedOcclusion.Union(occlusionAboveSurface); 3076 expectedOcclusion.Union(occlusionAboveSurface);
3051 expectedOcclusion.Union(occlusionAboveReplica); 3077 expectedOcclusion.Union(occlusionAboveReplica);
3052 expectedOcclusion.Union(occlusionBesideSurface); 3078 expectedOcclusion.Union(occlusionBesideSurface);
3053 expectedOcclusion.Union(occlusionBesideReplica); 3079 expectedOcclusion.Union(occlusionBesideReplica);
3054 3080
3055 ASSERT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface()); 3081 ASSERT_EQ(expectedOcclusion.ToString(), occlusion.occlusionFromInsideTar get().ToString());
3056 ASSERT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace()); 3082 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
3057 3083
3058 Region::Iterator expectedRects(expectedOcclusion); 3084 Region::Iterator expectedRects(expectedOcclusion);
3059 Region::Iterator screenSpaceRects(occlusion.occlusionInScreenSpace()); 3085 Region::Iterator targetSurfaceRects(occlusion.occlusionFromInsideTarget( ));
3060 Region::Iterator targetSurfaceRects(occlusion.occlusionInTargetSurface() ); 3086 for (; expectedRects.has_rect(); expectedRects.next(), targetSurfaceRect s.next()) {
3061 for (; expectedRects.has_rect(); expectedRects.next(), screenSpaceRects. next(), targetSurfaceRects.next()) {
3062 ASSERT_TRUE(screenSpaceRects.has_rect());
3063 ASSERT_TRUE(targetSurfaceRects.has_rect()); 3087 ASSERT_TRUE(targetSurfaceRects.has_rect());
3064 EXPECT_EQ(expectedRects.rect(), screenSpaceRects.rect());
3065 EXPECT_EQ(expectedRects.rect(), targetSurfaceRects.rect()); 3088 EXPECT_EQ(expectedRects.rect(), targetSurfaceRects.rect());
3066 } 3089 }
3067 } 3090 }
3068 }; 3091 };
3069 3092
3070 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte rIsPartiallyOccluded); 3093 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte rIsPartiallyOccluded);
3071 3094
3072 template<class Types> 3095 template<class Types>
3073 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type s> { 3096 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type s> {
3074 protected: 3097 protected:
3075 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {} 3098 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke rTest<Types>(opaqueLayers) {}
3076 void runMyTest() 3099 void runMyTest()
3077 { 3100 {
3078 gfx::Size trackingSize(100, 100); 3101 gfx::Size trackingSize(100, 100);
3079 gfx::Size belowTrackingSize(99, 99); 3102 gfx::Size belowTrackingSize(99, 99);
3080 3103
3081 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); 3104 typename Types::ContentLayerType* parent = this->createRoot(this->identi tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400));
3082 typename Types::LayerType* large = this->createDrawingLayer(parent, this ->identityMatrix, gfx::PointF(0, 0), trackingSize, true); 3105 typename Types::LayerType* large = this->createDrawingLayer(parent, this ->identityMatrix, gfx::PointF(0, 0), trackingSize, true);
3083 typename Types::LayerType* small = this->createDrawingLayer(parent, this ->identityMatrix, gfx::PointF(0, 0), belowTrackingSize, true); 3106 typename Types::LayerType* small = this->createDrawingLayer(parent, this ->identityMatrix, gfx::PointF(0, 0), belowTrackingSize, true);
3084 this->calcDrawEtc(parent); 3107 this->calcDrawEtc(parent);
3085 3108
3086 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); 3109 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types:: RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
3087 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); 3110 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
3088 occlusion.setMinimumTrackingSize(trackingSize); 3111 occlusion.setMinimumTrackingSize(trackingSize);
3089 3112
3090 // The small layer is not tracked because it is too small. 3113 // The small layer is not tracked because it is too small.
3091 this->visitLayer(small, occlusion); 3114 this->visitLayer(small, occlusion);
3092 3115
3093 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInScreenSpace().ToS tring()); 3116 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
3094 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T oString()); 3117 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget(). ToString());
3095 3118
3096 // The large layer is tracked as it is large enough. 3119 // The large layer is tracked as it is large enough.
3097 this->visitLayer(large, occlusion); 3120 this->visitLayer(large, occlusion);
3098 3121
3099 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInScreenSpace().ToString()); 3122 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget() .ToString());
3100 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInTargetSurface().ToString()); 3123 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionFromInsideTarget().ToString());
3101 } 3124 }
3102 }; 3125 };
3103 3126
3104 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); 3127 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize);
3105 3128
3106 } // namespace 3129 } // namespace
3107 } // namespace cc 3130 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698