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