OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/occlusion_tracker.h" | 7 #include "cc/occlusion_tracker.h" |
8 | 8 |
9 #include "Region.h" | 9 #include "Region.h" |
10 #include "cc/layer.h" | 10 #include "cc/layer.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 465 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
466 this->calcDrawEtc(parent); | 466 this->calcDrawEtc(parent); |
467 | 467 |
468 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 468 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
469 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 469 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
470 | 470 |
471 this->visitLayer(layer, occlusion); | 471 this->visitLayer(layer, occlusion); |
472 this->enterLayer(parent, occlusion); | 472 this->enterLayer(parent, occlusion); |
473 | 473 |
474 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 474 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
475 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 475 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
476 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 476 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
477 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 477 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
478 | 478 |
479 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | 479 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); |
480 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; | 480 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; |
481 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; | 481 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; |
482 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)))
; | 482 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)))
; |
483 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)))
; | 483 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)))
; |
484 | 484 |
485 occlusion.useDefaultLayerClipRect(); | 485 occlusion.useDefaultLayerClipRect(); |
486 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | 486 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); |
487 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; | 487 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; |
(...skipping 29 matching lines...) Expand all Loading... |
517 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layerTransform, gfx::PointF(0, 0), gfx::Size(90, 90), true); | 517 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layerTransform, gfx::PointF(0, 0), gfx::Size(90, 90), true); |
518 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layerTransform, gfx::PointF(0, 0), gfx::Size(50, 50), true); | 518 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layerTransform, gfx::PointF(0, 0), gfx::Size(50, 50), true); |
519 this->calcDrawEtc(parent); | 519 this->calcDrawEtc(parent); |
520 | 520 |
521 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 521 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
522 | 522 |
523 this->visitLayer(layer2, occlusion); | 523 this->visitLayer(layer2, occlusion); |
524 this->enterLayer(layer1, occlusion); | 524 this->enterLayer(layer1, occlusion); |
525 | 525 |
526 EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 526 EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
527 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 527 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
528 EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 528 EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); |
529 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 529 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
530 | 530 |
531 // This checks cases where the quads don't match their "containing" | 531 // This checks cases where the quads don't match their "containing" |
532 // layers, e.g. in terms of transforms or clip rect. This is typical for | 532 // layers, e.g. in terms of transforms or clip rect. This is typical for |
533 // DelegatedRendererLayer. | 533 // DelegatedRendererLayer. |
534 | 534 |
535 WebTransformationMatrix quadTransform; | 535 WebTransformationMatrix quadTransform; |
536 quadTransform.translate(30, 30); | 536 quadTransform.translate(30, 30); |
537 gfx::Rect clipRectInTarget(0, 0, 100, 100); | 537 gfx::Rect clipRectInTarget(0, 0, 100, 100); |
538 | 538 |
539 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10,
10), quadTransform, false, clipRectInTarget).IsEmpty()); | 539 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10,
10), quadTransform, false, clipRectInTarget).IsEmpty()); |
(...skipping 21 matching lines...) Expand all Loading... |
561 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 561 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
562 this->calcDrawEtc(parent); | 562 this->calcDrawEtc(parent); |
563 | 563 |
564 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 564 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
565 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 565 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
566 | 566 |
567 this->visitLayer(layer, occlusion); | 567 this->visitLayer(layer, occlusion); |
568 this->enterLayer(parent, occlusion); | 568 this->enterLayer(parent, occlusion); |
569 | 569 |
570 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 570 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
571 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 571 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
572 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 572 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
573 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 573 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
574 | 574 |
575 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | 575 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); |
576 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; | 576 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; |
577 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; | 577 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; |
578 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)))
; | 578 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)))
; |
579 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)))
; | 579 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)))
; |
580 | 580 |
581 occlusion.useDefaultLayerClipRect(); | 581 occlusion.useDefaultLayerClipRect(); |
582 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | 582 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); |
583 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; | 583 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; |
(...skipping 29 matching lines...) Expand all Loading... |
613 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 613 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
614 this->calcDrawEtc(parent); | 614 this->calcDrawEtc(parent); |
615 | 615 |
616 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 616 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
617 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 617 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
618 | 618 |
619 this->visitLayer(layer, occlusion); | 619 this->visitLayer(layer, occlusion); |
620 this->enterLayer(parent, occlusion); | 620 this->enterLayer(parent, occlusion); |
621 | 621 |
622 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 622 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
623 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 623 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
624 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 624 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); |
625 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 625 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
626 | 626 |
627 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); | 627 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); |
628 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)))
; | 628 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)))
; |
629 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)))
; | 629 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)))
; |
630 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50)))
; | 630 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50)))
; |
631 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50)))
; | 631 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50)))
; |
632 | 632 |
633 occlusion.useDefaultLayerClipRect(); | 633 occlusion.useDefaultLayerClipRect(); |
634 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); | 634 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); |
635 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)))
; | 635 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)))
; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 682 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
683 this->calcDrawEtc(parent); | 683 this->calcDrawEtc(parent); |
684 | 684 |
685 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 685 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
686 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 686 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
687 | 687 |
688 this->visitLayer(layer, occlusion); | 688 this->visitLayer(layer, occlusion); |
689 this->enterContributingSurface(child, occlusion); | 689 this->enterContributingSurface(child, occlusion); |
690 | 690 |
691 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); | 691 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); |
692 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 692 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
693 EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSu
rface().bounds()); | 693 EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSu
rface().bounds()); |
694 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 694 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
695 | 695 |
696 this->leaveContributingSurface(child, occlusion); | 696 this->leaveContributingSurface(child, occlusion); |
697 this->enterLayer(parent, occlusion); | 697 this->enterLayer(parent, occlusion); |
698 | 698 |
699 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); | 699 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); |
700 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 700 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
701 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInTargetSur
face().bounds()); | 701 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInTargetSur
face().bounds()); |
702 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 702 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
703 | 703 |
704 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); | 704 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); |
705 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)))
; | 705 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)))
; |
706 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)))
; | 706 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)))
; |
707 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 40, 70, 60)))
; | 707 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 40, 70, 60)))
; |
708 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 41, 70, 60)))
; | 708 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 41, 70, 60)))
; |
709 | 709 |
710 occlusion.useDefaultLayerClipRect(); | 710 occlusion.useDefaultLayerClipRect(); |
711 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); | 711 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); |
712 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)))
; | 712 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)))
; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true); | 764 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true); |
765 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true); | 765 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true); |
766 this->calcDrawEtc(parent); | 766 this->calcDrawEtc(parent); |
767 | 767 |
768 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 768 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
769 | 769 |
770 this->visitLayer(occluder, occlusion); | 770 this->visitLayer(occluder, occlusion); |
771 this->enterLayer(layer2, occlusion); | 771 this->enterLayer(layer2, occlusion); |
772 | 772 |
773 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInScree
nSpace().bounds()); | 773 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInScree
nSpace().bounds()); |
774 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 774 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
775 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); | 775 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
776 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 776 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
777 | 777 |
778 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContent
Rect(layer2, gfx::Rect(0, 0, 25, 25))); | 778 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContent
Rect(layer2, gfx::Rect(0, 0, 25, 25))); |
779 EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(10, 25, 25, 25))); | 779 EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(10, 25, 25, 25))); |
780 EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(25, 10, 25, 25))); | 780 EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(25, 10, 25, 25))); |
781 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 2
5, 25, 25)).IsEmpty()); | 781 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 2
5, 25, 25)).IsEmpty()); |
782 } | 782 } |
783 }; | 783 }; |
784 | 784 |
785 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface); | 785 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface); |
786 | 786 |
(...skipping 17 matching lines...) Expand all Loading... |
804 // leaveToTargetRenderSurface, as the target surface has already been se
en. | 804 // leaveToTargetRenderSurface, as the target surface has already been se
en. |
805 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); | 805 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); |
806 this->calcDrawEtc(parent); | 806 this->calcDrawEtc(parent); |
807 | 807 |
808 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 808 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
809 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000)); | 809 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000)); |
810 | 810 |
811 this->visitLayer(child2, occlusion); | 811 this->visitLayer(child2, occlusion); |
812 | 812 |
813 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpa
ce().bounds()); | 813 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpa
ce().bounds()); |
814 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 814 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
815 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSur
face().bounds()); | 815 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSur
face().bounds()); |
816 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 816 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
817 | 817 |
818 this->visitLayer(layer, occlusion); | 818 this->visitLayer(layer, occlusion); |
819 | 819 |
820 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 820 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
821 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 821 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
822 EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSu
rface().bounds()); | 822 EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSu
rface().bounds()); |
823 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 823 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
824 | 824 |
825 this->enterContributingSurface(child, occlusion); | 825 this->enterContributingSurface(child, occlusion); |
826 | 826 |
827 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 827 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
828 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 828 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
829 EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSu
rface().bounds()); | 829 EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSu
rface().bounds()); |
830 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 830 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
831 | 831 |
832 // Occlusion in |child2| should get merged with the |child| surface we a
re leaving now. | 832 // Occlusion in |child2| should get merged with the |child| surface we a
re leaving now. |
833 this->leaveContributingSurface(child, occlusion); | 833 this->leaveContributingSurface(child, occlusion); |
834 this->enterLayer(parent, occlusion); | 834 this->enterLayer(parent, occlusion); |
835 | 835 |
836 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 836 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
837 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 837 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
838 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 838 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
839 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 839 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
840 | 840 |
841 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)))
; | 841 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)))
; |
842 EXPECT_RECT_EQ(gfx::Rect(90, 30, 10, 10), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 30, 70, 70))); | 842 EXPECT_RECT_EQ(gfx::Rect(90, 30, 10, 10), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 30, 70, 70))); |
843 | 843 |
844 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 60, 10))); | 844 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 60, 10))); |
845 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 60, 10)))
; | 845 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 60, 10)))
; |
846 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 60, 10)))
; | 846 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 60, 10)))
; |
847 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 60, 10)))
; | 847 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 60, 10)))
; |
848 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 60, 10))); | 848 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 60, 10))); |
849 | 849 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 919 |
920 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 920 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
921 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 921 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
922 | 922 |
923 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); | 923 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); |
924 | 924 |
925 this->visitLayer(layer, occlusion); | 925 this->visitLayer(layer, occlusion); |
926 this->enterContributingSurface(child, occlusion); | 926 this->enterContributingSurface(child, occlusion); |
927 | 927 |
928 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds())
; | 928 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds())
; |
929 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 929 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
930 EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface()
.bounds()); | 930 EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface()
.bounds()); |
931 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 931 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
932 | 932 |
933 EXPECT_TRUE(occlusion.occludedLayer(child, clippedLayerInChild)); | 933 EXPECT_TRUE(occlusion.occludedLayer(child, clippedLayerInChild)); |
934 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInCh
ild).IsEmpty()); | 934 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInCh
ild).IsEmpty()); |
935 clippedLayerInChild.Offset(-1, 0); | 935 clippedLayerInChild.Offset(-1, 0); |
936 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); | 936 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); |
937 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC
hild).IsEmpty()); | 937 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC
hild).IsEmpty()); |
938 clippedLayerInChild.Offset(1, 0); | 938 clippedLayerInChild.Offset(1, 0); |
939 clippedLayerInChild.Offset(1, 0); | 939 clippedLayerInChild.Offset(1, 0); |
940 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); | 940 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); |
941 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC
hild).IsEmpty()); | 941 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC
hild).IsEmpty()); |
942 clippedLayerInChild.Offset(-1, 0); | 942 clippedLayerInChild.Offset(-1, 0); |
943 clippedLayerInChild.Offset(0, -1); | 943 clippedLayerInChild.Offset(0, -1); |
944 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); | 944 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); |
945 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC
hild).IsEmpty()); | 945 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC
hild).IsEmpty()); |
946 clippedLayerInChild.Offset(0, 1); | 946 clippedLayerInChild.Offset(0, 1); |
947 clippedLayerInChild.Offset(0, 1); | 947 clippedLayerInChild.Offset(0, 1); |
948 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); | 948 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); |
949 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC
hild).IsEmpty()); | 949 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC
hild).IsEmpty()); |
950 clippedLayerInChild.Offset(0, -1); | 950 clippedLayerInChild.Offset(0, -1); |
951 | 951 |
952 this->leaveContributingSurface(child, occlusion); | 952 this->leaveContributingSurface(child, occlusion); |
953 this->enterLayer(parent, occlusion); | 953 this->enterLayer(parent, occlusion); |
954 | 954 |
955 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds())
; | 955 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds())
; |
956 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 956 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
957 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds(
)); | 957 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds(
)); |
958 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 958 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
959 | 959 |
960 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(75, 55, 1, 1))); | 960 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(75, 55, 1, 1))); |
961 EXPECT_RECT_EQ(gfx::Rect(75, 55, 1, 1), occlusion.unoccludedLayerContent
Rect(parent, gfx::Rect(75, 55, 1, 1))); | 961 EXPECT_RECT_EQ(gfx::Rect(75, 55, 1, 1), occlusion.unoccludedLayerContent
Rect(parent, gfx::Rect(75, 55, 1, 1))); |
962 } | 962 } |
963 }; | 963 }; |
964 | 964 |
965 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis); | 965 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis); |
966 | 966 |
967 template<class Types> | 967 template<class Types> |
968 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker
Test<Types> { | 968 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker
Test<Types> { |
(...skipping 15 matching lines...) Expand all Loading... |
984 this->calcDrawEtc(parent); | 984 this->calcDrawEtc(parent); |
985 | 985 |
986 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 986 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
987 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 987 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
988 | 988 |
989 this->visitLayer(layer2, occlusion); | 989 this->visitLayer(layer2, occlusion); |
990 this->visitLayer(layer1, occlusion); | 990 this->visitLayer(layer1, occlusion); |
991 this->enterContributingSurface(child, occlusion); | 991 this->enterContributingSurface(child, occlusion); |
992 | 992 |
993 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); | 993 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); |
994 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 994 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
995 EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSu
rface().bounds()); | 995 EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSu
rface().bounds()); |
996 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 996 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
997 | 997 |
998 EXPECT_TRUE(occlusion.occludedLayer(child, gfx::Rect(10, 430, 60, 70))); | 998 EXPECT_TRUE(occlusion.occludedLayer(child, gfx::Rect(10, 430, 60, 70))); |
999 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(9, 430, 60, 70))); | 999 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(9, 430, 60, 70))); |
1000 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 429, 60, 70)))
; | 1000 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 429, 60, 70)))
; |
1001 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(11, 430, 60, 70)))
; | 1001 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(11, 430, 60, 70)))
; |
1002 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 431, 60, 70)))
; | 1002 EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 431, 60, 70)))
; |
1003 | 1003 |
1004 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, gfx::Rect(10, 43
0, 60, 70)).IsEmpty()); | 1004 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, gfx::Rect(10, 43
0, 60, 70)).IsEmpty()); |
1005 EXPECT_RECT_EQ(gfx::Rect(9, 430, 1, 70), occlusion.unoccludedLayerConten
tRect(child, gfx::Rect(9, 430, 60, 70))); | 1005 EXPECT_RECT_EQ(gfx::Rect(9, 430, 1, 70), occlusion.unoccludedLayerConten
tRect(child, gfx::Rect(9, 430, 60, 70))); |
1006 EXPECT_RECT_EQ(gfx::Rect(10, 429, 60, 1), occlusion.unoccludedLayerConte
ntRect(child, gfx::Rect(10, 429, 60, 70))); | 1006 EXPECT_RECT_EQ(gfx::Rect(10, 429, 60, 1), occlusion.unoccludedLayerConte
ntRect(child, gfx::Rect(10, 429, 60, 70))); |
1007 EXPECT_RECT_EQ(gfx::Rect(70, 430, 1, 70), occlusion.unoccludedLayerConte
ntRect(child, gfx::Rect(11, 430, 60, 70))); | 1007 EXPECT_RECT_EQ(gfx::Rect(70, 430, 1, 70), occlusion.unoccludedLayerConte
ntRect(child, gfx::Rect(11, 430, 60, 70))); |
1008 EXPECT_RECT_EQ(gfx::Rect(10, 500, 60, 1), occlusion.unoccludedLayerConte
ntRect(child, gfx::Rect(10, 431, 60, 70))); | 1008 EXPECT_RECT_EQ(gfx::Rect(10, 500, 60, 1), occlusion.unoccludedLayerConte
ntRect(child, gfx::Rect(10, 431, 60, 70))); |
1009 | 1009 |
1010 this->leaveContributingSurface(child, occlusion); | 1010 this->leaveContributingSurface(child, occlusion); |
1011 this->enterLayer(parent, occlusion); | 1011 this->enterLayer(parent, occlusion); |
1012 | 1012 |
1013 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); | 1013 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); |
1014 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1014 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1015 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInTargetSur
face().bounds()); | 1015 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInTargetSur
face().bounds()); |
1016 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1016 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1017 | 1017 |
1018 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); | 1018 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); |
1019 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)))
; | 1019 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)))
; |
1020 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)))
; | 1020 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)))
; |
1021 | 1021 |
1022 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 4
0, 70, 60)).IsEmpty()); | 1022 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 4
0, 70, 60)).IsEmpty()); |
1023 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 40, 70, 60))); | 1023 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 40, 70, 60))); |
1024 EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 39, 70, 60))); | 1024 EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 39, 70, 60))); |
1025 EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 40, 70, 60))); | 1025 EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 40, 70, 60))); |
1026 EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 41, 70, 60))); | 1026 EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 41, 70, 60))); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 1073 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
1074 this->calcDrawEtc(parent); | 1074 this->calcDrawEtc(parent); |
1075 | 1075 |
1076 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1076 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1077 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); | 1077 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); |
1078 | 1078 |
1079 this->visitLayer(layer2, occlusion); | 1079 this->visitLayer(layer2, occlusion); |
1080 this->enterContributingSurface(child2, occlusion); | 1080 this->enterContributingSurface(child2, occlusion); |
1081 | 1081 |
1082 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1082 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1083 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1083 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1084 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.occlusionInTargetS
urface().bounds()); | 1084 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.occlusionInTargetS
urface().bounds()); |
1085 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1085 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1086 | 1086 |
1087 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80))
); | 1087 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80))
); |
1088 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)
)); | 1088 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)
)); |
1089 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)
)); | 1089 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)
)); |
1090 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)
)); | 1090 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)
)); |
1091 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)
)); | 1091 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)
)); |
1092 | 1092 |
1093 occlusion.useDefaultLayerClipRect(); | 1093 occlusion.useDefaultLayerClipRect(); |
1094 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80))
); | 1094 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80))
); |
1095 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80))
); | 1095 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80))
); |
1096 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80))
); | 1096 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80))
); |
1097 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80))
); | 1097 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80))
); |
1098 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81))
); | 1098 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81))
); |
1099 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); | 1099 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); |
1100 | 1100 |
1101 // There is nothing above child2's surface in the z-order. | 1101 // There is nothing above child2's surface in the z-order. |
1102 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContribu
tingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80))); | 1102 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContribu
tingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80))); |
1103 | 1103 |
1104 this->leaveContributingSurface(child2, occlusion); | 1104 this->leaveContributingSurface(child2, occlusion); |
1105 this->visitLayer(layer1, occlusion); | 1105 this->visitLayer(layer1, occlusion); |
1106 this->enterContributingSurface(child1, occlusion); | 1106 this->enterContributingSurface(child1, occlusion); |
1107 | 1107 |
1108 EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInScreenSpa
ce().bounds()); | 1108 EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInScreenSpa
ce().bounds()); |
1109 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 1109 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1110 EXPECT_RECT_EQ(gfx::Rect(-10, 430, 80, 70), occlusion.occlusionInTargetS
urface().bounds()); | 1110 EXPECT_RECT_EQ(gfx::Rect(-10, 430, 80, 70), occlusion.occlusionInTargetS
urface().bounds()); |
1111 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1111 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1112 | 1112 |
1113 EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 70))
); | 1113 EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 70))
); |
1114 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-11, 430, 80, 70)
)); | 1114 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-11, 430, 80, 70)
)); |
1115 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 429, 80, 70)
)); | 1115 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 429, 80, 70)
)); |
1116 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 81, 70)
)); | 1116 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 81, 70)
)); |
1117 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 71)
)); | 1117 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 71)
)); |
1118 | 1118 |
1119 // child2's contents will occlude child1 below it. | 1119 // child2's contents will occlude child1 below it. |
1120 EXPECT_RECT_EQ(gfx::Rect(-10, 430, 10, 70), occlusion.unoccludedContribu
tingSurfaceContentRect(child1, false, gfx::Rect(-10, 430, 80, 70))); | 1120 EXPECT_RECT_EQ(gfx::Rect(-10, 430, 10, 70), occlusion.unoccludedContribu
tingSurfaceContentRect(child1, false, gfx::Rect(-10, 430, 80, 70))); |
1121 | 1121 |
1122 this->leaveContributingSurface(child1, occlusion); | 1122 this->leaveContributingSurface(child1, occlusion); |
1123 this->enterLayer(parent, occlusion); | 1123 this->enterLayer(parent, occlusion); |
1124 | 1124 |
1125 EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInScreenSpa
ce().bounds()); | 1125 EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInScreenSpa
ce().bounds()); |
1126 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 1126 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1127 EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInTargetSur
face().bounds()); | 1127 EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInTargetSur
face().bounds()); |
1128 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1128 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1129 | 1129 |
1130 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 20, 80, 80)))
; | 1130 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 20, 80, 80)))
; |
1131 | 1131 |
1132 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 20, 70, 80))); | 1132 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 20, 70, 80))); |
1133 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 20, 70, 80)))
; | 1133 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 20, 70, 80)))
; |
1134 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 19, 70, 80)))
; | 1134 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 19, 70, 80)))
; |
1135 | 1135 |
1136 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(20, 30, 80, 70))); | 1136 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(20, 30, 80, 70))); |
1137 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(19, 30, 80, 70)))
; | 1137 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(19, 30, 80, 70)))
; |
1138 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 29, 80, 70)))
; | 1138 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 29, 80, 70)))
; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 1189 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
1190 this->calcDrawEtc(parent); | 1190 this->calcDrawEtc(parent); |
1191 | 1191 |
1192 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1192 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1193 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000)); | 1193 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000)); |
1194 | 1194 |
1195 this->visitLayer(layer2, occlusion); | 1195 this->visitLayer(layer2, occlusion); |
1196 this->enterLayer(child2, occlusion); | 1196 this->enterLayer(child2, occlusion); |
1197 | 1197 |
1198 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1198 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1199 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1199 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1200 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.occlusionInTargetS
urface().bounds()); | 1200 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.occlusionInTargetS
urface().bounds()); |
1201 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1201 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1202 | 1202 |
1203 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80))
); | 1203 EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80))
); |
1204 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)
)); | 1204 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)
)); |
1205 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)
)); | 1205 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)
)); |
1206 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)
)); | 1206 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)
)); |
1207 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)
)); | 1207 EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)
)); |
1208 | 1208 |
1209 this->leaveLayer(child2, occlusion); | 1209 this->leaveLayer(child2, occlusion); |
1210 this->enterContributingSurface(child2, occlusion); | 1210 this->enterContributingSurface(child2, occlusion); |
1211 | 1211 |
1212 // There is nothing above child2's surface in the z-order. | 1212 // There is nothing above child2's surface in the z-order. |
1213 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContribu
tingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80))); | 1213 EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContribu
tingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80))); |
1214 | 1214 |
1215 this->leaveContributingSurface(child2, occlusion); | 1215 this->leaveContributingSurface(child2, occlusion); |
1216 this->visitLayer(layer1, occlusion); | 1216 this->visitLayer(layer1, occlusion); |
1217 this->enterContributingSurface(child1, occlusion); | 1217 this->enterContributingSurface(child1, occlusion); |
1218 | 1218 |
1219 EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInScreenSpa
ce().bounds()); | 1219 EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInScreenSpa
ce().bounds()); |
1220 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1220 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1221 EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.occlusionInTargetS
urface().bounds()); | 1221 EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.occlusionInTargetS
urface().bounds()); |
1222 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1222 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1223 | 1223 |
1224 EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(420, -20, 80, 90))
); | 1224 EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(420, -20, 80, 90))
); |
1225 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(419, -20, 80, 90)
)); | 1225 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(419, -20, 80, 90)
)); |
1226 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -21, 80, 90)
)); | 1226 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -21, 80, 90)
)); |
1227 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -19, 80, 90)
)); | 1227 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -19, 80, 90)
)); |
1228 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(421, -20, 80, 90)
)); | 1228 EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(421, -20, 80, 90)
)); |
1229 | 1229 |
1230 // child2's contents will occlude child1 below it. | 1230 // child2's contents will occlude child1 below it. |
1231 EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.unoccludedContribu
tingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 80, 90))); | 1231 EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.unoccludedContribu
tingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 80, 90))); |
1232 EXPECT_RECT_EQ(gfx::Rect(490, -10, 10, 80), occlusion.unoccludedContribu
tingSurfaceContentRect(child1, false, gfx::Rect(420, -10, 80, 90))); | 1232 EXPECT_RECT_EQ(gfx::Rect(490, -10, 10, 80), occlusion.unoccludedContribu
tingSurfaceContentRect(child1, false, gfx::Rect(420, -10, 80, 90))); |
1233 EXPECT_RECT_EQ(gfx::Rect(420, -20, 70, 10), occlusion.unoccludedContribu
tingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 70, 90))); | 1233 EXPECT_RECT_EQ(gfx::Rect(420, -20, 70, 10), occlusion.unoccludedContribu
tingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 70, 90))); |
1234 | 1234 |
1235 this->leaveContributingSurface(child1, occlusion); | 1235 this->leaveContributingSurface(child1, occlusion); |
1236 this->enterLayer(parent, occlusion); | 1236 this->enterLayer(parent, occlusion); |
1237 | 1237 |
1238 EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInScreenSpa
ce().bounds()); | 1238 EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInScreenSpa
ce().bounds()); |
1239 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1239 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1240 EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInTargetSur
face().bounds()); | 1240 EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInTargetSur
face().bounds()); |
1241 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1241 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1242 | 1242 |
1243 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(10, 20, 90, 80))); | 1243 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(10, 20, 90, 80))); |
1244 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(9, 20, 90, 80))); | 1244 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(9, 20, 90, 80))); |
1245 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 19, 90, 80)))
; | 1245 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 19, 90, 80)))
; |
1246 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(11, 20, 90, 80)))
; | 1246 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(11, 20, 90, 80)))
; |
1247 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 21, 90, 80)))
; | 1247 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 21, 90, 80)))
; |
1248 | 1248 |
1249 /* Justification for the above occlusion: | 1249 /* Justification for the above occlusion: |
1250 100 | 1250 100 |
1251 +---------------------+ | 1251 +---------------------+ |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 // And has nothing to contribute to its parent surface. | 1318 // And has nothing to contribute to its parent surface. |
1319 this->leaveContributingSurface(opacityLayer, occlusion); | 1319 this->leaveContributingSurface(opacityLayer, occlusion); |
1320 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); | 1320 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1321 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); | 1321 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1322 | 1322 |
1323 // Opaque layer will contribute to occlusion. | 1323 // Opaque layer will contribute to occlusion. |
1324 this->visitLayer(opaqueLayer, occlusion); | 1324 this->visitLayer(opaqueLayer, occlusion); |
1325 this->enterContributingSurface(opaqueLayer, occlusion); | 1325 this->enterContributingSurface(opaqueLayer, occlusion); |
1326 | 1326 |
1327 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1327 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1328 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1328 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1329 EXPECT_RECT_EQ(gfx::Rect(0, 430, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 1329 EXPECT_RECT_EQ(gfx::Rect(0, 430, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
1330 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1330 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1331 | 1331 |
1332 // And it gets translated to the parent surface. | 1332 // And it gets translated to the parent surface. |
1333 this->leaveContributingSurface(opaqueLayer, occlusion); | 1333 this->leaveContributingSurface(opaqueLayer, occlusion); |
1334 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1334 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1335 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1335 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1336 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 1336 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
1337 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1337 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1338 | 1338 |
1339 // The blur layer needs to throw away any occlusion from outside its sub
tree. | 1339 // The blur layer needs to throw away any occlusion from outside its sub
tree. |
1340 this->enterLayer(blurLayer, occlusion); | 1340 this->enterLayer(blurLayer, occlusion); |
1341 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); | 1341 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1342 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); | 1342 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1343 | 1343 |
1344 // And it won't contribute to occlusion. | 1344 // And it won't contribute to occlusion. |
1345 this->leaveLayer(blurLayer, occlusion); | 1345 this->leaveLayer(blurLayer, occlusion); |
1346 this->enterContributingSurface(blurLayer, occlusion); | 1346 this->enterContributingSurface(blurLayer, occlusion); |
1347 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); | 1347 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1348 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); | 1348 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1349 | 1349 |
1350 // But the opaque layer's occlusion is preserved on the parent. | 1350 // But the opaque layer's occlusion is preserved on the parent. |
1351 this->leaveContributingSurface(blurLayer, occlusion); | 1351 this->leaveContributingSurface(blurLayer, occlusion); |
1352 this->enterLayer(parent, occlusion); | 1352 this->enterLayer(parent, occlusion); |
1353 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1353 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1354 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1354 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1355 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 1355 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
1356 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1356 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1357 } | 1357 } |
1358 }; | 1358 }; |
1359 | 1359 |
1360 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); | 1360 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); |
1361 | 1361 |
1362 template<class Types> | 1362 template<class Types> |
1363 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types
> { | 1363 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types
> { |
1364 protected: | 1364 protected: |
1365 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} | 1365 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} |
1366 void runMyTest() | 1366 void runMyTest() |
1367 { | 1367 { |
1368 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 1368 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
1369 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); | 1369 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1370 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); | 1370 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); |
1371 this->calcDrawEtc(parent); | 1371 this->calcDrawEtc(parent); |
1372 | 1372 |
1373 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1373 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1374 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1374 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1375 | 1375 |
1376 this->visitLayer(surface, occlusion); | 1376 this->visitLayer(surface, occlusion); |
1377 | 1377 |
1378 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 1378 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
1379 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1379 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1380 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 1380 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
1381 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1381 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1382 | 1382 |
1383 this->visitContributingSurface(surface, occlusion); | 1383 this->visitContributingSurface(surface, occlusion); |
1384 this->enterLayer(parent, occlusion); | 1384 this->enterLayer(parent, occlusion); |
1385 | 1385 |
1386 // The surface and replica should both be occluding the parent. | 1386 // The surface and replica should both be occluding the parent. |
1387 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); | 1387 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); |
1388 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1388 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1389 } | 1389 } |
1390 }; | 1390 }; |
1391 | 1391 |
1392 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); | 1392 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); |
1393 | 1393 |
1394 template<class Types> | 1394 template<class Types> |
1395 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s> { | 1395 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s> { |
1396 protected: | 1396 protected: |
1397 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 1397 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
1398 void runMyTest() | 1398 void runMyTest() |
1399 { | 1399 { |
1400 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170)); | 1400 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170)); |
1401 parent->setMasksToBounds(true); | 1401 parent->setMasksToBounds(true); |
1402 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); | 1402 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1403 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); | 1403 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); |
1404 this->calcDrawEtc(parent); | 1404 this->calcDrawEtc(parent); |
1405 | 1405 |
1406 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1406 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1407 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1407 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1408 | 1408 |
1409 this->visitLayer(surface, occlusion); | 1409 this->visitLayer(surface, occlusion); |
1410 | 1410 |
1411 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 1411 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
1412 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1412 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1413 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 1413 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
1414 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1414 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1415 | 1415 |
1416 this->visitContributingSurface(surface, occlusion); | 1416 this->visitContributingSurface(surface, occlusion); |
1417 this->enterLayer(parent, occlusion); | 1417 this->enterLayer(parent, occlusion); |
1418 | 1418 |
1419 // The surface and replica should both be occluding the parent. | 1419 // The surface and replica should both be occluding the parent. |
1420 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSu
rface().bounds()); | 1420 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSu
rface().bounds()); |
1421 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1421 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1422 } | 1422 } |
1423 }; | 1423 }; |
1424 | 1424 |
1425 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); | 1425 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); |
1426 | 1426 |
1427 template<class Types> | 1427 template<class Types> |
1428 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { | 1428 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { |
1429 protected: | 1429 protected: |
1430 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 1430 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
1431 void runMyTest() | 1431 void runMyTest() |
1432 { | 1432 { |
1433 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 1433 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
1434 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); | 1434 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1435 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, gfx::PointF(50, 50), gfx::Size()); | 1435 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, gfx::PointF(50, 50), gfx::Size()); |
1436 this->createMaskLayer(replica, gfx::Size(10, 10)); | 1436 this->createMaskLayer(replica, gfx::Size(10, 10)); |
1437 this->calcDrawEtc(parent); | 1437 this->calcDrawEtc(parent); |
1438 | 1438 |
1439 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1439 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1440 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1440 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1441 | 1441 |
1442 this->visitLayer(surface, occlusion); | 1442 this->visitLayer(surface, occlusion); |
1443 | 1443 |
1444 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 1444 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
1445 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1445 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1446 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 1446 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
1447 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1447 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1448 | 1448 |
1449 this->visitContributingSurface(surface, occlusion); | 1449 this->visitContributingSurface(surface, occlusion); |
1450 this->enterLayer(parent, occlusion); | 1450 this->enterLayer(parent, occlusion); |
1451 | 1451 |
1452 // The replica should not be occluding the parent, since it has a mask a
pplied to it. | 1452 // The replica should not be occluding the parent, since it has a mask a
pplied to it. |
1453 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 1453 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); |
1454 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1454 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
1455 } | 1455 } |
1456 }; | 1456 }; |
1457 | 1457 |
1458 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); | 1458 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); |
1459 | 1459 |
1460 template<class Types> | 1460 template<class Types> |
1461 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types> { | 1461 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types> { |
1462 protected: | 1462 protected: |
1463 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} | 1463 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} |
1464 void runMyTest() | 1464 void runMyTest() |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 // Test without any clip rect. | 1852 // Test without any clip rect. |
1853 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1853 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1854 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100
))); | 1854 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100
))); |
1855 occlusion.useDefaultLayerClipRect(); | 1855 occlusion.useDefaultLayerClipRect(); |
1856 | 1856 |
1857 this->leaveLayer(layer, occlusion); | 1857 this->leaveLayer(layer, occlusion); |
1858 this->visitContributingSurface(layer, occlusion); | 1858 this->visitContributingSurface(layer, occlusion); |
1859 this->enterLayer(parent, occlusion); | 1859 this->enterLayer(parent, occlusion); |
1860 | 1860 |
1861 EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().IsEmpty()); | 1861 EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().IsEmpty()); |
1862 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 1862 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
1863 } | 1863 } |
1864 }; | 1864 }; |
1865 | 1865 |
1866 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); | 1866 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); |
1867 | 1867 |
1868 template<class Types> | 1868 template<class Types> |
1869 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker
Test<Types> { | 1869 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker
Test<Types> { |
1870 protected: | 1870 protected: |
1871 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 1871 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
1872 void runMyTest() | 1872 void runMyTest() |
1873 { | 1873 { |
1874 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1874 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1875 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(200, 200), false); | 1875 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(200, 200), false); |
1876 this->calcDrawEtc(parent); | 1876 this->calcDrawEtc(parent); |
1877 | 1877 |
1878 { | 1878 { |
1879 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1879 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1880 layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100)); | 1880 layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100)); |
1881 | 1881 |
1882 this->resetLayerIterator(); | 1882 this->resetLayerIterator(); |
1883 this->visitLayer(layer, occlusion); | 1883 this->visitLayer(layer, occlusion); |
1884 this->enterLayer(parent, occlusion); | 1884 this->enterLayer(parent, occlusion); |
1885 | 1885 |
1886 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInS
creenSpace().bounds()); | 1886 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInS
creenSpace().bounds()); |
1887 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1887 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).s
ize()); |
1888 | 1888 |
1889 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100,
100))); | 1889 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100,
100))); |
1890 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100,
100))); | 1890 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100,
100))); |
1891 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100
, 100))); | 1891 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100
, 100))); |
1892 } | 1892 } |
1893 | 1893 |
1894 { | 1894 { |
1895 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1895 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1896 layer->setOpaqueContentsRect(gfx::Rect(20, 20, 180, 180)); | 1896 layer->setOpaqueContentsRect(gfx::Rect(20, 20, 180, 180)); |
1897 | 1897 |
1898 this->resetLayerIterator(); | 1898 this->resetLayerIterator(); |
1899 this->visitLayer(layer, occlusion); | 1899 this->visitLayer(layer, occlusion); |
1900 this->enterLayer(parent, occlusion); | 1900 this->enterLayer(parent, occlusion); |
1901 | 1901 |
1902 EXPECT_RECT_EQ(gfx::Rect(120, 120, 180, 180), occlusion.occlusionInS
creenSpace().bounds()); | 1902 EXPECT_RECT_EQ(gfx::Rect(120, 120, 180, 180), occlusion.occlusionInS
creenSpace().bounds()); |
1903 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1903 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).s
ize()); |
1904 | 1904 |
1905 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100,
100))); | 1905 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100,
100))); |
1906 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100
, 100))); | 1906 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100
, 100))); |
1907 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100,
100))); | 1907 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100,
100))); |
1908 } | 1908 } |
1909 | 1909 |
1910 { | 1910 { |
1911 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1911 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1912 layer->setOpaqueContentsRect(gfx::Rect(150, 150, 100, 100)); | 1912 layer->setOpaqueContentsRect(gfx::Rect(150, 150, 100, 100)); |
1913 | 1913 |
1914 this->resetLayerIterator(); | 1914 this->resetLayerIterator(); |
1915 this->visitLayer(layer, occlusion); | 1915 this->visitLayer(layer, occlusion); |
1916 this->enterLayer(parent, occlusion); | 1916 this->enterLayer(parent, occlusion); |
1917 | 1917 |
1918 EXPECT_RECT_EQ(gfx::Rect(250, 250, 50, 50), occlusion.occlusionInScr
eenSpace().bounds()); | 1918 EXPECT_RECT_EQ(gfx::Rect(250, 250, 50, 50), occlusion.occlusionInScr
eenSpace().bounds()); |
1919 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1919 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).s
ize()); |
1920 | 1920 |
1921 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100,
100))); | 1921 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100,
100))); |
1922 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100
, 100))); | 1922 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100
, 100))); |
1923 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100
, 100))); | 1923 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100
, 100))); |
1924 } | 1924 } |
1925 } | 1925 } |
1926 }; | 1926 }; |
1927 | 1927 |
1928 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); | 1928 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); |
1929 | 1929 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2069 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2070 parent->setPreserves3D(true); | 2070 parent->setPreserves3D(true); |
2071 layer->setPreserves3D(true); | 2071 layer->setPreserves3D(true); |
2072 this->calcDrawEtc(parent); | 2072 this->calcDrawEtc(parent); |
2073 | 2073 |
2074 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2074 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2075 | 2075 |
2076 // The |layer| is entirely behind the camera and should not occlude. | 2076 // The |layer| is entirely behind the camera and should not occlude. |
2077 this->visitLayer(layer, occlusion); | 2077 this->visitLayer(layer, occlusion); |
2078 this->enterLayer(parent, occlusion); | 2078 this->enterLayer(parent, occlusion); |
2079 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2079 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2080 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 2080 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2081 } | 2081 } |
2082 }; | 2082 }; |
2083 | 2083 |
2084 // 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. | 2084 // 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. |
2085 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); | 2085 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); |
2086 | 2086 |
2087 template<class Types> | 2087 template<class Types> |
2088 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types> { | 2088 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types> { |
2089 protected: | 2089 protected: |
2090 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} | 2090 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} |
(...skipping 12 matching lines...) Expand all Loading... |
2103 layer->setPreserves3D(true); | 2103 layer->setPreserves3D(true); |
2104 this->calcDrawEtc(parent); | 2104 this->calcDrawEtc(parent); |
2105 | 2105 |
2106 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2106 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2107 | 2107 |
2108 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. | 2108 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. |
2109 // Ensure that those pixels don't occlude things outside the clipRect. | 2109 // Ensure that those pixels don't occlude things outside the clipRect. |
2110 this->visitLayer(layer, occlusion); | 2110 this->visitLayer(layer, occlusion); |
2111 this->enterLayer(parent, occlusion); | 2111 this->enterLayer(parent, occlusion); |
2112 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); | 2112 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
2113 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2113 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2114 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpa
ce().bounds()); | 2114 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpa
ce().bounds()); |
2115 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2115 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2116 } | 2116 } |
2117 }; | 2117 }; |
2118 | 2118 |
2119 // 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. | 2119 // 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. |
2120 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); | 2120 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); |
2121 | 2121 |
2122 template<class Types> | 2122 template<class Types> |
2123 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke
rTest<Types> { | 2123 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke
rTest<Types> { |
2124 protected: | 2124 protected: |
2125 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} | 2125 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating()); | 2252 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating()); |
2253 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); | 2253 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); |
2254 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); | 2254 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); |
2255 | 2255 |
2256 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2256 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2257 | 2257 |
2258 this->visitLayer(surface2, occlusion); | 2258 this->visitLayer(surface2, occlusion); |
2259 this->enterContributingSurface(surface2, occlusion); | 2259 this->enterContributingSurface(surface2, occlusion); |
2260 | 2260 |
2261 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpac
e().bounds()); | 2261 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpac
e().bounds()); |
2262 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2262 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2263 | 2263 |
2264 this->leaveContributingSurface(surface2, occlusion); | 2264 this->leaveContributingSurface(surface2, occlusion); |
2265 this->enterLayer(surfaceChild2, occlusion); | 2265 this->enterLayer(surfaceChild2, occlusion); |
2266 | 2266 |
2267 // surfaceChild2 is moving in screen space but not relative to its targe
t, so occlusion should happen in its target space only. | 2267 // surfaceChild2 is moving in screen space but not relative to its targe
t, so occlusion should happen in its target space only. |
2268 // It also means that things occluding in screen space (e.g. surface2) c
annot occlude this layer. | 2268 // It also means that things occluding in screen space (e.g. surface2) c
annot occlude this layer. |
2269 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.unoccludedLayerConte
ntRect(surfaceChild2, gfx::Rect(0, 0, 100, 300))); | 2269 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.unoccludedLayerConte
ntRect(surfaceChild2, gfx::Rect(0, 0, 100, 300))); |
2270 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 3
00))); | 2270 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 3
00))); |
2271 | 2271 |
2272 this->leaveLayer(surfaceChild2, occlusion); | 2272 this->leaveLayer(surfaceChild2, occlusion); |
2273 this->enterLayer(surfaceChild, occlusion); | 2273 this->enterLayer(surfaceChild, occlusion); |
2274 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 100,
300))); | 2274 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 100,
300))); |
2275 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpac
e().bounds()); | 2275 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpac
e().bounds()); |
2276 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2276 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2277 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.occlusionInTargetSur
face().bounds()); | 2277 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.occlusionInTargetSur
face().bounds()); |
2278 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2278 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2279 EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerCon
tentRect(surface, gfx::Rect(0, 0, 300, 300))); | 2279 EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerCon
tentRect(surface, gfx::Rect(0, 0, 300, 300))); |
2280 | 2280 |
2281 // The surfaceChild is occluded by the surfaceChild2, but is moving rela
tive its target and the screen, so it | 2281 // The surfaceChild is occluded by the surfaceChild2, but is moving rela
tive its target and the screen, so it |
2282 // can't be occluded. | 2282 // can't be occluded. |
2283 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 300), occlusion.unoccludedLayerConte
ntRect(surfaceChild, gfx::Rect(0, 0, 200, 300))); | 2283 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 300), occlusion.unoccludedLayerConte
ntRect(surfaceChild, gfx::Rect(0, 0, 200, 300))); |
2284 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 3
00))); | 2284 EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 3
00))); |
2285 | 2285 |
2286 this->leaveLayer(surfaceChild, occlusion); | 2286 this->leaveLayer(surfaceChild, occlusion); |
2287 this->enterLayer(surface, occlusion); | 2287 this->enterLayer(surface, occlusion); |
2288 // The surfaceChild is moving in screen space but not relative to its ta
rget, so occlusion should happen in its target space only. | 2288 // The surfaceChild is moving in screen space but not relative to its ta
rget, so occlusion should happen in its target space only. |
2289 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpac
e().bounds()); | 2289 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpac
e().bounds()); |
2290 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2290 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2291 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.occlusionInTargetSur
face().bounds()); | 2291 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.occlusionInTargetSur
face().bounds()); |
2292 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2292 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2293 EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerCon
tentRect(surface, gfx::Rect(0, 0, 300, 300))); | 2293 EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerCon
tentRect(surface, gfx::Rect(0, 0, 300, 300))); |
2294 | 2294 |
2295 this->leaveLayer(surface, occlusion); | 2295 this->leaveLayer(surface, occlusion); |
2296 // 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. | 2296 // 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. |
2297 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpac
e().bounds()); | 2297 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpac
e().bounds()); |
2298 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2298 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2299 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.occlusionInTargetSur
face().bounds()); | 2299 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.occlusionInTargetSur
face().bounds()); |
2300 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2300 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2301 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedLayerContentRe
ct(surface, gfx::Rect(0, 0, 300, 300))); | 2301 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedLayerContentRe
ct(surface, gfx::Rect(0, 0, 300, 300))); |
2302 | 2302 |
2303 this->enterContributingSurface(surface, occlusion); | 2303 this->enterContributingSurface(surface, occlusion); |
2304 // The contributing |surface| is animating so it can't be occluded. | 2304 // The contributing |surface| is animating so it can't be occluded. |
2305 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300))); | 2305 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300))); |
2306 this->leaveContributingSurface(surface, occlusion); | 2306 this->leaveContributingSurface(surface, occlusion); |
2307 | 2307 |
2308 this->enterLayer(layer, occlusion); | 2308 this->enterLayer(layer, occlusion); |
2309 // The |surface| is moving in the screen and in its target, so all occlu
sion within the surface is lost when leaving it. | 2309 // The |surface| is moving in the screen and in its target, so all occlu
sion within the surface is lost when leaving it. |
2310 EXPECT_RECT_EQ(gfx::Rect(50, 0, 250, 300), occlusion.unoccludedLayerCont
entRect(parent, gfx::Rect(0, 0, 300, 300))); | 2310 EXPECT_RECT_EQ(gfx::Rect(50, 0, 250, 300), occlusion.unoccludedLayerCont
entRect(parent, gfx::Rect(0, 0, 300, 300))); |
(...skipping 24 matching lines...) Expand all Loading... |
2335 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); | 2335 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); |
2336 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); | 2336 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); |
2337 this->calcDrawEtc(parent); | 2337 this->calcDrawEtc(parent); |
2338 | 2338 |
2339 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2339 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2340 | 2340 |
2341 this->visitLayer(surface2, occlusion); | 2341 this->visitLayer(surface2, occlusion); |
2342 this->visitContributingSurface(surface2, occlusion); | 2342 this->visitContributingSurface(surface2, occlusion); |
2343 | 2343 |
2344 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenS
pace().bounds()); | 2344 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenS
pace().bounds()); |
2345 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2345 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2346 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInTargetS
urface().bounds()); | 2346 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInTargetS
urface().bounds()); |
2347 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2347 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2348 | 2348 |
2349 // Clear any stored occlusion. | 2349 // Clear any stored occlusion. |
2350 occlusion.setOcclusionInScreenSpace(Region()); | 2350 occlusion.setOcclusionInScreenSpace(Region()); |
2351 occlusion.setOcclusionInTargetSurface(Region()); | 2351 occlusion.setOcclusionInTargetSurface(Region()); |
2352 | 2352 |
2353 this->visitLayer(surface, occlusion); | 2353 this->visitLayer(surface, occlusion); |
2354 this->visitContributingSurface(surface, occlusion); | 2354 this->visitContributingSurface(surface, occlusion); |
2355 | 2355 |
2356 EXPECT_RECT_EQ(gfx::Rect(0, 0, 400, 400), occlusion.occlusionInScreenSpa
ce().bounds()); | 2356 EXPECT_RECT_EQ(gfx::Rect(0, 0, 400, 400), occlusion.occlusionInScreenSpa
ce().bounds()); |
2357 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2357 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2358 EXPECT_RECT_EQ(gfx::Rect(0, 0, 400, 400), occlusion.occlusionInTargetSur
face().bounds()); | 2358 EXPECT_RECT_EQ(gfx::Rect(0, 0, 400, 400), occlusion.occlusionInTargetSur
face().bounds()); |
2359 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2359 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2360 } | 2360 } |
2361 }; | 2361 }; |
2362 | 2362 |
2363 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent
); | 2363 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent
); |
2364 | 2364 |
2365 template<class Types> | 2365 template<class Types> |
2366 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus
ionTrackerTest<Types> { | 2366 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus
ionTrackerTest<Types> { |
2367 protected: | 2367 protected: |
2368 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers
) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2368 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers
) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
2369 void runMyTest() | 2369 void runMyTest() |
2370 { | 2370 { |
2371 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 2371 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
2372 parent->setMasksToBounds(true); | 2372 parent->setMasksToBounds(true); |
2373 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(500, 300), false); | 2373 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(500, 300), false); |
2374 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); | 2374 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); |
2375 this->calcDrawEtc(parent); | 2375 this->calcDrawEtc(parent); |
2376 | 2376 |
2377 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2377 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2378 | 2378 |
2379 this->visitLayer(surface, occlusion); | 2379 this->visitLayer(surface, occlusion); |
2380 this->visitContributingSurface(surface, occlusion); | 2380 this->visitContributingSurface(surface, occlusion); |
2381 | 2381 |
2382 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpa
ce().bounds()); | 2382 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpa
ce().bounds()); |
2383 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2383 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2384 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSur
face().bounds()); | 2384 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSur
face().bounds()); |
2385 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2385 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2386 } | 2386 } |
2387 }; | 2387 }; |
2388 | 2388 |
2389 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip
ping); | 2389 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip
ping); |
2390 | 2390 |
2391 template<class Types> | 2391 template<class Types> |
2392 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { | 2392 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { |
2393 protected: | 2393 protected: |
2394 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 2394 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
2395 void runMyTest() | 2395 void runMyTest() |
2396 { | 2396 { |
2397 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 2397 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2398 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2398 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2399 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); | 2399 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); |
2400 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 100), gfx::Size(100, 100), true); | 2400 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 100), gfx::Size(100, 100), true); |
2401 this->calcDrawEtc(parent); | 2401 this->calcDrawEtc(parent); |
2402 | 2402 |
2403 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2403 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2404 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2404 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2405 | 2405 |
2406 // |topmost| occludes the replica, but not the surface itself. | 2406 // |topmost| occludes the replica, but not the surface itself. |
2407 this->visitLayer(topmost, occlusion); | 2407 this->visitLayer(topmost, occlusion); |
2408 | 2408 |
2409 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenS
pace().bounds()); | 2409 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenS
pace().bounds()); |
2410 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2410 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2411 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); | 2411 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); |
2412 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2412 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2413 | 2413 |
2414 this->visitLayer(surface, occlusion); | 2414 this->visitLayer(surface, occlusion); |
2415 | 2415 |
2416 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.occlusionInScreenSpa
ce().bounds()); | 2416 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.occlusionInScreenSpa
ce().bounds()); |
2417 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2417 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2418 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); | 2418 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
2419 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2419 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2420 | 2420 |
2421 this->enterContributingSurface(surface, occlusion); | 2421 this->enterContributingSurface(surface, occlusion); |
2422 | 2422 |
2423 // Surface is not occluded so it shouldn't think it is. | 2423 // Surface is not occluded so it shouldn't think it is. |
2424 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); | 2424 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); |
2425 } | 2425 } |
2426 }; | 2426 }; |
2427 | 2427 |
2428 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); | 2428 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); |
2429 | 2429 |
2430 template<class Types> | 2430 template<class Types> |
2431 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker
Test<Types> { | 2431 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker
Test<Types> { |
2432 protected: | 2432 protected: |
2433 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 2433 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
2434 void runMyTest() | 2434 void runMyTest() |
2435 { | 2435 { |
2436 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 2436 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2437 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2437 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2438 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); | 2438 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); |
2439 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 110), true); | 2439 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 110), true); |
2440 this->calcDrawEtc(parent); | 2440 this->calcDrawEtc(parent); |
2441 | 2441 |
2442 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2442 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2443 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2443 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2444 | 2444 |
2445 // |topmost| occludes the surface, but not the entire surface's replica. | 2445 // |topmost| occludes the surface, but not the entire surface's replica. |
2446 this->visitLayer(topmost, occlusion); | 2446 this->visitLayer(topmost, occlusion); |
2447 | 2447 |
2448 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa
ce().bounds()); | 2448 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa
ce().bounds()); |
2449 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2449 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2450 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInTargetSur
face().bounds()); | 2450 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInTargetSur
face().bounds()); |
2451 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2451 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2452 | 2452 |
2453 this->visitLayer(surface, occlusion); | 2453 this->visitLayer(surface, occlusion); |
2454 | 2454 |
2455 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa
ce().bounds()); | 2455 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa
ce().bounds()); |
2456 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2456 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2457 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); | 2457 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
2458 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2458 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2459 | 2459 |
2460 this->enterContributingSurface(surface, occlusion); | 2460 this->enterContributingSurface(surface, occlusion); |
2461 | 2461 |
2462 // Surface is occluded, but only the top 10px of the replica. | 2462 // Surface is occluded, but only the top 10px of the replica. |
2463 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedContributingSu
rfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); | 2463 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedContributingSu
rfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); |
2464 EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 90), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100))); | 2464 EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 90), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100))); |
2465 } | 2465 } |
2466 }; | 2466 }; |
2467 | 2467 |
2468 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); | 2468 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); |
(...skipping 12 matching lines...) Expand all Loading... |
2481 this->calcDrawEtc(parent); | 2481 this->calcDrawEtc(parent); |
2482 | 2482 |
2483 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2483 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2484 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2484 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2485 | 2485 |
2486 // These occlude the surface and replica differently, so we can test eac
h one. | 2486 // These occlude the surface and replica differently, so we can test eac
h one. |
2487 this->visitLayer(overReplica, occlusion); | 2487 this->visitLayer(overReplica, occlusion); |
2488 this->visitLayer(overSurface, occlusion); | 2488 this->visitLayer(overSurface, occlusion); |
2489 | 2489 |
2490 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpac
e().bounds()); | 2490 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpac
e().bounds()); |
2491 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2491 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2492 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInTargetSurf
ace().bounds()); | 2492 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInTargetSurf
ace().bounds()); |
2493 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2493 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2494 | 2494 |
2495 this->visitLayer(surface, occlusion); | 2495 this->visitLayer(surface, occlusion); |
2496 | 2496 |
2497 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.occlusionInScreenSpa
ce().bounds()); | 2497 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.occlusionInScreenSpa
ce().bounds()); |
2498 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2498 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2499 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); | 2499 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
2500 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2500 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2501 | 2501 |
2502 this->enterContributingSurface(surface, occlusion); | 2502 this->enterContributingSurface(surface, occlusion); |
2503 | 2503 |
2504 // Surface and replica are occluded different amounts. | 2504 // Surface and replica are occluded different amounts. |
2505 EXPECT_RECT_EQ(gfx::Rect(40, 0, 60, 100), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); | 2505 EXPECT_RECT_EQ(gfx::Rect(40, 0, 60, 100), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); |
2506 EXPECT_RECT_EQ(gfx::Rect(50, 0, 50, 100), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100))); | 2506 EXPECT_RECT_EQ(gfx::Rect(50, 0, 50, 100), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100))); |
2507 } | 2507 } |
2508 }; | 2508 }; |
2509 | 2509 |
2510 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent
ly); | 2510 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent
ly); |
(...skipping 11 matching lines...) Expand all Loading... |
2522 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, gfx::PointF(0, 10), gfx::Size(100, 50), true); | 2522 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, gfx::PointF(0, 10), gfx::Size(100, 50), true); |
2523 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); | 2523 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); |
2524 this->calcDrawEtc(parent); | 2524 this->calcDrawEtc(parent); |
2525 | 2525 |
2526 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000)); | 2526 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000)); |
2527 | 2527 |
2528 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2528 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
2529 this->visitLayer(topmost, occlusion); | 2529 this->visitLayer(topmost, occlusion); |
2530 | 2530 |
2531 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpac
e().bounds()); | 2531 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpac
e().bounds()); |
2532 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2532 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2533 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf
ace().bounds()); | 2533 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf
ace().bounds()); |
2534 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2534 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2535 | 2535 |
2536 this->visitLayer(surfaceChild, occlusion); | 2536 this->visitLayer(surfaceChild, occlusion); |
2537 | 2537 |
2538 // surfaceChild increases the occlusion in the screen by a narrow sliver
. | 2538 // surfaceChild increases the occlusion in the screen by a narrow sliver
. |
2539 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 60), occlusion.occlusionInScreenSpac
e().bounds()); | 2539 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 60), occlusion.occlusionInScreenSpac
e().bounds()); |
2540 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2540 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2541 // In its own surface, surfaceChild is at 0,0 as is its occlusion. | 2541 // In its own surface, surfaceChild is at 0,0 as is its occlusion. |
2542 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf
ace().bounds()); | 2542 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf
ace().bounds()); |
2543 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2543 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2544 | 2544 |
2545 // The root layer always has a clipRect. So the parent of |surface| has
a clipRect. However, the owning layer for |surface| does not | 2545 // The root layer always has a clipRect. So the parent of |surface| has
a clipRect. However, the owning layer for |surface| does not |
2546 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa
rent of |surfaceChild| exercises different code paths | 2546 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa
rent of |surfaceChild| exercises different code paths |
2547 // as its parent does not have a clipRect. | 2547 // as its parent does not have a clipRect. |
2548 | 2548 |
2549 this->enterContributingSurface(surfaceChild, occlusion); | 2549 this->enterContributingSurface(surfaceChild, occlusion); |
2550 // The surfaceChild's parent does not have a clipRect as it owns a rende
r surface. Make sure the unoccluded rect | 2550 // The surfaceChild's parent does not have a clipRect as it owns a rende
r surface. Make sure the unoccluded rect |
2551 // does not get clipped away inappropriately. | 2551 // does not get clipped away inappropriately. |
2552 EXPECT_RECT_EQ(gfx::Rect(0, 40, 100, 10), occlusion.unoccludedContributi
ngSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 50))); | 2552 EXPECT_RECT_EQ(gfx::Rect(0, 40, 100, 10), occlusion.unoccludedContributi
ngSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 50))); |
2553 this->leaveContributingSurface(surfaceChild, occlusion); | 2553 this->leaveContributingSurface(surfaceChild, occlusion); |
2554 | 2554 |
2555 // When the surfaceChild's occlusion is transformed up to its parent, ma
ke sure it is not clipped away inappropriately also. | 2555 // When the surfaceChild's occlusion is transformed up to its parent, ma
ke sure it is not clipped away inappropriately also. |
2556 this->enterLayer(surface, occlusion); | 2556 this->enterLayer(surface, occlusion); |
2557 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 60), occlusion.occlusionInScreenSpac
e().bounds()); | 2557 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 60), occlusion.occlusionInScreenSpac
e().bounds()); |
2558 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2558 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2559 EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 50), occlusion.occlusionInTargetSur
face().bounds()); | 2559 EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 50), occlusion.occlusionInTargetSur
face().bounds()); |
2560 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2560 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2561 this->leaveLayer(surface, occlusion); | 2561 this->leaveLayer(surface, occlusion); |
2562 | 2562 |
2563 this->enterContributingSurface(surface, occlusion); | 2563 this->enterContributingSurface(surface, occlusion); |
2564 // The surface's parent does have a clipRect as it is the root layer. | 2564 // The surface's parent does have a clipRect as it is the root layer. |
2565 EXPECT_RECT_EQ(gfx::Rect(0, 50, 100, 50), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); | 2565 EXPECT_RECT_EQ(gfx::Rect(0, 50, 100, 50), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100))); |
2566 } | 2566 } |
2567 }; | 2567 }; |
2568 | 2568 |
2569 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); | 2569 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); |
2570 | 2570 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); | 2623 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); |
2624 this->calcDrawEtc(parent); | 2624 this->calcDrawEtc(parent); |
2625 | 2625 |
2626 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2626 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2627 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2627 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2628 | 2628 |
2629 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2629 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
2630 this->visitLayer(topmost, occlusion); | 2630 this->visitLayer(topmost, occlusion); |
2631 | 2631 |
2632 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace
().bounds()); | 2632 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace
().bounds()); |
2633 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2633 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2634 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2634 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
2635 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2635 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2636 | 2636 |
2637 // surfaceChild is not opaque and does not occlude, so we have a non-emp
ty unoccluded area on surface. | 2637 // surfaceChild is not opaque and does not occlude, so we have a non-emp
ty unoccluded area on surface. |
2638 this->visitLayer(surfaceChild, occlusion); | 2638 this->visitLayer(surfaceChild, occlusion); |
2639 | 2639 |
2640 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace
().bounds()); | 2640 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace
().bounds()); |
2641 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2641 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2642 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface
().bounds()); | 2642 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface
().bounds()); |
2643 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2643 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2644 | 2644 |
2645 // The root layer always has a clipRect. So the parent of |surface| has
a clipRect. However, the owning layer for |surface| does not | 2645 // The root layer always has a clipRect. So the parent of |surface| has
a clipRect. However, the owning layer for |surface| does not |
2646 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa
rent of |surfaceChild| exercises different code paths | 2646 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa
rent of |surfaceChild| exercises different code paths |
2647 // as its parent does not have a clipRect. | 2647 // as its parent does not have a clipRect. |
2648 | 2648 |
2649 this->enterContributingSurface(surfaceChild, occlusion); | 2649 this->enterContributingSurface(surfaceChild, occlusion); |
2650 // The surfaceChild's parent does not have a clipRect as it owns a rende
r surface. | 2650 // The surfaceChild's parent does not have a clipRect as it owns a rende
r surface. |
2651 EXPECT_RECT_EQ(gfx::Rect(0, 50, 80, 50), occlusion.unoccludedContributin
gSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 100))); | 2651 EXPECT_RECT_EQ(gfx::Rect(0, 50, 80, 50), occlusion.unoccludedContributin
gSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 100))); |
2652 this->leaveContributingSurface(surfaceChild, occlusion); | 2652 this->leaveContributingSurface(surfaceChild, occlusion); |
2653 | 2653 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2697 | 2697 |
2698 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2698 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
2699 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. | 2699 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. |
2700 this->visitLayer(occludingLayer5, occlusion); | 2700 this->visitLayer(occludingLayer5, occlusion); |
2701 this->visitLayer(occludingLayer4, occlusion); | 2701 this->visitLayer(occludingLayer4, occlusion); |
2702 this->visitLayer(occludingLayer3, occlusion); | 2702 this->visitLayer(occludingLayer3, occlusion); |
2703 this->visitLayer(occludingLayer2, occlusion); | 2703 this->visitLayer(occludingLayer2, occlusion); |
2704 this->visitLayer(occludingLayer1, occlusion); | 2704 this->visitLayer(occludingLayer1, occlusion); |
2705 | 2705 |
2706 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); | 2706 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); |
2707 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2707 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2708 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSur
face().bounds()); | 2708 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSur
face().bounds()); |
2709 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); | 2709 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2710 | 2710 |
2711 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. | 2711 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. |
2712 this->enterLayer(filteredSurface, occlusion); | 2712 this->enterLayer(filteredSurface, occlusion); |
2713 EXPECT_RECT_EQ(gfx::Rect(1, 0, 99, 100), occlusion.unoccludedLayerConten
tRect(filteredSurface, gfx::Rect(1, 0, 100, 100))); | 2713 EXPECT_RECT_EQ(gfx::Rect(1, 0, 99, 100), occlusion.unoccludedLayerConten
tRect(filteredSurface, gfx::Rect(1, 0, 100, 100))); |
2714 EXPECT_RECT_EQ(gfx::Rect(0, 1, 100, 99), occlusion.unoccludedLayerConten
tRect(filteredSurface, gfx::Rect(0, 1, 100, 100))); | 2714 EXPECT_RECT_EQ(gfx::Rect(0, 1, 100, 99), occlusion.unoccludedLayerConten
tRect(filteredSurface, gfx::Rect(0, 1, 100, 100))); |
2715 EXPECT_RECT_EQ(gfx::Rect(0, 0, 99, 100), occlusion.unoccludedLayerConten
tRect(filteredSurface, gfx::Rect(-1, 0, 100, 100))); | 2715 EXPECT_RECT_EQ(gfx::Rect(0, 0, 99, 100), occlusion.unoccludedLayerConten
tRect(filteredSurface, gfx::Rect(-1, 0, 100, 100))); |
2716 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 99), occlusion.unoccludedLayerConten
tRect(filteredSurface, gfx::Rect(0, -1, 100, 100))); | 2716 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 99), occlusion.unoccludedLayerConten
tRect(filteredSurface, gfx::Rect(0, -1, 100, 100))); |
2717 | 2717 |
2718 EXPECT_RECT_EQ(gfx::Rect(300 + 1, 0, 99, 100), occlusion.unoccludedLayer
ContentRect(filteredSurface, gfx::Rect(300 + 1, 0, 100, 100))); | 2718 EXPECT_RECT_EQ(gfx::Rect(300 + 1, 0, 99, 100), occlusion.unoccludedLayer
ContentRect(filteredSurface, gfx::Rect(300 + 1, 0, 100, 100))); |
2719 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 1, 100, 99), occlusion.unoccludedLayer
ContentRect(filteredSurface, gfx::Rect(300 + 0, 1, 100, 100))); | 2719 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 1, 100, 99), occlusion.unoccludedLayer
ContentRect(filteredSurface, gfx::Rect(300 + 0, 1, 100, 100))); |
2720 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 99, 100), occlusion.unoccludedLayer
ContentRect(filteredSurface, gfx::Rect(300 - 1, 0, 100, 100))); | 2720 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 99, 100), occlusion.unoccludedLayer
ContentRect(filteredSurface, gfx::Rect(300 - 1, 0, 100, 100))); |
2721 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 100, 99), occlusion.unoccludedLayer
ContentRect(filteredSurface, gfx::Rect(300 + 0, -1, 100, 100))); | 2721 EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 100, 99), occlusion.unoccludedLayer
ContentRect(filteredSurface, gfx::Rect(300 + 0, -1, 100, 100))); |
2722 this->leaveLayer(filteredSurface, occlusion); | 2722 this->leaveLayer(filteredSurface, occlusion); |
2723 | 2723 |
2724 // The filtered layer/replica does not occlude. | 2724 // The filtered layer/replica does not occlude. |
2725 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); | 2725 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); |
2726 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2726 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2727 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface
().bounds()); | 2727 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface
().bounds()); |
2728 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2728 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2729 | 2729 |
2730 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels | 2730 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels |
2731 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. | 2731 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. |
2732 this->visitContributingSurface(filteredSurface, occlusion); | 2732 this->visitContributingSurface(filteredSurface, occlusion); |
2733 | 2733 |
2734 this->enterLayer(parent, occlusion); | 2734 this->enterLayer(parent, occlusion); |
2735 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); | 2735 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); |
2736 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2736 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2737 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSur
face().bounds()); | 2737 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSur
face().bounds()); |
2738 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); | 2738 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2739 | 2739 |
2740 gfx::Rect outsetRect; | 2740 gfx::Rect outsetRect; |
2741 gfx::Rect testRect; | 2741 gfx::Rect testRect; |
2742 | 2742 |
2743 // Nothing in the blur outsets for the filteredSurface is occluded. | 2743 // Nothing in the blur outsets for the filteredSurface is occluded. |
2744 outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft
+ outsetRight, 50 + outsetTop + outsetBottom); | 2744 outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft
+ outsetRight, 50 + outsetTop + outsetBottom); |
2745 testRect = outsetRect; | 2745 testRect = outsetRect; |
2746 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent,
testRect)); | 2746 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent,
testRect)); |
2747 | 2747 |
2748 // Stuff outside the blur outsets is still occluded though. | 2748 // Stuff outside the blur outsets is still occluded though. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2809 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2809 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2810 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2810 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2811 | 2811 |
2812 this->calcDrawEtc(root); | 2812 this->calcDrawEtc(root); |
2813 | 2813 |
2814 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2814 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2815 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2815 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2816 | 2816 |
2817 this->visitLayer(occludingLayerAbove, occlusion); | 2817 this->visitLayer(occludingLayerAbove, occlusion); |
2818 EXPECT_RECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.oc
clusionInScreenSpace().bounds()); | 2818 EXPECT_RECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.oc
clusionInScreenSpace().bounds()); |
2819 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2819 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2820 EXPECT_RECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.oc
clusionInTargetSurface().bounds()); | 2820 EXPECT_RECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.oc
clusionInTargetSurface().bounds()); |
2821 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2821 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2822 | 2822 |
2823 this->visitLayer(filteredSurface2, occlusion); | 2823 this->visitLayer(filteredSurface2, occlusion); |
2824 this->visitContributingSurface(filteredSurface2, occlusion); | 2824 this->visitContributingSurface(filteredSurface2, occlusion); |
2825 this->visitLayer(filteredSurface1, occlusion); | 2825 this->visitLayer(filteredSurface1, occlusion); |
2826 this->visitContributingSurface(filteredSurface1, occlusion); | 2826 this->visitContributingSurface(filteredSurface1, occlusion); |
2827 | 2827 |
2828 ASSERT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2828 ASSERT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2829 ASSERT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2829 ASSERT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2830 | 2830 |
2831 // Test expectations in the target. | 2831 // Test expectations in the target. |
2832 gfx::Rect expectedOcclusion = gfx::Rect(100 / 2 + outsetRight * 2, 100 /
2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 / 2 - (outset
Top + outsetBottom) * 2); | 2832 gfx::Rect expectedOcclusion = gfx::Rect(100 / 2 + outsetRight * 2, 100 /
2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 / 2 - (outset
Top + outsetBottom) * 2); |
2833 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().r
ects()[0]); | 2833 EXPECT_RECT_EQ(expectedOcclusion, Region::Iterator(occlusion.occlusionIn
TargetSurface()).rect()); |
2834 | 2834 |
2835 // Test expectations in the screen are the same as in the target, as the
render surface is 1:1 with the screen. | 2835 // Test expectations in the screen are the same as in the target, as the
render surface is 1:1 with the screen. |
2836 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rec
ts()[0]); | 2836 EXPECT_RECT_EQ(expectedOcclusion, Region::Iterator(occlusion.occlusionIn
ScreenSpace()).rect()); |
2837 } | 2837 } |
2838 }; | 2838 }; |
2839 | 2839 |
2840 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio
nTwice); | 2840 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio
nTwice); |
2841 | 2841 |
2842 template<class Types> | 2842 template<class Types> |
2843 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p
ublic OcclusionTrackerTest<Types> { | 2843 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p
ublic OcclusionTrackerTest<Types> { |
2844 protected: | 2844 protected: |
2845 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool
opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2845 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool
opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
2846 void runMyTest() | 2846 void runMyTest() |
(...skipping 28 matching lines...) Expand all Loading... |
2875 | 2875 |
2876 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2876 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
2877 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. | 2877 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. |
2878 this->visitLayer(occludingLayer5, occlusion); | 2878 this->visitLayer(occludingLayer5, occlusion); |
2879 this->visitLayer(occludingLayer4, occlusion); | 2879 this->visitLayer(occludingLayer4, occlusion); |
2880 this->visitLayer(occludingLayer3, occlusion); | 2880 this->visitLayer(occludingLayer3, occlusion); |
2881 this->visitLayer(occludingLayer2, occlusion); | 2881 this->visitLayer(occludingLayer2, occlusion); |
2882 this->visitLayer(occludingLayer1, occlusion); | 2882 this->visitLayer(occludingLayer1, occlusion); |
2883 | 2883 |
2884 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); | 2884 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); |
2885 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2885 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2886 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSur
face().bounds()); | 2886 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSur
face().bounds()); |
2887 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); | 2887 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2888 | 2888 |
2889 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. | 2889 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. |
2890 this->enterLayer(filteredSurface, occlusion); | 2890 this->enterLayer(filteredSurface, occlusion); |
2891 EXPECT_RECT_EQ(gfx::Rect(1, 0, 49, 50), occlusion.unoccludedLayerContent
Rect(filteredSurface, gfx::Rect(1, 0, 50, 50))); | 2891 EXPECT_RECT_EQ(gfx::Rect(1, 0, 49, 50), occlusion.unoccludedLayerContent
Rect(filteredSurface, gfx::Rect(1, 0, 50, 50))); |
2892 EXPECT_RECT_EQ(gfx::Rect(0, 1, 50, 49), occlusion.unoccludedLayerContent
Rect(filteredSurface, gfx::Rect(0, 1, 50, 50))); | 2892 EXPECT_RECT_EQ(gfx::Rect(0, 1, 50, 49), occlusion.unoccludedLayerContent
Rect(filteredSurface, gfx::Rect(0, 1, 50, 50))); |
2893 EXPECT_RECT_EQ(gfx::Rect(0, 0, 49, 50), occlusion.unoccludedLayerContent
Rect(filteredSurface, gfx::Rect(-1, 0, 50, 50))); | 2893 EXPECT_RECT_EQ(gfx::Rect(0, 0, 49, 50), occlusion.unoccludedLayerContent
Rect(filteredSurface, gfx::Rect(-1, 0, 50, 50))); |
2894 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 49), occlusion.unoccludedLayerContent
Rect(filteredSurface, gfx::Rect(0, -1, 50, 50))); | 2894 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 49), occlusion.unoccludedLayerContent
Rect(filteredSurface, gfx::Rect(0, -1, 50, 50))); |
2895 | 2895 |
2896 EXPECT_RECT_EQ(gfx::Rect(150 + 1, 0, 49, 50), occlusion.unoccludedLayerC
ontentRect(filteredSurface, gfx::Rect(150 + 1, 0, 50, 50))); | 2896 EXPECT_RECT_EQ(gfx::Rect(150 + 1, 0, 49, 50), occlusion.unoccludedLayerC
ontentRect(filteredSurface, gfx::Rect(150 + 1, 0, 50, 50))); |
2897 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 1, 50, 49), occlusion.unoccludedLayerC
ontentRect(filteredSurface, gfx::Rect(150 + 0, 1, 50, 50))); | 2897 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 1, 50, 49), occlusion.unoccludedLayerC
ontentRect(filteredSurface, gfx::Rect(150 + 0, 1, 50, 50))); |
2898 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 49, 50), occlusion.unoccludedLayerC
ontentRect(filteredSurface, gfx::Rect(150 - 1, 0, 50, 50))); | 2898 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 49, 50), occlusion.unoccludedLayerC
ontentRect(filteredSurface, gfx::Rect(150 - 1, 0, 50, 50))); |
2899 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 50, 49), occlusion.unoccludedLayerC
ontentRect(filteredSurface, gfx::Rect(150 + 0, -1, 50, 50))); | 2899 EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 50, 49), occlusion.unoccludedLayerC
ontentRect(filteredSurface, gfx::Rect(150 + 0, -1, 50, 50))); |
2900 this->leaveLayer(filteredSurface, occlusion); | 2900 this->leaveLayer(filteredSurface, occlusion); |
2901 | 2901 |
2902 // The filtered layer/replica does not occlude. | 2902 // The filtered layer/replica does not occlude. |
2903 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); | 2903 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); |
2904 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2904 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2905 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface
().bounds()); | 2905 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface
().bounds()); |
2906 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2906 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
2907 | 2907 |
2908 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels | 2908 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels |
2909 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. | 2909 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. |
2910 this->visitContributingSurface(filteredSurface, occlusion); | 2910 this->visitContributingSurface(filteredSurface, occlusion); |
2911 | 2911 |
2912 this->enterContributingSurface(clippingSurface, occlusion); | 2912 this->enterContributingSurface(clippingSurface, occlusion); |
2913 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); | 2913 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpa
ce().bounds()); |
2914 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2914 EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
2915 | 2915 |
2916 gfx::Rect outsetRect; | 2916 gfx::Rect outsetRect; |
2917 gfx::Rect clippedOutsetRect; | 2917 gfx::Rect clippedOutsetRect; |
2918 gfx::Rect testRect; | 2918 gfx::Rect testRect; |
2919 | 2919 |
2920 // Nothing in the (clipped) blur outsets for the filteredSurface is occl
uded. | 2920 // Nothing in the (clipped) blur outsets for the filteredSurface is occl
uded. |
2921 outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft
+ outsetRight, 50 + outsetTop + outsetBottom); | 2921 outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft
+ outsetRight, 50 + outsetTop + outsetBottom); |
2922 clippedOutsetRect = gfx::IntersectRects(outsetRect, gfx::Rect(0 - outset
Left, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBott
om)); | 2922 clippedOutsetRect = gfx::IntersectRects(outsetRect, gfx::Rect(0 - outset
Left, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBott
om)); |
2923 testRect = outsetRect; | 2923 testRect = outsetRect; |
2924 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(c
lippingSurface, testRect)); | 2924 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(c
lippingSurface, testRect)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2996 this->visitLayer(behindReplicaLayer, occlusion); | 2996 this->visitLayer(behindReplicaLayer, occlusion); |
2997 this->visitLayer(behindSurfaceLayer, occlusion); | 2997 this->visitLayer(behindSurfaceLayer, occlusion); |
2998 | 2998 |
2999 // The layers behind the surface are not blurred, and their occlusion do
es not change, until we leave the surface. | 2999 // The layers behind the surface are not blurred, and their occlusion do
es not change, until we leave the surface. |
3000 // So it should not be modified by the filter here. | 3000 // So it should not be modified by the filter here. |
3001 gfx::Rect occlusionBehindSurface = gfx::Rect(60, 60, 30, 30); | 3001 gfx::Rect occlusionBehindSurface = gfx::Rect(60, 60, 30, 30); |
3002 gfx::Rect occlusionBehindReplica = gfx::Rect(210, 60, 30, 30); | 3002 gfx::Rect occlusionBehindReplica = gfx::Rect(210, 60, 30, 30); |
3003 | 3003 |
3004 gfx::Rect expectedOpaqueBounds = gfx::UnionRects(occlusionBehindSurface,
occlusionBehindReplica); | 3004 gfx::Rect expectedOpaqueBounds = gfx::UnionRects(occlusionBehindSurface,
occlusionBehindReplica); |
3005 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); | 3005 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); |
3006 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 3006 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
3007 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); | 3007 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); |
3008 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 3008 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
3009 } | 3009 } |
3010 }; | 3010 }; |
3011 | 3011 |
3012 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionBelowBackground
Filter); | 3012 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionBelowBackground
Filter); |
3013 | 3013 |
3014 template<class Types> | 3014 template<class Types> |
3015 class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : publ
ic OcclusionTrackerTest<Types> { | 3015 class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : publ
ic OcclusionTrackerTest<Types> { |
3016 protected: | 3016 protected: |
3017 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa
queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 3017 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa
queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
3018 void runMyTest() | 3018 void runMyTest() |
(...skipping 26 matching lines...) Expand all Loading... |
3045 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 3045 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
3046 this->visitLayer(filteredSurface, occlusion); | 3046 this->visitLayer(filteredSurface, occlusion); |
3047 this->visitContributingSurface(filteredSurface, occlusion); | 3047 this->visitContributingSurface(filteredSurface, occlusion); |
3048 | 3048 |
3049 // The filter is completely occluded, so it should not blur anything and
reduce any occlusion. | 3049 // The filter is completely occluded, so it should not blur anything and
reduce any occlusion. |
3050 gfx::Rect occlusionAboveSurface = gfx::Rect(50, 50, 50, 50); | 3050 gfx::Rect occlusionAboveSurface = gfx::Rect(50, 50, 50, 50); |
3051 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 50, 50); | 3051 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 50, 50); |
3052 | 3052 |
3053 gfx::Rect expectedOpaqueBounds = gfx::UnionRects(occlusionAboveSurface,
occlusionAboveReplica); | 3053 gfx::Rect expectedOpaqueBounds = gfx::UnionRects(occlusionAboveSurface,
occlusionAboveReplica); |
3054 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); | 3054 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); |
3055 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 3055 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
3056 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); | 3056 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); |
3057 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 3057 EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
3058 } | 3058 } |
3059 }; | 3059 }; |
3060 | 3060 |
3061 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionIfBackgroundFil
terIsOccluded); | 3061 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionIfBackgroundFil
terIsOccluded); |
3062 | 3062 |
3063 template<class Types> | 3063 template<class Types> |
3064 class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded
: public OcclusionTrackerTest<Types> { | 3064 class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded
: public OcclusionTrackerTest<Types> { |
3065 protected: | 3065 protected: |
3066 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b
ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 3066 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b
ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
3067 void runMyTest() | 3067 void runMyTest() |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3111 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 30 - outsetLeft, 50
); | 3111 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 30 - outsetLeft, 50
); |
3112 gfx::Rect occlusionBesideSurface = gfx::Rect(90, 40, 10, 10); | 3112 gfx::Rect occlusionBesideSurface = gfx::Rect(90, 40, 10, 10); |
3113 gfx::Rect occlusionBesideReplica = gfx::Rect(200, 40, 10, 10); | 3113 gfx::Rect occlusionBesideReplica = gfx::Rect(200, 40, 10, 10); |
3114 | 3114 |
3115 Region expectedOcclusion; | 3115 Region expectedOcclusion; |
3116 expectedOcclusion.Union(occlusionAboveSurface); | 3116 expectedOcclusion.Union(occlusionAboveSurface); |
3117 expectedOcclusion.Union(occlusionAboveReplica); | 3117 expectedOcclusion.Union(occlusionAboveReplica); |
3118 expectedOcclusion.Union(occlusionBesideSurface); | 3118 expectedOcclusion.Union(occlusionBesideSurface); |
3119 expectedOcclusion.Union(occlusionBesideReplica); | 3119 expectedOcclusion.Union(occlusionBesideReplica); |
3120 | 3120 |
3121 ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInTargetS
urface().rects().size()); | 3121 ASSERT_EQ(Region::Iterator(expectedOcclusion).size(), Region::Iterator(o
cclusion.occlusionInTargetSurface()).size()); |
3122 ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInScreenS
pace().rects().size()); | 3122 ASSERT_EQ(Region::Iterator(expectedOcclusion).size(), Region::Iterator(o
cclusion.occlusionInScreenSpace()).size()); |
3123 | 3123 |
3124 for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) { | 3124 Region::Iterator expectedRects(expectedOcclusion); |
3125 cc::IntRect expectedRect = expectedOcclusion.rects()[i]; | 3125 Region::Iterator screenSpaceRects(occlusion.occlusionInScreenSpace()); |
3126 cc::IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[
i]; | 3126 Region::Iterator targetSurfaceRects(occlusion.occlusionInTargetSurface()
); |
3127 cc::IntRect targetRect = occlusion.occlusionInTargetSurface().rects(
)[i]; | 3127 for (; expectedRects.has_rect(); expectedRects.next(), screenSpaceRects.
next(), targetSurfaceRects.next()) { |
3128 EXPECT_EQ(expectedRect, screenRect); | 3128 ASSERT_TRUE(screenSpaceRects.has_rect()); |
3129 EXPECT_EQ(expectedRect, targetRect); | 3129 ASSERT_TRUE(targetSurfaceRects.has_rect()); |
| 3130 EXPECT_EQ(expectedRects.rect(), screenSpaceRects.rect()); |
| 3131 EXPECT_EQ(expectedRects.rect(), targetSurfaceRects.rect()); |
3130 } | 3132 } |
3131 } | 3133 } |
3132 }; | 3134 }; |
3133 | 3135 |
3134 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte
rIsPartiallyOccluded); | 3136 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte
rIsPartiallyOccluded); |
3135 | 3137 |
3136 template<class Types> | 3138 template<class Types> |
3137 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type
s> { | 3139 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type
s> { |
3138 protected: | 3140 protected: |
3139 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 3141 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
3140 void runMyTest() | 3142 void runMyTest() |
3141 { | 3143 { |
3142 gfx::Size trackingSize(100, 100); | 3144 gfx::Size trackingSize(100, 100); |
3143 gfx::Size belowTrackingSize(99, 99); | 3145 gfx::Size belowTrackingSize(99, 99); |
3144 | 3146 |
3145 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); | 3147 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); |
3146 typename Types::LayerType* large = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), trackingSize, true); | 3148 typename Types::LayerType* large = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), trackingSize, true); |
3147 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), belowTrackingSize, true); | 3149 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), belowTrackingSize, true); |
3148 this->calcDrawEtc(parent); | 3150 this->calcDrawEtc(parent); |
3149 | 3151 |
3150 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 3152 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
3151 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 3153 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
3152 occlusion.setMinimumTrackingSize(trackingSize); | 3154 occlusion.setMinimumTrackingSize(trackingSize); |
3153 | 3155 |
3154 // The small layer is not tracked because it is too small. | 3156 // The small layer is not tracked because it is too small. |
3155 this->visitLayer(small, occlusion); | 3157 this->visitLayer(small, occlusion); |
3156 | 3158 |
3157 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds())
; | 3159 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds())
; |
3158 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 3160 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
3159 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds(
)); | 3161 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds(
)); |
3160 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 3162 EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
3161 | 3163 |
3162 // The large layer is tracked as it is large enough. | 3164 // The large layer is tracked as it is large enough. |
3163 this->visitLayer(large, occlusion); | 3165 this->visitLayer(large, occlusion); |
3164 | 3166 |
3165 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio
nInScreenSpace().bounds()); | 3167 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio
nInScreenSpace().bounds()); |
3166 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 3168 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size(
)); |
3167 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio
nInTargetSurface().bounds()); | 3169 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio
nInTargetSurface().bounds()); |
3168 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 3170 EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).siz
e()); |
3169 } | 3171 } |
3170 }; | 3172 }; |
3171 | 3173 |
3172 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); | 3174 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); |
3173 | 3175 |
3174 } // namespace | 3176 } // namespace |
OLD | NEW |