| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCOcclusionTracker.h" | 7 #include "CCOcclusionTracker.h" |
| 8 | 8 |
| 9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
| 10 #include "CCGeometryTestUtils.h" |
| 10 #include "CCLayerAnimationController.h" | 11 #include "CCLayerAnimationController.h" |
| 11 #include "CCLayerImpl.h" | 12 #include "CCLayerImpl.h" |
| 12 #include "CCLayerTreeHostCommon.h" | 13 #include "CCLayerTreeHostCommon.h" |
| 13 #include "CCLayerTreeTestCommon.h" | |
| 14 #include "CCMathUtil.h" | 14 #include "CCMathUtil.h" |
| 15 #include "CCOcclusionTrackerTestCommon.h" | 15 #include "CCOcclusionTrackerTestCommon.h" |
| 16 #include "CCOverdrawMetrics.h" | 16 #include "CCOverdrawMetrics.h" |
| 17 #include "CCSingleThreadProxy.h" | 17 #include "CCSingleThreadProxy.h" |
| 18 #include "LayerChromium.h" | 18 #include "LayerChromium.h" |
| 19 #include "Region.h" | 19 #include "Region.h" |
| 20 #include <gmock/gmock.h> | 20 #include <gmock/gmock.h> |
| 21 #include <gtest/gtest.h> | 21 #include <gtest/gtest.h> |
| 22 #include <public/WebFilterOperation.h> | 22 #include <public/WebFilterOperation.h> |
| 23 #include <public/WebFilterOperations.h> | 23 #include <public/WebFilterOperations.h> |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 419 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 420 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); | 420 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); |
| 421 this->calcDrawEtc(parent); | 421 this->calcDrawEtc(parent); |
| 422 | 422 |
| 423 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 423 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 424 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 424 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 425 | 425 |
| 426 this->visitLayer(layer, occlusion); | 426 this->visitLayer(layer, occlusion); |
| 427 this->enterLayer(parent, occlusion); | 427 this->enterLayer(parent, occlusion); |
| 428 | 428 |
| 429 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenS
pace().bounds()); | 429 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 430 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 430 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 431 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetS
urface().bounds()); | 431 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 432 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 432 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 433 | 433 |
| 434 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); | 434 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); |
| 435 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70))); | 435 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70))); |
| 436 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70))); | 436 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70))); |
| 437 EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 70, 70))); | 437 EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 70, 70))); |
| 438 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 31, 70, 70))); | 438 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 31, 70, 70))); |
| 439 | 439 |
| 440 occlusion.useDefaultLayerClipRect(); | 440 occlusion.useDefaultLayerClipRect(); |
| 441 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); | 441 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); |
| 442 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70))); | 442 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70))); |
| 443 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70))); | 443 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70))); |
| 444 EXPECT_TRUE(occlusion.occluded(parent, IntRect(31, 30, 70, 70))); | 444 EXPECT_TRUE(occlusion.occluded(parent, IntRect(31, 30, 70, 70))); |
| 445 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 70, 70))); | 445 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 70, 70))); |
| 446 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 446 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 447 | 447 |
| 448 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70,
70)).isEmpty()); | 448 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70,
70)).isEmpty()); |
| 449 EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRe
ct(parent, IntRect(29, 30, 70, 70))); | 449 EXPECT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(p
arent, IntRect(29, 30, 70, 70))); |
| 450 EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentR
ect(parent, IntRect(29, 29, 70, 70))); | 450 EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 29, 70, 70))); |
| 451 EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRe
ct(parent, IntRect(30, 29, 70, 70))); | 451 EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 29, 70, 70))); |
| 452 EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentR
ect(parent, IntRect(31, 29, 70, 70))); | 452 EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 29, 70, 70))); |
| 453 EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentR
ect(parent, IntRect(31, 30, 70, 70))); | 453 EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 30, 70, 70))); |
| 454 EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentR
ect(parent, IntRect(31, 31, 70, 70))); | 454 EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 31, 70, 70))); |
| 455 EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentR
ect(parent, IntRect(30, 31, 70, 70))); | 455 EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(
parent, IntRect(30, 31, 70, 70))); |
| 456 EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentR
ect(parent, IntRect(29, 31, 70, 70))); | 456 EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 31, 70, 70))); |
| 457 } | 457 } |
| 458 }; | 458 }; |
| 459 | 459 |
| 460 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestIdentityTransforms); | 460 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestIdentityTransforms); |
| 461 | 461 |
| 462 template<class Types, bool opaqueLayers> | 462 template<class Types, bool opaqueLayers> |
| 463 class CCOcclusionTrackerTestRotatedChild : public CCOcclusionTrackerTest<Types,
opaqueLayers> { | 463 class CCOcclusionTrackerTestRotatedChild : public CCOcclusionTrackerTest<Types,
opaqueLayers> { |
| 464 protected: | 464 protected: |
| 465 void runMyTest() | 465 void runMyTest() |
| 466 { | 466 { |
| 467 WebTransformationMatrix layerTransform; | 467 WebTransformationMatrix layerTransform; |
| 468 layerTransform.translate(250, 250); | 468 layerTransform.translate(250, 250); |
| 469 layerTransform.rotate(90); | 469 layerTransform.rotate(90); |
| 470 layerTransform.translate(-250, -250); | 470 layerTransform.translate(-250, -250); |
| 471 | 471 |
| 472 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 472 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 473 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); | 473 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); |
| 474 this->calcDrawEtc(parent); | 474 this->calcDrawEtc(parent); |
| 475 | 475 |
| 476 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 476 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 477 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 477 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 478 | 478 |
| 479 this->visitLayer(layer, occlusion); | 479 this->visitLayer(layer, occlusion); |
| 480 this->enterLayer(parent, occlusion); | 480 this->enterLayer(parent, occlusion); |
| 481 | 481 |
| 482 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenS
pace().bounds()); | 482 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 483 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 483 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 484 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetS
urface().bounds()); | 484 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 485 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 485 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 486 | 486 |
| 487 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); | 487 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); |
| 488 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70))); | 488 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70))); |
| 489 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70))); | 489 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70))); |
| 490 EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 70, 70))); | 490 EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 70, 70))); |
| 491 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 31, 70, 70))); | 491 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 31, 70, 70))); |
| 492 | 492 |
| 493 occlusion.useDefaultLayerClipRect(); | 493 occlusion.useDefaultLayerClipRect(); |
| 494 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); | 494 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); |
| 495 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70))); | 495 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70))); |
| 496 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70))); | 496 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70))); |
| 497 EXPECT_TRUE(occlusion.occluded(parent, IntRect(31, 30, 70, 70))); | 497 EXPECT_TRUE(occlusion.occluded(parent, IntRect(31, 30, 70, 70))); |
| 498 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 70, 70))); | 498 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 70, 70))); |
| 499 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 499 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 500 | 500 |
| 501 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70,
70)).isEmpty()); | 501 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70,
70)).isEmpty()); |
| 502 EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRe
ct(parent, IntRect(29, 30, 70, 70))); | 502 EXPECT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(p
arent, IntRect(29, 30, 70, 70))); |
| 503 EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentR
ect(parent, IntRect(29, 29, 70, 70))); | 503 EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 29, 70, 70))); |
| 504 EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRe
ct(parent, IntRect(30, 29, 70, 70))); | 504 EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 29, 70, 70))); |
| 505 EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentR
ect(parent, IntRect(31, 29, 70, 70))); | 505 EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 29, 70, 70))); |
| 506 EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentR
ect(parent, IntRect(31, 30, 70, 70))); | 506 EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 30, 70, 70))); |
| 507 EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentR
ect(parent, IntRect(31, 31, 70, 70))); | 507 EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 31, 70, 70))); |
| 508 EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentR
ect(parent, IntRect(30, 31, 70, 70))); | 508 EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(
parent, IntRect(30, 31, 70, 70))); |
| 509 EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentR
ect(parent, IntRect(29, 31, 70, 70))); | 509 EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 31, 70, 70))); |
| 510 } | 510 } |
| 511 }; | 511 }; |
| 512 | 512 |
| 513 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestRotatedChild); | 513 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestRotatedChild); |
| 514 | 514 |
| 515 template<class Types, bool opaqueLayers> | 515 template<class Types, bool opaqueLayers> |
| 516 class CCOcclusionTrackerTestTranslatedChild : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { | 516 class CCOcclusionTrackerTestTranslatedChild : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { |
| 517 protected: | 517 protected: |
| 518 void runMyTest() | 518 void runMyTest() |
| 519 { | 519 { |
| 520 WebTransformationMatrix layerTransform; | 520 WebTransformationMatrix layerTransform; |
| 521 layerTransform.translate(20, 20); | 521 layerTransform.translate(20, 20); |
| 522 | 522 |
| 523 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 523 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 524 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); | 524 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); |
| 525 this->calcDrawEtc(parent); | 525 this->calcDrawEtc(parent); |
| 526 | 526 |
| 527 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 527 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 528 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 528 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 529 | 529 |
| 530 this->visitLayer(layer, occlusion); | 530 this->visitLayer(layer, occlusion); |
| 531 this->enterLayer(parent, occlusion); | 531 this->enterLayer(parent, occlusion); |
| 532 | 532 |
| 533 EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenS
pace().bounds()); | 533 EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); |
| 534 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 534 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 535 EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetS
urface().bounds()); | 535 EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 536 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 536 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 537 | 537 |
| 538 EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50))); | 538 EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50))); |
| 539 EXPECT_FALSE(occlusion.occluded(parent, IntRect(49, 50, 50, 50))); | 539 EXPECT_FALSE(occlusion.occluded(parent, IntRect(49, 50, 50, 50))); |
| 540 EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 49, 50, 50))); | 540 EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 49, 50, 50))); |
| 541 EXPECT_FALSE(occlusion.occluded(parent, IntRect(51, 50, 50, 50))); | 541 EXPECT_FALSE(occlusion.occluded(parent, IntRect(51, 50, 50, 50))); |
| 542 EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 51, 50, 50))); | 542 EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 51, 50, 50))); |
| 543 | 543 |
| 544 occlusion.useDefaultLayerClipRect(); | 544 occlusion.useDefaultLayerClipRect(); |
| 545 EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50))); | 545 EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50))); |
| 546 EXPECT_FALSE(occlusion.occluded(parent, IntRect(49, 50, 50, 50))); | 546 EXPECT_FALSE(occlusion.occluded(parent, IntRect(49, 50, 50, 50))); |
| 547 EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 49, 50, 50))); | 547 EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 49, 50, 50))); |
| 548 EXPECT_TRUE(occlusion.occluded(parent, IntRect(51, 50, 50, 50))); | 548 EXPECT_TRUE(occlusion.occluded(parent, IntRect(51, 50, 50, 50))); |
| 549 EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 51, 50, 50))); | 549 EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 51, 50, 50))); |
| 550 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 550 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 551 | 551 |
| 552 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50,
50)).isEmpty()); | 552 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50,
50)).isEmpty()); |
| 553 EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRe
ct(parent, IntRect(49, 50, 50, 50))); | 553 EXPECT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(p
arent, IntRect(49, 50, 50, 50))); |
| 554 EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentR
ect(parent, IntRect(49, 49, 50, 50))); | 554 EXPECT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(
parent, IntRect(49, 49, 50, 50))); |
| 555 EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRe
ct(parent, IntRect(50, 49, 50, 50))); | 555 EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(p
arent, IntRect(50, 49, 50, 50))); |
| 556 EXPECT_INT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedContentR
ect(parent, IntRect(51, 49, 50, 50))); | 556 EXPECT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(
parent, IntRect(51, 49, 50, 50))); |
| 557 EXPECT_INT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedContentR
ect(parent, IntRect(51, 50, 50, 50))); | 557 EXPECT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(
parent, IntRect(51, 50, 50, 50))); |
| 558 EXPECT_INT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedContentR
ect(parent, IntRect(51, 51, 50, 50))); | 558 EXPECT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(
parent, IntRect(51, 51, 50, 50))); |
| 559 EXPECT_INT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedContentR
ect(parent, IntRect(50, 51, 50, 50))); | 559 EXPECT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(
parent, IntRect(50, 51, 50, 50))); |
| 560 EXPECT_INT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedContentR
ect(parent, IntRect(49, 51, 50, 50))); | 560 EXPECT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(
parent, IntRect(49, 51, 50, 50))); |
| 561 | 561 |
| 562 occlusion.useDefaultLayerClipRect(); | 562 occlusion.useDefaultLayerClipRect(); |
| 563 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50,
50)).isEmpty()); | 563 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50,
50)).isEmpty()); |
| 564 EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRe
ct(parent, IntRect(49, 50, 50, 50))); | 564 EXPECT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(p
arent, IntRect(49, 50, 50, 50))); |
| 565 EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentR
ect(parent, IntRect(49, 49, 50, 50))); | 565 EXPECT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(
parent, IntRect(49, 49, 50, 50))); |
| 566 EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRe
ct(parent, IntRect(50, 49, 50, 50))); | 566 EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(p
arent, IntRect(50, 49, 50, 50))); |
| 567 EXPECT_INT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRe
ct(parent, IntRect(51, 49, 50, 50))); | 567 EXPECT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(p
arent, IntRect(51, 49, 50, 50))); |
| 568 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50,
50)).isEmpty()); | 568 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50,
50)).isEmpty()); |
| 569 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50,
50)).isEmpty()); | 569 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50,
50)).isEmpty()); |
| 570 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50,
50)).isEmpty()); | 570 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50,
50)).isEmpty()); |
| 571 EXPECT_INT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRe
ct(parent, IntRect(49, 51, 50, 50))); | 571 EXPECT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(p
arent, IntRect(49, 51, 50, 50))); |
| 572 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 572 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 573 } | 573 } |
| 574 }; | 574 }; |
| 575 | 575 |
| 576 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTranslatedChild); | 576 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTranslatedChild); |
| 577 | 577 |
| 578 template<class Types, bool opaqueLayers> | 578 template<class Types, bool opaqueLayers> |
| 579 class CCOcclusionTrackerTestChildInRotatedChild : public CCOcclusionTrackerTest<
Types, opaqueLayers> { | 579 class CCOcclusionTrackerTestChildInRotatedChild : public CCOcclusionTrackerTest<
Types, opaqueLayers> { |
| 580 protected: | 580 protected: |
| 581 void runMyTest() | 581 void runMyTest() |
| 582 { | 582 { |
| 583 WebTransformationMatrix childTransform; | 583 WebTransformationMatrix childTransform; |
| 584 childTransform.translate(250, 250); | 584 childTransform.translate(250, 250); |
| 585 childTransform.rotate(90); | 585 childTransform.rotate(90); |
| 586 childTransform.translate(-250, -250); | 586 childTransform.translate(-250, -250); |
| 587 | 587 |
| 588 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 588 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 589 parent->setMasksToBounds(true); | 589 parent->setMasksToBounds(true); |
| 590 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); | 590 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); |
| 591 child->setMasksToBounds(true); | 591 child->setMasksToBounds(true); |
| 592 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); | 592 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); |
| 593 this->calcDrawEtc(parent); | 593 this->calcDrawEtc(parent); |
| 594 | 594 |
| 595 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 595 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 596 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 596 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 597 | 597 |
| 598 this->visitLayer(layer, occlusion); | 598 this->visitLayer(layer, occlusion); |
| 599 this->enterContributingSurface(child, occlusion); | 599 this->enterContributingSurface(child, occlusion); |
| 600 | 600 |
| 601 EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenS
pace().bounds()); | 601 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace
().bounds()); |
| 602 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 602 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 603 EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTarget
Surface().bounds()); | 603 EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurf
ace().bounds()); |
| 604 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 604 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 605 | 605 |
| 606 this->leaveContributingSurface(child, occlusion); | 606 this->leaveContributingSurface(child, occlusion); |
| 607 this->enterLayer(parent, occlusion); | 607 this->enterLayer(parent, occlusion); |
| 608 | 608 |
| 609 EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenS
pace().bounds()); | 609 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace
().bounds()); |
| 610 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 610 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 611 EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetS
urface().bounds()); | 611 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 612 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 612 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 613 | 613 |
| 614 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); | 614 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); |
| 615 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60))); | 615 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60))); |
| 616 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); | 616 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); |
| 617 EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 40, 70, 60))); | 617 EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 40, 70, 60))); |
| 618 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 41, 70, 60))); | 618 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 41, 70, 60))); |
| 619 | 619 |
| 620 occlusion.useDefaultLayerClipRect(); | 620 occlusion.useDefaultLayerClipRect(); |
| 621 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); | 621 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 // |child2| makes |parent|'s surface get considered by CCOcclusionTracke
r first, instead of |child|'s. This exercises different code in | 673 // |child2| makes |parent|'s surface get considered by CCOcclusionTracke
r first, instead of |child|'s. This exercises different code in |
| 674 // leaveToTargetRenderSurface, as the target surface has already been se
en. | 674 // leaveToTargetRenderSurface, as the target surface has already been se
en. |
| 675 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true); | 675 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true); |
| 676 this->calcDrawEtc(parent); | 676 this->calcDrawEtc(parent); |
| 677 | 677 |
| 678 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 678 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 679 occlusion.setLayerClipRect(IntRect(-10, -10, 1000, 1000)); | 679 occlusion.setLayerClipRect(IntRect(-10, -10, 1000, 1000)); |
| 680 | 680 |
| 681 this->visitLayer(child2, occlusion); | 681 this->visitLayer(child2, occlusion); |
| 682 | 682 |
| 683 EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenS
pace().bounds()); | 683 EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace
().bounds()); |
| 684 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 684 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 685 EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetS
urface().bounds()); | 685 EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 686 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 686 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 687 | 687 |
| 688 this->visitLayer(layer, occlusion); | 688 this->visitLayer(layer, occlusion); |
| 689 | 689 |
| 690 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenS
pace().bounds()); | 690 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 691 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 691 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 692 EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTarget
Surface().bounds()); | 692 EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurf
ace().bounds()); |
| 693 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 693 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 694 | 694 |
| 695 this->enterContributingSurface(child, occlusion); | 695 this->enterContributingSurface(child, occlusion); |
| 696 | 696 |
| 697 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenS
pace().bounds()); | 697 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 698 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 698 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 699 EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTarget
Surface().bounds()); | 699 EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurf
ace().bounds()); |
| 700 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 700 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 701 | 701 |
| 702 // Occlusion in |child2| should get merged with the |child| surface we a
re leaving now. | 702 // Occlusion in |child2| should get merged with the |child| surface we a
re leaving now. |
| 703 this->leaveContributingSurface(child, occlusion); | 703 this->leaveContributingSurface(child, occlusion); |
| 704 this->enterLayer(parent, occlusion); | 704 this->enterLayer(parent, occlusion); |
| 705 | 705 |
| 706 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenS
pace().bounds()); | 706 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 707 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 707 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 708 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetS
urface().bounds()); | 708 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 709 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 709 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 710 | 710 |
| 711 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); | 711 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); |
| 712 EXPECT_INT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedContentR
ect(parent, IntRect(30, 30, 70, 70))); | 712 EXPECT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(
parent, IntRect(30, 30, 70, 70))); |
| 713 | 713 |
| 714 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 60, 10))); | 714 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 60, 10))); |
| 715 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 60, 10))); | 715 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 60, 10))); |
| 716 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 60, 10))); | 716 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 60, 10))); |
| 717 EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 60, 10))); | 717 EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 60, 10))); |
| 718 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 60, 10))); | 718 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 60, 10))); |
| 719 | 719 |
| 720 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); | 720 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); |
| 721 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60))); | 721 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60))); |
| 722 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); | 722 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); |
| 723 | 723 |
| 724 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 60,
10)).isEmpty()); | 724 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 60,
10)).isEmpty()); |
| 725 EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRe
ct(parent, IntRect(29, 30, 60, 10))); | 725 EXPECT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(p
arent, IntRect(29, 30, 60, 10))); |
| 726 EXPECT_INT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRe
ct(parent, IntRect(30, 29, 60, 10))); | 726 EXPECT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 29, 60, 10))); |
| 727 EXPECT_INT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRe
ct(parent, IntRect(31, 30, 60, 10))); | 727 EXPECT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(p
arent, IntRect(31, 30, 60, 10))); |
| 728 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 31, 60,
10)).isEmpty()); | 728 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 31, 60,
10)).isEmpty()); |
| 729 | 729 |
| 730 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70,
60)).isEmpty()); | 730 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70,
60)).isEmpty()); |
| 731 EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRe
ct(parent, IntRect(29, 40, 70, 60))); | 731 EXPECT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(p
arent, IntRect(29, 40, 70, 60))); |
| 732 // This rect is mostly occluded by |child2|. | 732 // This rect is mostly occluded by |child2|. |
| 733 EXPECT_INT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRe
ct(parent, IntRect(30, 39, 70, 60))); | 733 EXPECT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 39, 70, 60))); |
| 734 // This rect extends past top/right ends of |child2|. | 734 // This rect extends past top/right ends of |child2|. |
| 735 EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedContentR
ect(parent, IntRect(30, 29, 70, 70))); | 735 EXPECT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(
parent, IntRect(30, 29, 70, 70))); |
| 736 // This rect extends past left/right ends of |child2|. | 736 // This rect extends past left/right ends of |child2|. |
| 737 EXPECT_INT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedContentR
ect(parent, IntRect(20, 39, 80, 60))); | 737 EXPECT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(
parent, IntRect(20, 39, 80, 60))); |
| 738 EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentR
ect(parent, IntRect(31, 40, 70, 60))); | 738 EXPECT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(
parent, IntRect(31, 40, 70, 60))); |
| 739 EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentR
ect(parent, IntRect(30, 41, 70, 60))); | 739 EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(
parent, IntRect(30, 41, 70, 60))); |
| 740 | 740 |
| 741 /* Justification for the above occlusion from |layer|: | 741 /* Justification for the above occlusion from |layer|: |
| 742 100 | 742 100 |
| 743 +---------------------+ +--------
-------------+ | 743 +---------------------+ +--------
-------------+ |
| 744 | | |
|30 Visible region of |layer|: ///// | 744 | | |
|30 Visible region of |layer|: ///// |
| 745 | 30 | rotate(90) | 30
60 | |child2|: \\\\\ | 745 | 30 | rotate(90) | 30
60 | |child2|: \\\\\ |
| 746 | 30 + ------------+--------------------+ | 30 +--
----------+--------------------+ | 746 | 30 + ------------+--------------------+ | 30 +--
----------+--------------------+ |
| 747 100 | | 10 | | | ==> | |\\
\\\\\\\\\\| |10 | | 747 100 | | 10 | | | ==> | |\\
\\\\\\\\\\| |10 | |
| 748 | |10+----------|----------------------+ | +--|\\
\\\\\\\\\\|-----------------+ | | 748 | |10+----------|----------------------+ | +--|\\
\\\\\\\\\\|-----------------+ | |
| 749 | + ------------+ | | | | | +--
----------+//| 420 | | | 749 | + ------------+ | | | | | +--
----------+//| 420 | | |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 this->calcDrawEtc(parent); | 787 this->calcDrawEtc(parent); |
| 788 | 788 |
| 789 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 789 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 790 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 790 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 791 | 791 |
| 792 IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); | 792 IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); |
| 793 | 793 |
| 794 this->visitLayer(layer, occlusion); | 794 this->visitLayer(layer, occlusion); |
| 795 this->enterContributingSurface(child, occlusion); | 795 this->enterContributingSurface(child, occlusion); |
| 796 | 796 |
| 797 EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds(
)); | 797 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); |
| 798 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 798 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
| 799 EXPECT_INT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurfa
ce().bounds()); | 799 EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface()
.bounds()); |
| 800 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 800 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 801 | 801 |
| 802 EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); | 802 EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); |
| 803 EXPECT_TRUE(occlusion.unoccludedContentRect(child, clippedLayerInChild).
isEmpty()); | 803 EXPECT_TRUE(occlusion.unoccludedContentRect(child, clippedLayerInChild).
isEmpty()); |
| 804 clippedLayerInChild.move(-1, 0); | 804 clippedLayerInChild.move(-1, 0); |
| 805 EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild)); | 805 EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild)); |
| 806 EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild)
.isEmpty()); | 806 EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild)
.isEmpty()); |
| 807 clippedLayerInChild.move(1, 0); | 807 clippedLayerInChild.move(1, 0); |
| 808 clippedLayerInChild.move(1, 0); | 808 clippedLayerInChild.move(1, 0); |
| 809 EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild)); | 809 EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild)); |
| 810 EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild)
.isEmpty()); | 810 EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild)
.isEmpty()); |
| 811 clippedLayerInChild.move(-1, 0); | 811 clippedLayerInChild.move(-1, 0); |
| 812 clippedLayerInChild.move(0, -1); | 812 clippedLayerInChild.move(0, -1); |
| 813 EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild)); | 813 EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild)); |
| 814 EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild)
.isEmpty()); | 814 EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild)
.isEmpty()); |
| 815 clippedLayerInChild.move(0, 1); | 815 clippedLayerInChild.move(0, 1); |
| 816 clippedLayerInChild.move(0, 1); | 816 clippedLayerInChild.move(0, 1); |
| 817 EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild)); | 817 EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild)); |
| 818 EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild)
.isEmpty()); | 818 EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild)
.isEmpty()); |
| 819 clippedLayerInChild.move(0, -1); | 819 clippedLayerInChild.move(0, -1); |
| 820 | 820 |
| 821 this->leaveContributingSurface(child, occlusion); | 821 this->leaveContributingSurface(child, occlusion); |
| 822 this->enterLayer(parent, occlusion); | 822 this->enterLayer(parent, occlusion); |
| 823 | 823 |
| 824 EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds(
)); | 824 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); |
| 825 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 825 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
| 826 EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bound
s()); | 826 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds())
; |
| 827 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 827 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 828 | 828 |
| 829 EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); | 829 EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); |
| 830 EXPECT_INT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRec
t(parent, IntRect(75, 55, 1, 1))); | 830 EXPECT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(pa
rent, IntRect(75, 55, 1, 1))); |
| 831 } | 831 } |
| 832 }; | 832 }; |
| 833 | 833 |
| 834 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceRotatedOffAxis); | 834 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceRotatedOffAxis); |
| 835 | 835 |
| 836 template<class Types, bool opaqueLayers> | 836 template<class Types, bool opaqueLayers> |
| 837 class CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public CCOcclusionTra
ckerTest<Types, opaqueLayers> { | 837 class CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public CCOcclusionTra
ckerTest<Types, opaqueLayers> { |
| 838 protected: | 838 protected: |
| 839 void runMyTest() | 839 void runMyTest() |
| 840 { | 840 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 851 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true); | 851 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true); |
| 852 this->calcDrawEtc(parent); | 852 this->calcDrawEtc(parent); |
| 853 | 853 |
| 854 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 854 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 855 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 855 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 856 | 856 |
| 857 this->visitLayer(layer2, occlusion); | 857 this->visitLayer(layer2, occlusion); |
| 858 this->visitLayer(layer1, occlusion); | 858 this->visitLayer(layer1, occlusion); |
| 859 this->enterContributingSurface(child, occlusion); | 859 this->enterContributingSurface(child, occlusion); |
| 860 | 860 |
| 861 EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenS
pace().bounds()); | 861 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace
().bounds()); |
| 862 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 862 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 863 EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTarget
Surface().bounds()); | 863 EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurf
ace().bounds()); |
| 864 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 864 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 865 | 865 |
| 866 EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70))); | 866 EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70))); |
| 867 EXPECT_FALSE(occlusion.occluded(child, IntRect(9, 430, 60, 70))); | 867 EXPECT_FALSE(occlusion.occluded(child, IntRect(9, 430, 60, 70))); |
| 868 EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 429, 60, 70))); | 868 EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 429, 60, 70))); |
| 869 EXPECT_FALSE(occlusion.occluded(child, IntRect(11, 430, 60, 70))); | 869 EXPECT_FALSE(occlusion.occluded(child, IntRect(11, 430, 60, 70))); |
| 870 EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70))); | 870 EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70))); |
| 871 | 871 |
| 872 EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60,
70)).isEmpty()); | 872 EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60,
70)).isEmpty()); |
| 873 EXPECT_INT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRe
ct(child, IntRect(9, 430, 60, 70))); | 873 EXPECT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(c
hild, IntRect(9, 430, 60, 70))); |
| 874 EXPECT_INT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentR
ect(child, IntRect(10, 429, 60, 70))); | 874 EXPECT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(
child, IntRect(10, 429, 60, 70))); |
| 875 EXPECT_INT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentR
ect(child, IntRect(11, 430, 60, 70))); | 875 EXPECT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(
child, IntRect(11, 430, 60, 70))); |
| 876 EXPECT_INT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentR
ect(child, IntRect(10, 431, 60, 70))); | 876 EXPECT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(
child, IntRect(10, 431, 60, 70))); |
| 877 | 877 |
| 878 this->leaveContributingSurface(child, occlusion); | 878 this->leaveContributingSurface(child, occlusion); |
| 879 this->enterLayer(parent, occlusion); | 879 this->enterLayer(parent, occlusion); |
| 880 | 880 |
| 881 EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenS
pace().bounds()); | 881 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace
().bounds()); |
| 882 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 882 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 883 EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetS
urface().bounds()); | 883 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 884 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 884 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 885 | 885 |
| 886 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); | 886 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); |
| 887 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60))); | 887 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60))); |
| 888 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); | 888 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); |
| 889 | 889 |
| 890 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70,
60)).isEmpty()); | 890 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70,
60)).isEmpty()); |
| 891 EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRe
ct(parent, IntRect(29, 40, 70, 60))); | 891 EXPECT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(p
arent, IntRect(29, 40, 70, 60))); |
| 892 EXPECT_INT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRe
ct(parent, IntRect(30, 39, 70, 60))); | 892 EXPECT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 39, 70, 60))); |
| 893 EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentR
ect(parent, IntRect(31, 40, 70, 60))); | 893 EXPECT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(
parent, IntRect(31, 40, 70, 60))); |
| 894 EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentR
ect(parent, IntRect(30, 41, 70, 60))); | 894 EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(
parent, IntRect(30, 41, 70, 60))); |
| 895 | 895 |
| 896 /* Justification for the above occlusion from |layer1| and |layer2|: | 896 /* Justification for the above occlusion from |layer1| and |layer2|: |
| 897 | 897 |
| 898 +---------------------+ | 898 +---------------------+ |
| 899 | |30 Visible region of |layer1|: ///// | 899 | |30 Visible region of |layer1|: ///// |
| 900 | | Visible region of |layer2|: \\\\\ | 900 | | Visible region of |layer2|: \\\\\ |
| 901 | +---------------------------------+ | 901 | +---------------------------------+ |
| 902 | | |10 | | 902 | | |10 | |
| 903 | +---------------+-----------------+ | | 903 | +---------------+-----------------+ | |
| 904 | | |\\\\\\\\\\\\|//| 420 | | | 904 | | |\\\\\\\\\\\\|//| 420 | | |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); | 939 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); |
| 940 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); | 940 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); |
| 941 this->calcDrawEtc(parent); | 941 this->calcDrawEtc(parent); |
| 942 | 942 |
| 943 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 943 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 944 occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); | 944 occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); |
| 945 | 945 |
| 946 this->visitLayer(layer2, occlusion); | 946 this->visitLayer(layer2, occlusion); |
| 947 this->enterContributingSurface(child2, occlusion); | 947 this->enterContributingSurface(child2, occlusion); |
| 948 | 948 |
| 949 EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenS
pace().bounds()); | 949 EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 950 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 950 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 951 EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTarge
tSurface().bounds()); | 951 EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSur
face().bounds()); |
| 952 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 952 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 953 | 953 |
| 954 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); | 954 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); |
| 955 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80))); | 955 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80))); |
| 956 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80))); | 956 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80))); |
| 957 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80))); | 957 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80))); |
| 958 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81))); | 958 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81))); |
| 959 | 959 |
| 960 occlusion.useDefaultLayerClipRect(); | 960 occlusion.useDefaultLayerClipRect(); |
| 961 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); | 961 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); |
| 962 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80))); | 962 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80))); |
| 963 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80))); | 963 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80))); |
| 964 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80))); | 964 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80))); |
| 965 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81))); | 965 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81))); |
| 966 occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); | 966 occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); |
| 967 | 967 |
| 968 // There is nothing above child2's surface in the z-order. | 968 // There is nothing above child2's surface in the z-order. |
| 969 EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContri
butingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); | 969 EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributi
ngSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); |
| 970 | 970 |
| 971 this->leaveContributingSurface(child2, occlusion); | 971 this->leaveContributingSurface(child2, occlusion); |
| 972 this->visitLayer(layer1, occlusion); | 972 this->visitLayer(layer1, occlusion); |
| 973 this->enterContributingSurface(child1, occlusion); | 973 this->enterContributingSurface(child1, occlusion); |
| 974 | 974 |
| 975 EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenS
pace().bounds()); | 975 EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace
().bounds()); |
| 976 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 976 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 977 EXPECT_INT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTarge
tSurface().bounds()); | 977 EXPECT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSur
face().bounds()); |
| 978 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 978 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 979 | 979 |
| 980 EXPECT_TRUE(occlusion.occluded(child1, IntRect(-10, 430, 80, 70))); | 980 EXPECT_TRUE(occlusion.occluded(child1, IntRect(-10, 430, 80, 70))); |
| 981 EXPECT_FALSE(occlusion.occluded(child1, IntRect(-11, 430, 80, 70))); | 981 EXPECT_FALSE(occlusion.occluded(child1, IntRect(-11, 430, 80, 70))); |
| 982 EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 429, 80, 70))); | 982 EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 429, 80, 70))); |
| 983 EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 81, 70))); | 983 EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 81, 70))); |
| 984 EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 80, 71))); | 984 EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 80, 71))); |
| 985 | 985 |
| 986 // child2's contents will occlude child1 below it. | 986 // child2's contents will occlude child1 below it. |
| 987 EXPECT_INT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContri
butingSurfaceContentRect(child1, false, IntRect(-10, 430, 80, 70))); | 987 EXPECT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributi
ngSurfaceContentRect(child1, false, IntRect(-10, 430, 80, 70))); |
| 988 | 988 |
| 989 this->leaveContributingSurface(child1, occlusion); | 989 this->leaveContributingSurface(child1, occlusion); |
| 990 this->enterLayer(parent, occlusion); | 990 this->enterLayer(parent, occlusion); |
| 991 | 991 |
| 992 EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenS
pace().bounds()); | 992 EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace
().bounds()); |
| 993 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 993 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 994 EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetS
urface().bounds()); | 994 EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 995 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 995 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 996 | 996 |
| 997 EXPECT_FALSE(occlusion.occluded(parent, IntRect(20, 20, 80, 80))); | 997 EXPECT_FALSE(occlusion.occluded(parent, IntRect(20, 20, 80, 80))); |
| 998 | 998 |
| 999 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 20, 70, 80))); | 999 EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 20, 70, 80))); |
| 1000 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 20, 70, 80))); | 1000 EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 20, 70, 80))); |
| 1001 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 19, 70, 80))); | 1001 EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 19, 70, 80))); |
| 1002 | 1002 |
| 1003 EXPECT_TRUE(occlusion.occluded(parent, IntRect(20, 30, 80, 70))); | 1003 EXPECT_TRUE(occlusion.occluded(parent, IntRect(20, 30, 80, 70))); |
| 1004 EXPECT_FALSE(occlusion.occluded(parent, IntRect(19, 30, 80, 70))); | 1004 EXPECT_FALSE(occlusion.occluded(parent, IntRect(19, 30, 80, 70))); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true); | 1054 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true); |
| 1055 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); | 1055 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); |
| 1056 this->calcDrawEtc(parent); | 1056 this->calcDrawEtc(parent); |
| 1057 | 1057 |
| 1058 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1058 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1059 occlusion.setLayerClipRect(IntRect(-30, -30, 1000, 1000)); | 1059 occlusion.setLayerClipRect(IntRect(-30, -30, 1000, 1000)); |
| 1060 | 1060 |
| 1061 this->visitLayer(layer2, occlusion); | 1061 this->visitLayer(layer2, occlusion); |
| 1062 this->enterLayer(child2, occlusion); | 1062 this->enterLayer(child2, occlusion); |
| 1063 | 1063 |
| 1064 EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenS
pace().bounds()); | 1064 EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 1065 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1065 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1066 EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTarge
tSurface().bounds()); | 1066 EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSur
face().bounds()); |
| 1067 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1067 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1068 | 1068 |
| 1069 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); | 1069 EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); |
| 1070 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80))); | 1070 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80))); |
| 1071 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80))); | 1071 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80))); |
| 1072 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80))); | 1072 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80))); |
| 1073 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81))); | 1073 EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81))); |
| 1074 | 1074 |
| 1075 this->leaveLayer(child2, occlusion); | 1075 this->leaveLayer(child2, occlusion); |
| 1076 this->enterContributingSurface(child2, occlusion); | 1076 this->enterContributingSurface(child2, occlusion); |
| 1077 | 1077 |
| 1078 // There is nothing above child2's surface in the z-order. | 1078 // There is nothing above child2's surface in the z-order. |
| 1079 EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContri
butingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); | 1079 EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributi
ngSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); |
| 1080 | 1080 |
| 1081 this->leaveContributingSurface(child2, occlusion); | 1081 this->leaveContributingSurface(child2, occlusion); |
| 1082 this->visitLayer(layer1, occlusion); | 1082 this->visitLayer(layer1, occlusion); |
| 1083 this->enterContributingSurface(child1, occlusion); | 1083 this->enterContributingSurface(child1, occlusion); |
| 1084 | 1084 |
| 1085 EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenS
pace().bounds()); | 1085 EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace
().bounds()); |
| 1086 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1086 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1087 EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTarge
tSurface().bounds()); | 1087 EXPECT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSur
face().bounds()); |
| 1088 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1088 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1089 | 1089 |
| 1090 EXPECT_TRUE(occlusion.occluded(child1, IntRect(420, -20, 80, 90))); | 1090 EXPECT_TRUE(occlusion.occluded(child1, IntRect(420, -20, 80, 90))); |
| 1091 EXPECT_FALSE(occlusion.occluded(child1, IntRect(419, -20, 80, 90))); | 1091 EXPECT_FALSE(occlusion.occluded(child1, IntRect(419, -20, 80, 90))); |
| 1092 EXPECT_FALSE(occlusion.occluded(child1, IntRect(420, -21, 80, 90))); | 1092 EXPECT_FALSE(occlusion.occluded(child1, IntRect(420, -21, 80, 90))); |
| 1093 EXPECT_FALSE(occlusion.occluded(child1, IntRect(420, -19, 80, 90))); | 1093 EXPECT_FALSE(occlusion.occluded(child1, IntRect(420, -19, 80, 90))); |
| 1094 EXPECT_FALSE(occlusion.occluded(child1, IntRect(421, -20, 80, 90))); | 1094 EXPECT_FALSE(occlusion.occluded(child1, IntRect(421, -20, 80, 90))); |
| 1095 | 1095 |
| 1096 // child2's contents will occlude child1 below it. | 1096 // child2's contents will occlude child1 below it. |
| 1097 EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContri
butingSurfaceContentRect(child1, false, IntRect(420, -20, 80, 90))); | 1097 EXPECT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributi
ngSurfaceContentRect(child1, false, IntRect(420, -20, 80, 90))); |
| 1098 EXPECT_INT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContri
butingSurfaceContentRect(child1, false, IntRect(420, -10, 80, 90))); | 1098 EXPECT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributi
ngSurfaceContentRect(child1, false, IntRect(420, -10, 80, 90))); |
| 1099 EXPECT_INT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContri
butingSurfaceContentRect(child1, false, IntRect(420, -20, 70, 90))); | 1099 EXPECT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributi
ngSurfaceContentRect(child1, false, IntRect(420, -20, 70, 90))); |
| 1100 | 1100 |
| 1101 this->leaveContributingSurface(child1, occlusion); | 1101 this->leaveContributingSurface(child1, occlusion); |
| 1102 this->enterLayer(parent, occlusion); | 1102 this->enterLayer(parent, occlusion); |
| 1103 | 1103 |
| 1104 EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenS
pace().bounds()); | 1104 EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace
().bounds()); |
| 1105 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1105 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1106 EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetS
urface().bounds()); | 1106 EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1107 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1107 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1108 | 1108 |
| 1109 EXPECT_TRUE(occlusion.occluded(parent, IntRect(10, 20, 90, 80))); | 1109 EXPECT_TRUE(occlusion.occluded(parent, IntRect(10, 20, 90, 80))); |
| 1110 EXPECT_FALSE(occlusion.occluded(parent, IntRect(9, 20, 90, 80))); | 1110 EXPECT_FALSE(occlusion.occluded(parent, IntRect(9, 20, 90, 80))); |
| 1111 EXPECT_FALSE(occlusion.occluded(parent, IntRect(10, 19, 90, 80))); | 1111 EXPECT_FALSE(occlusion.occluded(parent, IntRect(10, 19, 90, 80))); |
| 1112 EXPECT_FALSE(occlusion.occluded(parent, IntRect(11, 20, 90, 80))); | 1112 EXPECT_FALSE(occlusion.occluded(parent, IntRect(11, 20, 90, 80))); |
| 1113 EXPECT_FALSE(occlusion.occluded(parent, IntRect(10, 21, 90, 80))); | 1113 EXPECT_FALSE(occlusion.occluded(parent, IntRect(10, 21, 90, 80))); |
| 1114 | 1114 |
| 1115 /* Justification for the above occlusion: | 1115 /* Justification for the above occlusion: |
| 1116 100 | 1116 100 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 | 1182 |
| 1183 // And has nothing to contribute to its parent surface. | 1183 // And has nothing to contribute to its parent surface. |
| 1184 this->leaveContributingSurface(opacityLayer, occlusion); | 1184 this->leaveContributingSurface(opacityLayer, occlusion); |
| 1185 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1185 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); |
| 1186 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1186 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); |
| 1187 | 1187 |
| 1188 // Opaque layer will contribute to occlusion. | 1188 // Opaque layer will contribute to occlusion. |
| 1189 this->visitLayer(opaqueLayer, occlusion); | 1189 this->visitLayer(opaqueLayer, occlusion); |
| 1190 this->enterContributingSurface(opaqueLayer, occlusion); | 1190 this->enterContributingSurface(opaqueLayer, occlusion); |
| 1191 | 1191 |
| 1192 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenS
pace().bounds()); | 1192 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 1193 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1193 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1194 EXPECT_INT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetS
urface().bounds()); | 1194 EXPECT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1195 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1195 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1196 | 1196 |
| 1197 // And it gets translated to the parent surface. | 1197 // And it gets translated to the parent surface. |
| 1198 this->leaveContributingSurface(opaqueLayer, occlusion); | 1198 this->leaveContributingSurface(opaqueLayer, occlusion); |
| 1199 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenS
pace().bounds()); | 1199 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 1200 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1200 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1201 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetS
urface().bounds()); | 1201 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1202 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1202 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1203 | 1203 |
| 1204 // The blur layer needs to throw away any occlusion from outside its sub
tree. | 1204 // The blur layer needs to throw away any occlusion from outside its sub
tree. |
| 1205 this->enterLayer(blurLayer, occlusion); | 1205 this->enterLayer(blurLayer, occlusion); |
| 1206 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1206 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); |
| 1207 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1207 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); |
| 1208 | 1208 |
| 1209 // And it won't contribute to occlusion. | 1209 // And it won't contribute to occlusion. |
| 1210 this->leaveLayer(blurLayer, occlusion); | 1210 this->leaveLayer(blurLayer, occlusion); |
| 1211 this->enterContributingSurface(blurLayer, occlusion); | 1211 this->enterContributingSurface(blurLayer, occlusion); |
| 1212 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1212 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); |
| 1213 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1213 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); |
| 1214 | 1214 |
| 1215 // But the opaque layer's occlusion is preserved on the parent. | 1215 // But the opaque layer's occlusion is preserved on the parent. |
| 1216 this->leaveContributingSurface(blurLayer, occlusion); | 1216 this->leaveContributingSurface(blurLayer, occlusion); |
| 1217 this->enterLayer(parent, occlusion); | 1217 this->enterLayer(parent, occlusion); |
| 1218 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenS
pace().bounds()); | 1218 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 1219 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1219 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1220 EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetS
urface().bounds()); | 1220 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1221 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1221 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1222 } | 1222 } |
| 1223 }; | 1223 }; |
| 1224 | 1224 |
| 1225 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestFilters); | 1225 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestFilters); |
| 1226 | 1226 |
| 1227 template<class Types, bool opaqueLayers> | 1227 template<class Types, bool opaqueLayers> |
| 1228 class CCOcclusionTrackerTestReplicaDoesOcclude : public CCOcclusionTrackerTest<T
ypes, opaqueLayers> { | 1228 class CCOcclusionTrackerTestReplicaDoesOcclude : public CCOcclusionTrackerTest<T
ypes, opaqueLayers> { |
| 1229 protected: | 1229 protected: |
| 1230 void runMyTest() | 1230 void runMyTest() |
| 1231 { | 1231 { |
| 1232 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 1232 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 1233 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); | 1233 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); |
| 1234 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), IntSize()); | 1234 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), IntSize()); |
| 1235 this->calcDrawEtc(parent); | 1235 this->calcDrawEtc(parent); |
| 1236 | 1236 |
| 1237 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1237 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1238 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1238 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1239 | 1239 |
| 1240 this->visitLayer(surface, occlusion); | 1240 this->visitLayer(surface, occlusion); |
| 1241 | 1241 |
| 1242 EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenS
pace().bounds()); | 1242 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); |
| 1243 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1243 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1244 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 1244 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); |
| 1245 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1245 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1246 | 1246 |
| 1247 this->visitContributingSurface(surface, occlusion); | 1247 this->visitContributingSurface(surface, occlusion); |
| 1248 this->enterLayer(parent, occlusion); | 1248 this->enterLayer(parent, occlusion); |
| 1249 | 1249 |
| 1250 // The surface and replica should both be occluding the parent. | 1250 // The surface and replica should both be occluding the parent. |
| 1251 EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTarge
tSurface().bounds()); | 1251 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
| 1252 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1252 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1253 } | 1253 } |
| 1254 }; | 1254 }; |
| 1255 | 1255 |
| 1256 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaDoesOcclude); | 1256 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaDoesOcclude); |
| 1257 | 1257 |
| 1258 template<class Types, bool opaqueLayers> | 1258 template<class Types, bool opaqueLayers> |
| 1259 class CCOcclusionTrackerTestReplicaWithClipping : public CCOcclusionTrackerTest<
Types, opaqueLayers> { | 1259 class CCOcclusionTrackerTestReplicaWithClipping : public CCOcclusionTrackerTest<
Types, opaqueLayers> { |
| 1260 protected: | 1260 protected: |
| 1261 void runMyTest() | 1261 void runMyTest() |
| 1262 { | 1262 { |
| 1263 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 170)); | 1263 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 170)); |
| 1264 parent->setMasksToBounds(true); | 1264 parent->setMasksToBounds(true); |
| 1265 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); | 1265 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); |
| 1266 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), IntSize()); | 1266 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), IntSize()); |
| 1267 this->calcDrawEtc(parent); | 1267 this->calcDrawEtc(parent); |
| 1268 | 1268 |
| 1269 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1269 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1270 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1270 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1271 | 1271 |
| 1272 this->visitLayer(surface, occlusion); | 1272 this->visitLayer(surface, occlusion); |
| 1273 | 1273 |
| 1274 EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenS
pace().bounds()); | 1274 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); |
| 1275 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1275 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1276 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 1276 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); |
| 1277 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1277 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1278 | 1278 |
| 1279 this->visitContributingSurface(surface, occlusion); | 1279 this->visitContributingSurface(surface, occlusion); |
| 1280 this->enterLayer(parent, occlusion); | 1280 this->enterLayer(parent, occlusion); |
| 1281 | 1281 |
| 1282 // The surface and replica should both be occluding the parent. | 1282 // The surface and replica should both be occluding the parent. |
| 1283 EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTarget
Surface().bounds()); | 1283 EXPECT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurf
ace().bounds()); |
| 1284 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1284 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1285 } | 1285 } |
| 1286 }; | 1286 }; |
| 1287 | 1287 |
| 1288 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithClipping); | 1288 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithClipping); |
| 1289 | 1289 |
| 1290 template<class Types, bool opaqueLayers> | 1290 template<class Types, bool opaqueLayers> |
| 1291 class CCOcclusionTrackerTestReplicaWithMask : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { | 1291 class CCOcclusionTrackerTestReplicaWithMask : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { |
| 1292 protected: | 1292 protected: |
| 1293 void runMyTest() | 1293 void runMyTest() |
| 1294 { | 1294 { |
| 1295 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 1295 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 1296 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); | 1296 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); |
| 1297 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, FloatPoint(50, 50), IntSize()); | 1297 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, FloatPoint(50, 50), IntSize()); |
| 1298 this->createMaskLayer(replica, IntSize(10, 10)); | 1298 this->createMaskLayer(replica, IntSize(10, 10)); |
| 1299 this->calcDrawEtc(parent); | 1299 this->calcDrawEtc(parent); |
| 1300 | 1300 |
| 1301 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1301 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1302 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1302 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1303 | 1303 |
| 1304 this->visitLayer(surface, occlusion); | 1304 this->visitLayer(surface, occlusion); |
| 1305 | 1305 |
| 1306 EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenS
pace().bounds()); | 1306 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); |
| 1307 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1307 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1308 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 1308 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); |
| 1309 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1309 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1310 | 1310 |
| 1311 this->visitContributingSurface(surface, occlusion); | 1311 this->visitContributingSurface(surface, occlusion); |
| 1312 this->enterLayer(parent, occlusion); | 1312 this->enterLayer(parent, occlusion); |
| 1313 | 1313 |
| 1314 // The replica should not be occluding the parent, since it has a mask a
pplied to it. | 1314 // The replica should not be occluding the parent, since it has a mask a
pplied to it. |
| 1315 EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetS
urface().bounds()); | 1315 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1316 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1316 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1317 } | 1317 } |
| 1318 }; | 1318 }; |
| 1319 | 1319 |
| 1320 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithMask); | 1320 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithMask); |
| 1321 | 1321 |
| 1322 template<class Types, bool opaqueLayers> | 1322 template<class Types, bool opaqueLayers> |
| 1323 class CCOcclusionTrackerTestLayerClipRectOutsideChild : public CCOcclusionTracke
rTest<Types, opaqueLayers> { | 1323 class CCOcclusionTrackerTestLayerClipRectOutsideChild : public CCOcclusionTracke
rTest<Types, opaqueLayers> { |
| 1324 protected: | 1324 protected: |
| 1325 void runMyTest() | 1325 void runMyTest() |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1350 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); | 1350 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); |
| 1351 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1351 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1352 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); | 1352 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); |
| 1353 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1353 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1354 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); | 1354 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); |
| 1355 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); | 1355 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); |
| 1356 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); | 1356 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); |
| 1357 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); | 1357 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); |
| 1358 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1358 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1359 | 1359 |
| 1360 EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedCont
entRect(parent, IntRect(0, 0, 300, 300))); | 1360 EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); |
| 1361 } | 1361 } |
| 1362 }; | 1362 }; |
| 1363 | 1363 |
| 1364 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectOutsideChild); | 1364 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectOutsideChild); |
| 1365 | 1365 |
| 1366 template<class Types, bool opaqueLayers> | 1366 template<class Types, bool opaqueLayers> |
| 1367 class CCOcclusionTrackerTestViewportRectOutsideChild : public CCOcclusionTracker
Test<Types, opaqueLayers> { | 1367 class CCOcclusionTrackerTestViewportRectOutsideChild : public CCOcclusionTracker
Test<Types, opaqueLayers> { |
| 1368 protected: | 1368 protected: |
| 1369 void runMyTest() | 1369 void runMyTest() |
| 1370 { | 1370 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1394 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); | 1394 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); |
| 1395 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1395 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1396 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); | 1396 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); |
| 1397 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1397 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1398 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); | 1398 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); |
| 1399 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); | 1399 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); |
| 1400 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); | 1400 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); |
| 1401 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); | 1401 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); |
| 1402 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1402 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1403 | 1403 |
| 1404 EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedCont
entRect(parent, IntRect(0, 0, 300, 300))); | 1404 EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); |
| 1405 } | 1405 } |
| 1406 }; | 1406 }; |
| 1407 | 1407 |
| 1408 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectOutsideChild); | 1408 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectOutsideChild); |
| 1409 | 1409 |
| 1410 template<class Types, bool opaqueLayers> | 1410 template<class Types, bool opaqueLayers> |
| 1411 class CCOcclusionTrackerTestLayerClipRectOverChild : public CCOcclusionTrackerTe
st<Types, opaqueLayers> { | 1411 class CCOcclusionTrackerTestLayerClipRectOverChild : public CCOcclusionTrackerTe
st<Types, opaqueLayers> { |
| 1412 protected: | 1412 protected: |
| 1413 void runMyTest() | 1413 void runMyTest() |
| 1414 { | 1414 { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); | 1511 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); |
| 1512 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1512 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1513 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); | 1513 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); |
| 1514 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))); | 1514 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))); |
| 1515 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); | 1515 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); |
| 1516 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); | 1516 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); |
| 1517 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); | 1517 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); |
| 1518 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); | 1518 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); |
| 1519 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1519 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1520 | 1520 |
| 1521 EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedConten
tRect(parent, IntRect(0, 0, 300, 300))); | 1521 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRec
t(parent, IntRect(0, 0, 300, 300))); |
| 1522 EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContent
Rect(parent, IntRect(0, 0, 300, 100))); | 1522 EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 100))); |
| 1523 EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedConte
ntRect(parent, IntRect(0, 100, 300, 100))); | 1523 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(0, 100, 300, 100))); |
| 1524 EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedConte
ntRect(parent, IntRect(200, 100, 100, 100))); | 1524 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(200, 100, 100, 100))); |
| 1525 EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedConte
ntRect(parent, IntRect(100, 200, 100, 100))); | 1525 EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRe
ct(parent, IntRect(100, 200, 100, 100))); |
| 1526 } | 1526 } |
| 1527 }; | 1527 }; |
| 1528 | 1528 |
| 1529 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectPartlyOverChild); | 1529 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectPartlyOverChild); |
| 1530 | 1530 |
| 1531 template<class Types, bool opaqueLayers> | 1531 template<class Types, bool opaqueLayers> |
| 1532 class CCOcclusionTrackerTestViewportRectPartlyOverChild : public CCOcclusionTrac
kerTest<Types, opaqueLayers> { | 1532 class CCOcclusionTrackerTestViewportRectPartlyOverChild : public CCOcclusionTrac
kerTest<Types, opaqueLayers> { |
| 1533 protected: | 1533 protected: |
| 1534 void runMyTest() | 1534 void runMyTest() |
| 1535 { | 1535 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1554 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); | 1554 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); |
| 1555 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1555 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1556 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); | 1556 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); |
| 1557 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))); | 1557 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))); |
| 1558 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); | 1558 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); |
| 1559 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); | 1559 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); |
| 1560 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); | 1560 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); |
| 1561 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); | 1561 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); |
| 1562 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1562 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1563 | 1563 |
| 1564 EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedConten
tRect(parent, IntRect(0, 0, 300, 300))); | 1564 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRec
t(parent, IntRect(0, 0, 300, 300))); |
| 1565 EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContent
Rect(parent, IntRect(0, 0, 300, 100))); | 1565 EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 100))); |
| 1566 EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedConte
ntRect(parent, IntRect(0, 100, 300, 100))); | 1566 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(0, 100, 300, 100))); |
| 1567 EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedConte
ntRect(parent, IntRect(200, 100, 100, 100))); | 1567 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(200, 100, 100, 100))); |
| 1568 EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedConte
ntRect(parent, IntRect(100, 200, 100, 100))); | 1568 EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRe
ct(parent, IntRect(100, 200, 100, 100))); |
| 1569 } | 1569 } |
| 1570 }; | 1570 }; |
| 1571 | 1571 |
| 1572 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectPartlyOverChild); | 1572 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectPartlyOverChild); |
| 1573 | 1573 |
| 1574 template<class Types, bool opaqueLayers> | 1574 template<class Types, bool opaqueLayers> |
| 1575 class CCOcclusionTrackerTestLayerClipRectOverNothing : public CCOcclusionTracker
Test<Types, opaqueLayers> { | 1575 class CCOcclusionTrackerTestLayerClipRectOverNothing : public CCOcclusionTracker
Test<Types, opaqueLayers> { |
| 1576 protected: | 1576 protected: |
| 1577 void runMyTest() | 1577 void runMyTest() |
| 1578 { | 1578 { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 this->calcDrawEtc(parent); | 1727 this->calcDrawEtc(parent); |
| 1728 | 1728 |
| 1729 { | 1729 { |
| 1730 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1730 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1731 layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100)); | 1731 layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100)); |
| 1732 | 1732 |
| 1733 this->resetLayerIterator(); | 1733 this->resetLayerIterator(); |
| 1734 this->visitLayer(layer, occlusion); | 1734 this->visitLayer(layer, occlusion); |
| 1735 this->enterLayer(parent, occlusion); | 1735 this->enterLayer(parent, occlusion); |
| 1736 | 1736 |
| 1737 EXPECT_INT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionI
nScreenSpace().bounds()); | 1737 EXPECT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScr
eenSpace().bounds()); |
| 1738 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1738 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1739 | 1739 |
| 1740 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1740 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1741 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)))
; | 1741 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)))
; |
| 1742 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))
); | 1742 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))
); |
| 1743 } | 1743 } |
| 1744 | 1744 |
| 1745 { | 1745 { |
| 1746 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1746 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1747 layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180)); | 1747 layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180)); |
| 1748 | 1748 |
| 1749 this->resetLayerIterator(); | 1749 this->resetLayerIterator(); |
| 1750 this->visitLayer(layer, occlusion); | 1750 this->visitLayer(layer, occlusion); |
| 1751 this->enterLayer(parent, occlusion); | 1751 this->enterLayer(parent, occlusion); |
| 1752 | 1752 |
| 1753 EXPECT_INT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionI
nScreenSpace().bounds()); | 1753 EXPECT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScr
eenSpace().bounds()); |
| 1754 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1754 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1755 | 1755 |
| 1756 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1756 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1757 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))
); | 1757 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))
); |
| 1758 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)))
; | 1758 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)))
; |
| 1759 } | 1759 } |
| 1760 | 1760 |
| 1761 { | 1761 { |
| 1762 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1762 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1763 layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100)); | 1763 layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100)); |
| 1764 | 1764 |
| 1765 this->resetLayerIterator(); | 1765 this->resetLayerIterator(); |
| 1766 this->visitLayer(layer, occlusion); | 1766 this->visitLayer(layer, occlusion); |
| 1767 this->enterLayer(parent, occlusion); | 1767 this->enterLayer(parent, occlusion); |
| 1768 | 1768 |
| 1769 EXPECT_INT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInS
creenSpace().bounds()); | 1769 EXPECT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScree
nSpace().bounds()); |
| 1770 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1770 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1771 | 1771 |
| 1772 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1772 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1773 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))
); | 1773 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))
); |
| 1774 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))
); | 1774 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))
); |
| 1775 } | 1775 } |
| 1776 } | 1776 } |
| 1777 }; | 1777 }; |
| 1778 | 1778 |
| 1779 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty); | 1779 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty); |
| 1780 | 1780 |
| 1781 template<class Types, bool opaqueLayers> | 1781 template<class Types, bool opaqueLayers> |
| 1782 class CCOcclusionTrackerTest3dTransform : public CCOcclusionTrackerTest<Types, o
paqueLayers> { | 1782 class CCOcclusionTrackerTest3dTransform : public CCOcclusionTrackerTest<Types, o
paqueLayers> { |
| 1783 protected: | 1783 protected: |
| 1784 void runMyTest() | 1784 void runMyTest() |
| 1785 { | 1785 { |
| 1786 WebTransformationMatrix transform; | 1786 WebTransformationMatrix transform; |
| 1787 transform.rotate3d(0, 30, 0); | 1787 transform.rotate3d(0, 30, 0); |
| 1788 | 1788 |
| 1789 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1789 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1790 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1790 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1791 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); | 1791 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); |
| 1792 this->calcDrawEtc(parent); | 1792 this->calcDrawEtc(parent); |
| 1793 | 1793 |
| 1794 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1794 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1795 this->enterLayer(layer, occlusion); | 1795 this->enterLayer(layer, occlusion); |
| 1796 | 1796 |
| 1797 // The layer is rotated in 3d but without preserving 3d, so it only gets
resized. | 1797 // The layer is rotated in 3d but without preserving 3d, so it only gets
resized. |
| 1798 EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentR
ect(layer, IntRect(0, 0, 200, 200))); | 1798 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(
layer, IntRect(0, 0, 200, 200))); |
| 1799 } | 1799 } |
| 1800 }; | 1800 }; |
| 1801 | 1801 |
| 1802 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTest3dTransform); | 1802 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTest3dTransform); |
| 1803 | 1803 |
| 1804 template<class Types, bool opaqueLayers> | 1804 template<class Types, bool opaqueLayers> |
| 1805 class CCOcclusionTrackerTestUnsorted3dLayers : public CCOcclusionTrackerTest<Typ
es, opaqueLayers> { | 1805 class CCOcclusionTrackerTestUnsorted3dLayers : public CCOcclusionTrackerTest<Typ
es, opaqueLayers> { |
| 1806 protected: | 1806 protected: |
| 1807 void runMyTest() | 1807 void runMyTest() |
| 1808 { | 1808 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1853 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1854 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1854 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1855 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); | 1855 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); |
| 1856 container->setPreserves3D(true); | 1856 container->setPreserves3D(true); |
| 1857 layer->setPreserves3D(true); | 1857 layer->setPreserves3D(true); |
| 1858 this->calcDrawEtc(parent); | 1858 this->calcDrawEtc(parent); |
| 1859 | 1859 |
| 1860 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1860 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1861 this->enterLayer(layer, occlusion); | 1861 this->enterLayer(layer, occlusion); |
| 1862 | 1862 |
| 1863 EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentR
ect(layer, IntRect(0, 0, 200, 200))); | 1863 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(
layer, IntRect(0, 0, 200, 200))); |
| 1864 } | 1864 } |
| 1865 }; | 1865 }; |
| 1866 | 1866 |
| 1867 // 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. | 1867 // 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. |
| 1868 IMPL_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransform); | 1868 IMPL_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransform); |
| 1869 | 1869 |
| 1870 template<class Types, bool opaqueLayers> | 1870 template<class Types, bool opaqueLayers> |
| 1871 class CCOcclusionTrackerTestPerspectiveTransformBehindCamera : public CCOcclusio
nTrackerTest<Types, opaqueLayers> { | 1871 class CCOcclusionTrackerTestPerspectiveTransformBehindCamera : public CCOcclusio
nTrackerTest<Types, opaqueLayers> { |
| 1872 protected: | 1872 protected: |
| 1873 void runMyTest() | 1873 void runMyTest() |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 parent->setPreserves3D(true); | 1947 parent->setPreserves3D(true); |
| 1948 layer->setPreserves3D(true); | 1948 layer->setPreserves3D(true); |
| 1949 this->calcDrawEtc(parent); | 1949 this->calcDrawEtc(parent); |
| 1950 | 1950 |
| 1951 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1951 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1952 | 1952 |
| 1953 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. | 1953 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. |
| 1954 // Ensure that those pixels don't occlude things outside the clipRect. | 1954 // Ensure that those pixels don't occlude things outside the clipRect. |
| 1955 this->visitLayer(layer, occlusion); | 1955 this->visitLayer(layer, occlusion); |
| 1956 this->enterLayer(parent, occlusion); | 1956 this->enterLayer(parent, occlusion); |
| 1957 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); | 1957 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1958 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1958 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1959 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenS
pace().bounds()); | 1959 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace
().bounds()); |
| 1960 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1960 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1961 } | 1961 } |
| 1962 }; | 1962 }; |
| 1963 | 1963 |
| 1964 // 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. | 1964 // 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. |
| 1965 IMPL_THREAD_TEST(CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect); | 1965 IMPL_THREAD_TEST(CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect); |
| 1966 | 1966 |
| 1967 template<class Types, bool opaqueLayers> | 1967 template<class Types, bool opaqueLayers> |
| 1968 class CCOcclusionTrackerTestAnimationOpacity1OnMainThread : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { | 1968 class CCOcclusionTrackerTestAnimationOpacity1OnMainThread : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { |
| 1969 protected: | 1969 protected: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1983 | 1983 |
| 1984 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 1984 EXPECT_TRUE(layer->drawOpacityIsAnimating()); |
| 1985 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 1985 EXPECT_FALSE(surface->drawOpacityIsAnimating()); |
| 1986 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); | 1986 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); |
| 1987 | 1987 |
| 1988 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1988 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1989 | 1989 |
| 1990 this->visitLayer(topmost, occlusion); | 1990 this->visitLayer(topmost, occlusion); |
| 1991 this->enterLayer(parent2, occlusion); | 1991 this->enterLayer(parent2, occlusion); |
| 1992 // This occlusion will affect all surfaces. | 1992 // This occlusion will affect all surfaces. |
| 1993 EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentR
ect(parent2, IntRect(0, 0, 300, 300))); | 1993 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent2, IntRect(0, 0, 300, 300))); |
| 1994 this->leaveLayer(parent2, occlusion); | 1994 this->leaveLayer(parent2, occlusion); |
| 1995 | 1995 |
| 1996 this->visitLayer(surfaceChild2, occlusion); | 1996 this->visitLayer(surfaceChild2, occlusion); |
| 1997 this->enterLayer(surfaceChild, occlusion); | 1997 this->enterLayer(surfaceChild, occlusion); |
| 1998 EXPECT_INT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedConten
tRect(surfaceChild, IntRect(0, 0, 300, 300))); | 1998 EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRec
t(surfaceChild, IntRect(0, 0, 300, 300))); |
| 1999 this->leaveLayer(surfaceChild, occlusion); | 1999 this->leaveLayer(surfaceChild, occlusion); |
| 2000 this->enterLayer(surface, occlusion); | 2000 this->enterLayer(surface, occlusion); |
| 2001 EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContent
Rect(surface, IntRect(0, 0, 300, 300))); | 2001 EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect
(surface, IntRect(0, 0, 300, 300))); |
| 2002 this->leaveLayer(surface, occlusion); | 2002 this->leaveLayer(surface, occlusion); |
| 2003 | 2003 |
| 2004 this->enterContributingSurface(surface, occlusion); | 2004 this->enterContributingSurface(surface, occlusion); |
| 2005 // Occlusion within the surface is lost when leaving the animating surfa
ce. | 2005 // Occlusion within the surface is lost when leaving the animating surfa
ce. |
| 2006 EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); | 2006 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); |
| 2007 this->leaveContributingSurface(surface, occlusion); | 2007 this->leaveContributingSurface(surface, occlusion); |
| 2008 | 2008 |
| 2009 this->visitLayer(layer, occlusion); | 2009 this->visitLayer(layer, occlusion); |
| 2010 this->enterLayer(parent, occlusion); | 2010 this->enterLayer(parent, occlusion); |
| 2011 | 2011 |
| 2012 // Occlusion is not added for the animating |layer|. | 2012 // Occlusion is not added for the animating |layer|. |
| 2013 EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); | 2013 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); |
| 2014 } | 2014 } |
| 2015 }; | 2015 }; |
| 2016 | 2016 |
| 2017 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity1OnMainThread); | 2017 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity1OnMainThread); |
| 2018 | 2018 |
| 2019 template<class Types, bool opaqueLayers> | 2019 template<class Types, bool opaqueLayers> |
| 2020 class CCOcclusionTrackerTestAnimationOpacity0OnMainThread : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { | 2020 class CCOcclusionTrackerTestAnimationOpacity0OnMainThread : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { |
| 2021 protected: | 2021 protected: |
| 2022 void runMyTest() | 2022 void runMyTest() |
| 2023 { | 2023 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2035 | 2035 |
| 2036 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 2036 EXPECT_TRUE(layer->drawOpacityIsAnimating()); |
| 2037 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 2037 EXPECT_FALSE(surface->drawOpacityIsAnimating()); |
| 2038 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); | 2038 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); |
| 2039 | 2039 |
| 2040 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2040 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2041 | 2041 |
| 2042 this->visitLayer(topmost, occlusion); | 2042 this->visitLayer(topmost, occlusion); |
| 2043 this->enterLayer(parent2, occlusion); | 2043 this->enterLayer(parent2, occlusion); |
| 2044 // This occlusion will affect all surfaces. | 2044 // This occlusion will affect all surfaces. |
| 2045 EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); | 2045 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); |
| 2046 this->leaveLayer(parent2, occlusion); | 2046 this->leaveLayer(parent2, occlusion); |
| 2047 | 2047 |
| 2048 this->visitLayer(surfaceChild2, occlusion); | 2048 this->visitLayer(surfaceChild2, occlusion); |
| 2049 this->enterLayer(surfaceChild, occlusion); | 2049 this->enterLayer(surfaceChild, occlusion); |
| 2050 EXPECT_INT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedConten
tRect(surfaceChild, IntRect(0, 0, 300, 300))); | 2050 EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRec
t(surfaceChild, IntRect(0, 0, 300, 300))); |
| 2051 this->leaveLayer(surfaceChild, occlusion); | 2051 this->leaveLayer(surfaceChild, occlusion); |
| 2052 this->enterLayer(surface, occlusion); | 2052 this->enterLayer(surface, occlusion); |
| 2053 EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContent
Rect(surface, IntRect(0, 0, 300, 300))); | 2053 EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect
(surface, IntRect(0, 0, 300, 300))); |
| 2054 this->leaveLayer(surface, occlusion); | 2054 this->leaveLayer(surface, occlusion); |
| 2055 | 2055 |
| 2056 this->enterContributingSurface(surface, occlusion); | 2056 this->enterContributingSurface(surface, occlusion); |
| 2057 // Occlusion within the surface is lost when leaving the animating surfa
ce. | 2057 // Occlusion within the surface is lost when leaving the animating surfa
ce. |
| 2058 EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); | 2058 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); |
| 2059 this->leaveContributingSurface(surface, occlusion); | 2059 this->leaveContributingSurface(surface, occlusion); |
| 2060 | 2060 |
| 2061 this->visitLayer(layer, occlusion); | 2061 this->visitLayer(layer, occlusion); |
| 2062 this->enterLayer(parent, occlusion); | 2062 this->enterLayer(parent, occlusion); |
| 2063 | 2063 |
| 2064 // Occlusion is not added for the animating |layer|. | 2064 // Occlusion is not added for the animating |layer|. |
| 2065 EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); | 2065 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); |
| 2066 } | 2066 } |
| 2067 }; | 2067 }; |
| 2068 | 2068 |
| 2069 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity0OnMainThread); | 2069 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity0OnMainThread); |
| 2070 | 2070 |
| 2071 template<class Types, bool opaqueLayers> | 2071 template<class Types, bool opaqueLayers> |
| 2072 class CCOcclusionTrackerTestAnimationTranslateOnMainThread : public CCOcclusionT
rackerTest<Types, opaqueLayers> { | 2072 class CCOcclusionTrackerTestAnimationTranslateOnMainThread : public CCOcclusionT
rackerTest<Types, opaqueLayers> { |
| 2073 protected: | 2073 protected: |
| 2074 void runMyTest() | 2074 void runMyTest() |
| 2075 { | 2075 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2093 EXPECT_FALSE(surface->drawTransformIsAnimating()); | 2093 EXPECT_FALSE(surface->drawTransformIsAnimating()); |
| 2094 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating()); | 2094 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating()); |
| 2095 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); | 2095 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); |
| 2096 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); | 2096 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); |
| 2097 | 2097 |
| 2098 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2098 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2099 | 2099 |
| 2100 this->visitLayer(surface2, occlusion); | 2100 this->visitLayer(surface2, occlusion); |
| 2101 this->enterContributingSurface(surface2, occlusion); | 2101 this->enterContributingSurface(surface2, occlusion); |
| 2102 | 2102 |
| 2103 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSp
ace().bounds()); | 2103 EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2104 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2104 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2105 | 2105 |
| 2106 this->leaveContributingSurface(surface2, occlusion); | 2106 this->leaveContributingSurface(surface2, occlusion); |
| 2107 this->enterLayer(surfaceChild2, occlusion); | 2107 this->enterLayer(surfaceChild2, occlusion); |
| 2108 | 2108 |
| 2109 // surfaceChild2 is moving in screen space but not relative to its targe
t, so occlusion should happen in its target space only. | 2109 // surfaceChild2 is moving in screen space but not relative to its targe
t, so occlusion should happen in its target space only. |
| 2110 // It also means that things occluding in screen space (e.g. surface2) c
annot occlude this layer. | 2110 // It also means that things occluding in screen space (e.g. surface2) c
annot occlude this layer. |
| 2111 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedContentR
ect(surfaceChild2, IntRect(0, 0, 100, 300))); | 2111 EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(
surfaceChild2, IntRect(0, 0, 100, 300))); |
| 2112 EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); | 2112 EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); |
| 2113 | 2113 |
| 2114 this->leaveLayer(surfaceChild2, occlusion); | 2114 this->leaveLayer(surfaceChild2, occlusion); |
| 2115 this->enterLayer(surfaceChild, occlusion); | 2115 this->enterLayer(surfaceChild, occlusion); |
| 2116 EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 100, 300))); | 2116 EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 100, 300))); |
| 2117 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSp
ace().bounds()); | 2117 EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2118 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2118 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2119 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetS
urface().bounds()); | 2119 EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2120 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2120 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2121 EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedConten
tRect(surface, IntRect(0, 0, 300, 300))); | 2121 EXPECT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRec
t(surface, IntRect(0, 0, 300, 300))); |
| 2122 | 2122 |
| 2123 // The surfaceChild is occluded by the surfaceChild2, but is moving rela
tive its target and the screen, so it | 2123 // The surfaceChild is occluded by the surfaceChild2, but is moving rela
tive its target and the screen, so it |
| 2124 // can't be occluded. | 2124 // can't be occluded. |
| 2125 EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedContentR
ect(surfaceChild, IntRect(0, 0, 200, 300))); | 2125 EXPECT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(
surfaceChild, IntRect(0, 0, 200, 300))); |
| 2126 EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); | 2126 EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); |
| 2127 | 2127 |
| 2128 this->leaveLayer(surfaceChild, occlusion); | 2128 this->leaveLayer(surfaceChild, occlusion); |
| 2129 this->enterLayer(surface, occlusion); | 2129 this->enterLayer(surface, occlusion); |
| 2130 // The surfaceChild is moving in screen space but not relative to its ta
rget, so occlusion should happen in its target space only. | 2130 // The surfaceChild is moving in screen space but not relative to its ta
rget, so occlusion should happen in its target space only. |
| 2131 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSp
ace().bounds()); | 2131 EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2132 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2132 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2133 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetS
urface().bounds()); | 2133 EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2134 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2134 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2135 EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedConten
tRect(surface, IntRect(0, 0, 300, 300))); | 2135 EXPECT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRec
t(surface, IntRect(0, 0, 300, 300))); |
| 2136 | 2136 |
| 2137 this->leaveLayer(surface, occlusion); | 2137 this->leaveLayer(surface, occlusion); |
| 2138 // 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. | 2138 // 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. |
| 2139 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSp
ace().bounds()); | 2139 EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2140 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2140 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2141 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetS
urface().bounds()); | 2141 EXPECT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2142 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2142 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2143 EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(
surface, IntRect(0, 0, 300, 300))); | 2143 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surf
ace, IntRect(0, 0, 300, 300))); |
| 2144 | 2144 |
| 2145 this->enterContributingSurface(surface, occlusion); | 2145 this->enterContributingSurface(surface, occlusion); |
| 2146 // The contributing |surface| is animating so it can't be occluded. | 2146 // The contributing |surface| is animating so it can't be occluded. |
| 2147 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); | 2147 EXPECT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); |
| 2148 this->leaveContributingSurface(surface, occlusion); | 2148 this->leaveContributingSurface(surface, occlusion); |
| 2149 | 2149 |
| 2150 this->enterLayer(layer, occlusion); | 2150 this->enterLayer(layer, occlusion); |
| 2151 // The |surface| is moving in the screen and in its target, so all occlu
sion within the surface is lost when leaving it. | 2151 // The |surface| is moving in the screen and in its target, so all occlu
sion within the surface is lost when leaving it. |
| 2152 EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContent
Rect(parent, IntRect(0, 0, 300, 300))); | 2152 EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 300))); |
| 2153 this->leaveLayer(layer, occlusion); | 2153 this->leaveLayer(layer, occlusion); |
| 2154 | 2154 |
| 2155 this->enterLayer(parent, occlusion); | 2155 this->enterLayer(parent, occlusion); |
| 2156 // The |layer| is animating in the screen and in its target, so no occlu
sion is added. | 2156 // The |layer| is animating in the screen and in its target, so no occlu
sion is added. |
| 2157 EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContent
Rect(parent, IntRect(0, 0, 300, 300))); | 2157 EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 300))); |
| 2158 } | 2158 } |
| 2159 }; | 2159 }; |
| 2160 | 2160 |
| 2161 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationTranslateOnMainThread); | 2161 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationTranslateOnMainThread); |
| 2162 | 2162 |
| 2163 template<class Types, bool opaqueLayers> | 2163 template<class Types, bool opaqueLayers> |
| 2164 class CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public CCOcclus
ionTrackerTest<Types, opaqueLayers> { | 2164 class CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public CCOcclus
ionTrackerTest<Types, opaqueLayers> { |
| 2165 protected: | 2165 protected: |
| 2166 void runMyTest() | 2166 void runMyTest() |
| 2167 { | 2167 { |
| 2168 WebTransformationMatrix surfaceTransform; | 2168 WebTransformationMatrix surfaceTransform; |
| 2169 surfaceTransform.translate(300, 300); | 2169 surfaceTransform.translate(300, 300); |
| 2170 surfaceTransform.scale(2); | 2170 surfaceTransform.scale(2); |
| 2171 surfaceTransform.translate(-150, -150); | 2171 surfaceTransform.translate(-150, -150); |
| 2172 | 2172 |
| 2173 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(500, 500)); | 2173 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(500, 500)); |
| 2174 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false); | 2174 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false); |
| 2175 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false); | 2175 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false); |
| 2176 surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); | 2176 surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); |
| 2177 surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); | 2177 surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); |
| 2178 this->calcDrawEtc(parent); | 2178 this->calcDrawEtc(parent); |
| 2179 | 2179 |
| 2180 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2180 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2181 | 2181 |
| 2182 this->visitLayer(surface2, occlusion); | 2182 this->visitLayer(surface2, occlusion); |
| 2183 this->visitContributingSurface(surface2, occlusion); | 2183 this->visitContributingSurface(surface2, occlusion); |
| 2184 | 2184 |
| 2185 EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScree
nSpace().bounds()); | 2185 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpa
ce().bounds()); |
| 2186 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2186 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2187 EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTarge
tSurface().bounds()); | 2187 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSur
face().bounds()); |
| 2188 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2188 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2189 | 2189 |
| 2190 // Clear any stored occlusion. | 2190 // Clear any stored occlusion. |
| 2191 occlusion.setOcclusionInScreenSpace(Region()); | 2191 occlusion.setOcclusionInScreenSpace(Region()); |
| 2192 occlusion.setOcclusionInTargetSurface(Region()); | 2192 occlusion.setOcclusionInTargetSurface(Region()); |
| 2193 | 2193 |
| 2194 this->visitLayer(surface, occlusion); | 2194 this->visitLayer(surface, occlusion); |
| 2195 this->visitContributingSurface(surface, occlusion); | 2195 this->visitContributingSurface(surface, occlusion); |
| 2196 | 2196 |
| 2197 EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenS
pace().bounds()); | 2197 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace
().bounds()); |
| 2198 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2198 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2199 EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetS
urface().bounds()); | 2199 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2200 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2200 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2201 } | 2201 } |
| 2202 }; | 2202 }; |
| 2203 | 2203 |
| 2204 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToPare
nt); | 2204 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToPare
nt); |
| 2205 | 2205 |
| 2206 template<class Types, bool opaqueLayers> | 2206 template<class Types, bool opaqueLayers> |
| 2207 class CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public CCOc
clusionTrackerTest<Types, opaqueLayers> { | 2207 class CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public CCOc
clusionTrackerTest<Types, opaqueLayers> { |
| 2208 protected: | 2208 protected: |
| 2209 void runMyTest() | 2209 void runMyTest() |
| 2210 { | 2210 { |
| 2211 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 2211 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 2212 parent->setMasksToBounds(true); | 2212 parent->setMasksToBounds(true); |
| 2213 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); | 2213 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); |
| 2214 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); | 2214 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); |
| 2215 this->calcDrawEtc(parent); | 2215 this->calcDrawEtc(parent); |
| 2216 | 2216 |
| 2217 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2217 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2218 | 2218 |
| 2219 this->visitLayer(surface, occlusion); | 2219 this->visitLayer(surface, occlusion); |
| 2220 this->visitContributingSurface(surface, occlusion); | 2220 this->visitContributingSurface(surface, occlusion); |
| 2221 | 2221 |
| 2222 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenS
pace().bounds()); | 2222 EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace
().bounds()); |
| 2223 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2223 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2224 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetS
urface().bounds()); | 2224 EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2225 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2225 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2226 } | 2226 } |
| 2227 }; | 2227 }; |
| 2228 | 2228 |
| 2229 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithCl
ipping); | 2229 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithCl
ipping); |
| 2230 | 2230 |
| 2231 template<class Types, bool opaqueLayers> | 2231 template<class Types, bool opaqueLayers> |
| 2232 class CCOcclusionTrackerTestReplicaOccluded : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { | 2232 class CCOcclusionTrackerTestReplicaOccluded : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { |
| 2233 protected: | 2233 protected: |
| 2234 void runMyTest() | 2234 void runMyTest() |
| 2235 { | 2235 { |
| 2236 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2236 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2237 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2237 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2238 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); | 2238 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); |
| 2239 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true); | 2239 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true); |
| 2240 this->calcDrawEtc(parent); | 2240 this->calcDrawEtc(parent); |
| 2241 | 2241 |
| 2242 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2242 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2243 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2243 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2244 | 2244 |
| 2245 // |topmost| occludes the replica, but not the surface itself. | 2245 // |topmost| occludes the replica, but not the surface itself. |
| 2246 this->visitLayer(topmost, occlusion); | 2246 this->visitLayer(topmost, occlusion); |
| 2247 | 2247 |
| 2248 EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScree
nSpace().bounds()); | 2248 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpa
ce().bounds()); |
| 2249 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2249 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2250 EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTarge
tSurface().bounds()); | 2250 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
| 2251 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2251 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2252 | 2252 |
| 2253 this->visitLayer(surface, occlusion); | 2253 this->visitLayer(surface, occlusion); |
| 2254 | 2254 |
| 2255 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenS
pace().bounds()); | 2255 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace
().bounds()); |
| 2256 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2256 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2257 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); | 2257 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2258 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2258 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2259 | 2259 |
| 2260 this->enterContributingSurface(surface, occlusion); | 2260 this->enterContributingSurface(surface, occlusion); |
| 2261 | 2261 |
| 2262 // Surface is not occluded so it shouldn't think it is. | 2262 // Surface is not occluded so it shouldn't think it is. |
| 2263 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2263 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2264 } | 2264 } |
| 2265 }; | 2265 }; |
| 2266 | 2266 |
| 2267 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaOccluded); | 2267 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaOccluded); |
| 2268 | 2268 |
| 2269 template<class Types, bool opaqueLayers> | 2269 template<class Types, bool opaqueLayers> |
| 2270 class CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded : public CCOcclusionTra
ckerTest<Types, opaqueLayers> { | 2270 class CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded : public CCOcclusionTra
ckerTest<Types, opaqueLayers> { |
| 2271 protected: | 2271 protected: |
| 2272 void runMyTest() | 2272 void runMyTest() |
| 2273 { | 2273 { |
| 2274 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2274 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2275 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2275 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2276 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); | 2276 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); |
| 2277 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true); | 2277 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true); |
| 2278 this->calcDrawEtc(parent); | 2278 this->calcDrawEtc(parent); |
| 2279 | 2279 |
| 2280 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2280 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2281 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2281 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2282 | 2282 |
| 2283 // |topmost| occludes the surface, but not the entire surface's replica. | 2283 // |topmost| occludes the surface, but not the entire surface's replica. |
| 2284 this->visitLayer(topmost, occlusion); | 2284 this->visitLayer(topmost, occlusion); |
| 2285 | 2285 |
| 2286 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenS
pace().bounds()); | 2286 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace
().bounds()); |
| 2287 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2287 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2288 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetS
urface().bounds()); | 2288 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2289 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2289 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2290 | 2290 |
| 2291 this->visitLayer(surface, occlusion); | 2291 this->visitLayer(surface, occlusion); |
| 2292 | 2292 |
| 2293 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenS
pace().bounds()); | 2293 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace
().bounds()); |
| 2294 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2294 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2295 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); | 2295 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2296 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2296 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2297 | 2297 |
| 2298 this->enterContributingSurface(surface, occlusion); | 2298 this->enterContributingSurface(surface, occlusion); |
| 2299 | 2299 |
| 2300 // Surface is occluded, but only the top 10px of the replica. | 2300 // Surface is occluded, but only the top 10px of the replica. |
| 2301 EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2301 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurf
aceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2302 EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); | 2302 EXPECT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributing
SurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); |
| 2303 } | 2303 } |
| 2304 }; | 2304 }; |
| 2305 | 2305 |
| 2306 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded); | 2306 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded); |
| 2307 | 2307 |
| 2308 template<class Types, bool opaqueLayers> | 2308 template<class Types, bool opaqueLayers> |
| 2309 class CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public CCOccl
usionTrackerTest<Types, opaqueLayers> { | 2309 class CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public CCOccl
usionTrackerTest<Types, opaqueLayers> { |
| 2310 protected: | 2310 protected: |
| 2311 void runMyTest() | 2311 void runMyTest() |
| 2312 { | 2312 { |
| 2313 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2313 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2314 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2314 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2315 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); | 2315 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); |
| 2316 typename Types::LayerType* overSurface = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true); | 2316 typename Types::LayerType* overSurface = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true); |
| 2317 typename Types::LayerType* overReplica = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true); | 2317 typename Types::LayerType* overReplica = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true); |
| 2318 this->calcDrawEtc(parent); | 2318 this->calcDrawEtc(parent); |
| 2319 | 2319 |
| 2320 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2320 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2321 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2321 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2322 | 2322 |
| 2323 // These occlude the surface and replica differently, so we can test eac
h one. | 2323 // These occlude the surface and replica differently, so we can test eac
h one. |
| 2324 this->visitLayer(overReplica, occlusion); | 2324 this->visitLayer(overReplica, occlusion); |
| 2325 this->visitLayer(overSurface, occlusion); | 2325 this->visitLayer(overSurface, occlusion); |
| 2326 | 2326 |
| 2327 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSp
ace().bounds()); | 2327 EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2328 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2328 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2329 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSu
rface().bounds()); | 2329 EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurfac
e().bounds()); |
| 2330 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2330 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2331 | 2331 |
| 2332 this->visitLayer(surface, occlusion); | 2332 this->visitLayer(surface, occlusion); |
| 2333 | 2333 |
| 2334 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenS
pace().bounds()); | 2334 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace
().bounds()); |
| 2335 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2335 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2336 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); | 2336 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2337 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2337 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2338 | 2338 |
| 2339 this->enterContributingSurface(surface, occlusion); | 2339 this->enterContributingSurface(surface, occlusion); |
| 2340 | 2340 |
| 2341 // Surface and replica are occluded different amounts. | 2341 // Surface and replica are occluded different amounts. |
| 2342 EXPECT_INT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2342 EXPECT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2343 EXPECT_INT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); | 2343 EXPECT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); |
| 2344 } | 2344 } |
| 2345 }; | 2345 }; |
| 2346 | 2346 |
| 2347 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceAndReplicaOccludedDiffe
rently); | 2347 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceAndReplicaOccludedDiffe
rently); |
| 2348 | 2348 |
| 2349 template<class Types, bool opaqueLayers> | 2349 template<class Types, bool opaqueLayers> |
| 2350 class CCOcclusionTrackerTestSurfaceChildOfSurface : public CCOcclusionTrackerTes
t<Types, opaqueLayers> { | 2350 class CCOcclusionTrackerTestSurfaceChildOfSurface : public CCOcclusionTrackerTes
t<Types, opaqueLayers> { |
| 2351 protected: | 2351 protected: |
| 2352 void runMyTest() | 2352 void runMyTest() |
| 2353 { | 2353 { |
| 2354 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. | 2354 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. |
| 2355 | 2355 |
| 2356 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2356 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2357 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2357 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2358 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true); | 2358 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true); |
| 2359 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); | 2359 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); |
| 2360 this->calcDrawEtc(parent); | 2360 this->calcDrawEtc(parent); |
| 2361 | 2361 |
| 2362 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(-100, -100, 1000, 1000)); | 2362 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(-100, -100, 1000, 1000)); |
| 2363 | 2363 |
| 2364 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2364 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
| 2365 this->visitLayer(topmost, occlusion); | 2365 this->visitLayer(topmost, occlusion); |
| 2366 | 2366 |
| 2367 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSp
ace().bounds()); | 2367 EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2368 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2368 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2369 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSu
rface().bounds()); | 2369 EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurfac
e().bounds()); |
| 2370 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2370 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2371 | 2371 |
| 2372 this->visitLayer(surfaceChild, occlusion); | 2372 this->visitLayer(surfaceChild, occlusion); |
| 2373 | 2373 |
| 2374 // surfaceChild increases the occlusion in the screen by a narrow sliver
. | 2374 // surfaceChild increases the occlusion in the screen by a narrow sliver
. |
| 2375 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSp
ace().bounds()); | 2375 EXPECT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2376 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2376 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2377 // In its own surface, surfaceChild is at 0,0 as is its occlusion. | 2377 // In its own surface, surfaceChild is at 0,0 as is its occlusion. |
| 2378 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSu
rface().bounds()); | 2378 EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurfac
e().bounds()); |
| 2379 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2379 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2380 | 2380 |
| 2381 // The root layer always has a clipRect. So the parent of |surface| has
a clipRect. However, the owning layer for |surface| does not | 2381 // The root layer always has a clipRect. So the parent of |surface| has
a clipRect. However, the owning layer for |surface| does not |
| 2382 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa
rent of |surfaceChild| exercises different code paths | 2382 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa
rent of |surfaceChild| exercises different code paths |
| 2383 // as its parent does not have a clipRect. | 2383 // as its parent does not have a clipRect. |
| 2384 | 2384 |
| 2385 this->enterContributingSurface(surfaceChild, occlusion); | 2385 this->enterContributingSurface(surfaceChild, occlusion); |
| 2386 // The surfaceChild's parent does not have a clipRect as it owns a rende
r surface. Make sure the unoccluded rect | 2386 // The surfaceChild's parent does not have a clipRect as it owns a rende
r surface. Make sure the unoccluded rect |
| 2387 // does not get clipped away inappropriately. | 2387 // does not get clipped away inappropriately. |
| 2388 EXPECT_INT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContribu
tingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 50))); | 2388 EXPECT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributing
SurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 50))); |
| 2389 this->leaveContributingSurface(surfaceChild, occlusion); | 2389 this->leaveContributingSurface(surfaceChild, occlusion); |
| 2390 | 2390 |
| 2391 // When the surfaceChild's occlusion is transformed up to its parent, ma
ke sure it is not clipped away inappropriately also. | 2391 // When the surfaceChild's occlusion is transformed up to its parent, ma
ke sure it is not clipped away inappropriately also. |
| 2392 this->enterLayer(surface, occlusion); | 2392 this->enterLayer(surface, occlusion); |
| 2393 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSp
ace().bounds()); | 2393 EXPECT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2394 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2394 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2395 EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetS
urface().bounds()); | 2395 EXPECT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2396 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2396 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2397 this->leaveLayer(surface, occlusion); | 2397 this->leaveLayer(surface, occlusion); |
| 2398 | 2398 |
| 2399 this->enterContributingSurface(surface, occlusion); | 2399 this->enterContributingSurface(surface, occlusion); |
| 2400 // The surface's parent does have a clipRect as it is the root layer. | 2400 // The surface's parent does have a clipRect as it is the root layer. |
| 2401 EXPECT_INT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2401 EXPECT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2402 } | 2402 } |
| 2403 }; | 2403 }; |
| 2404 | 2404 |
| 2405 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface); | 2405 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface); |
| 2406 | 2406 |
| 2407 template<class Types, bool opaqueLayers> | 2407 template<class Types, bool opaqueLayers> |
| 2408 class CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public CCOcclusi
onTrackerTest<Types, opaqueLayers> { | 2408 class CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public CCOcclusi
onTrackerTest<Types, opaqueLayers> { |
| 2409 protected: | 2409 protected: |
| 2410 void runMyTest() | 2410 void runMyTest() |
| 2411 { | 2411 { |
| 2412 // This test verifies that the top-most surface is considered occluded o
utside of its target's clipRect and outside the viewport rect. | 2412 // This test verifies that the top-most surface is considered occluded o
utside of its target's clipRect and outside the viewport rect. |
| 2413 | 2413 |
| 2414 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2414 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2415 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); | 2415 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); |
| 2416 this->calcDrawEtc(parent); | 2416 this->calcDrawEtc(parent); |
| 2417 | 2417 |
| 2418 { | 2418 { |
| 2419 // Make a viewport rect that is larger than the root layer. | 2419 // Make a viewport rect that is larger than the root layer. |
| 2420 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2420 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2421 | 2421 |
| 2422 this->visitLayer(surface, occlusion); | 2422 this->visitLayer(surface, occlusion); |
| 2423 | 2423 |
| 2424 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. | 2424 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. |
| 2425 this->enterContributingSurface(surface, occlusion); | 2425 this->enterContributingSurface(surface, occlusion); |
| 2426 // Make sure the parent's clipRect clips the unoccluded region of th
e child surface. | 2426 // Make sure the parent's clipRect clips the unoccluded region of th
e child surface. |
| 2427 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedCont
ributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); | 2427 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); |
| 2428 } | 2428 } |
| 2429 this->resetLayerIterator(); | 2429 this->resetLayerIterator(); |
| 2430 { | 2430 { |
| 2431 // Make a viewport rect that is smaller than the root layer. | 2431 // Make a viewport rect that is smaller than the root layer. |
| 2432 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); | 2432 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); |
| 2433 | 2433 |
| 2434 this->visitLayer(surface, occlusion); | 2434 this->visitLayer(surface, occlusion); |
| 2435 | 2435 |
| 2436 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. | 2436 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. |
| 2437 this->enterContributingSurface(surface, occlusion); | 2437 this->enterContributingSurface(surface, occlusion); |
| 2438 // Make sure the viewport rect clips the unoccluded region of the ch
ild surface. | 2438 // Make sure the viewport rect clips the unoccluded region of the ch
ild surface. |
| 2439 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedCont
ributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); | 2439 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); |
| 2440 } | 2440 } |
| 2441 } | 2441 } |
| 2442 }; | 2442 }; |
| 2443 | 2443 |
| 2444 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewp
ort); | 2444 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewp
ort); |
| 2445 | 2445 |
| 2446 template<class Types, bool opaqueLayers> | 2446 template<class Types, bool opaqueLayers> |
| 2447 class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { | 2447 class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { |
| 2448 protected: | 2448 protected: |
| 2449 void runMyTest() | 2449 void runMyTest() |
| 2450 { | 2450 { |
| 2451 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. | 2451 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. |
| 2452 | 2452 |
| 2453 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(80, 200)); | 2453 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(80, 200)); |
| 2454 parent->setMasksToBounds(true); | 2454 parent->setMasksToBounds(true); |
| 2455 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2455 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2456 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false); | 2456 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false); |
| 2457 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); | 2457 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); |
| 2458 this->calcDrawEtc(parent); | 2458 this->calcDrawEtc(parent); |
| 2459 | 2459 |
| 2460 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2460 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2461 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2461 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2462 | 2462 |
| 2463 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2463 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
| 2464 this->visitLayer(topmost, occlusion); | 2464 this->visitLayer(topmost, occlusion); |
| 2465 | 2465 |
| 2466 EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 2466 EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace()
.bounds()); |
| 2467 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2467 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2468 EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSur
face().bounds()); | 2468 EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface
().bounds()); |
| 2469 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2469 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2470 | 2470 |
| 2471 // surfaceChild is not opaque and does not occlude, so we have a non-emp
ty unoccluded area on surface. | 2471 // surfaceChild is not opaque and does not occlude, so we have a non-emp
ty unoccluded area on surface. |
| 2472 this->visitLayer(surfaceChild, occlusion); | 2472 this->visitLayer(surfaceChild, occlusion); |
| 2473 | 2473 |
| 2474 EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 2474 EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace()
.bounds()); |
| 2475 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2475 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2476 EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2476 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface()
.bounds()); |
| 2477 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2477 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2478 | 2478 |
| 2479 // The root layer always has a clipRect. So the parent of |surface| has
a clipRect. However, the owning layer for |surface| does not | 2479 // The root layer always has a clipRect. So the parent of |surface| has
a clipRect. However, the owning layer for |surface| does not |
| 2480 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa
rent of |surfaceChild| exercises different code paths | 2480 // mask to bounds, so it doesn't have a clipRect of its own. Thus the pa
rent of |surfaceChild| exercises different code paths |
| 2481 // as its parent does not have a clipRect. | 2481 // as its parent does not have a clipRect. |
| 2482 | 2482 |
| 2483 this->enterContributingSurface(surfaceChild, occlusion); | 2483 this->enterContributingSurface(surfaceChild, occlusion); |
| 2484 // The surfaceChild's parent does not have a clipRect as it owns a rende
r surface. | 2484 // The surfaceChild's parent does not have a clipRect as it owns a rende
r surface. |
| 2485 EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContribut
ingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100))); | 2485 EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingS
urfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100))); |
| 2486 this->leaveContributingSurface(surfaceChild, occlusion); | 2486 this->leaveContributingSurface(surfaceChild, occlusion); |
| 2487 | 2487 |
| 2488 this->visitLayer(surface, occlusion); | 2488 this->visitLayer(surface, occlusion); |
| 2489 this->enterContributingSurface(surface, occlusion); | 2489 this->enterContributingSurface(surface, occlusion); |
| 2490 // The surface's parent does have a clipRect as it is the root layer. | 2490 // The surface's parent does have a clipRect as it is the root layer. |
| 2491 EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContribut
ingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2491 EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingS
urfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2492 } | 2492 } |
| 2493 }; | 2493 }; |
| 2494 | 2494 |
| 2495 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfClippingSurface)
; | 2495 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfClippingSurface)
; |
| 2496 | 2496 |
| 2497 template<class Types, bool opaqueLayers> | 2497 template<class Types, bool opaqueLayers> |
| 2498 class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public
CCOcclusionTrackerTest<Types, opaqueLayers> { | 2498 class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public
CCOcclusionTrackerTest<Types, opaqueLayers> { |
| 2499 protected: | 2499 protected: |
| 2500 void runMyTest() | 2500 void runMyTest() |
| 2501 { | 2501 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2529 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2529 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2530 | 2530 |
| 2531 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2531 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
| 2532 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. | 2532 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. |
| 2533 this->visitLayer(occludingLayer5, occlusion); | 2533 this->visitLayer(occludingLayer5, occlusion); |
| 2534 this->visitLayer(occludingLayer4, occlusion); | 2534 this->visitLayer(occludingLayer4, occlusion); |
| 2535 this->visitLayer(occludingLayer3, occlusion); | 2535 this->visitLayer(occludingLayer3, occlusion); |
| 2536 this->visitLayer(occludingLayer2, occlusion); | 2536 this->visitLayer(occludingLayer2, occlusion); |
| 2537 this->visitLayer(occludingLayer1, occlusion); | 2537 this->visitLayer(occludingLayer1, occlusion); |
| 2538 | 2538 |
| 2539 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenS
pace().bounds()); | 2539 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2540 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2540 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2541 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetS
urface().bounds()); | 2541 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2542 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); | 2542 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2543 | 2543 |
| 2544 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. | 2544 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. |
| 2545 this->enterLayer(filteredSurface, occlusion); | 2545 this->enterLayer(filteredSurface, occlusion); |
| 2546 EXPECT_INT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRe
ct(filteredSurface, IntRect(1, 0, 100, 100))); | 2546 EXPECT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(f
ilteredSurface, IntRect(1, 0, 100, 100))); |
| 2547 EXPECT_INT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRe
ct(filteredSurface, IntRect(0, 1, 100, 100))); | 2547 EXPECT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(f
ilteredSurface, IntRect(0, 1, 100, 100))); |
| 2548 EXPECT_INT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRe
ct(filteredSurface, IntRect(-1, 0, 100, 100))); | 2548 EXPECT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(f
ilteredSurface, IntRect(-1, 0, 100, 100))); |
| 2549 EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRe
ct(filteredSurface, IntRect(0, -1, 100, 100))); | 2549 EXPECT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(f
ilteredSurface, IntRect(0, -1, 100, 100))); |
| 2550 | 2550 |
| 2551 EXPECT_INT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedCon
tentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); | 2551 EXPECT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContent
Rect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); |
| 2552 EXPECT_INT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedCon
tentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); | 2552 EXPECT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContent
Rect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); |
| 2553 EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedCon
tentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); | 2553 EXPECT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContent
Rect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); |
| 2554 EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedCon
tentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); | 2554 EXPECT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContent
Rect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); |
| 2555 this->leaveLayer(filteredSurface, occlusion); | 2555 this->leaveLayer(filteredSurface, occlusion); |
| 2556 | 2556 |
| 2557 // The filtered layer/replica does not occlude. | 2557 // The filtered layer/replica does not occlude. |
| 2558 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenS
pace().bounds()); | 2558 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2559 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2559 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2560 EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2560 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface()
.bounds()); |
| 2561 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2561 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2562 | 2562 |
| 2563 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels | 2563 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels |
| 2564 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. | 2564 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. |
| 2565 this->visitContributingSurface(filteredSurface, occlusion); | 2565 this->visitContributingSurface(filteredSurface, occlusion); |
| 2566 | 2566 |
| 2567 this->enterLayer(parent, occlusion); | 2567 this->enterLayer(parent, occlusion); |
| 2568 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenS
pace().bounds()); | 2568 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2569 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2569 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2570 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetS
urface().bounds()); | 2570 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2571 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); | 2571 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2572 | 2572 |
| 2573 IntRect outsetRect; | 2573 IntRect outsetRect; |
| 2574 IntRect testRect; | 2574 IntRect testRect; |
| 2575 | 2575 |
| 2576 // Nothing in the blur outsets for the filteredSurface is occluded. | 2576 // Nothing in the blur outsets for the filteredSurface is occluded. |
| 2577 outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft +
outsetRight, 50 + outsetTop + outsetBottom); | 2577 outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft +
outsetRight, 50 + outsetTop + outsetBottom); |
| 2578 testRect = outsetRect; | 2578 testRect = outsetRect; |
| 2579 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2579 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2580 | 2580 |
| 2581 // Stuff outside the blur outsets is still occluded though. | 2581 // Stuff outside the blur outsets is still occluded though. |
| 2582 testRect = outsetRect; | 2582 testRect = outsetRect; |
| 2583 testRect.expand(1, 0); | 2583 testRect.expand(1, 0); |
| 2584 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2584 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2585 testRect = outsetRect; | 2585 testRect = outsetRect; |
| 2586 testRect.expand(0, 1); | 2586 testRect.expand(0, 1); |
| 2587 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2587 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2588 testRect = outsetRect; | 2588 testRect = outsetRect; |
| 2589 testRect.move(-1, 0); | 2589 testRect.move(-1, 0); |
| 2590 testRect.expand(1, 0); | 2590 testRect.expand(1, 0); |
| 2591 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2591 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2592 testRect = outsetRect; | 2592 testRect = outsetRect; |
| 2593 testRect.move(0, -1); | 2593 testRect.move(0, -1); |
| 2594 testRect.expand(0, 1); | 2594 testRect.expand(0, 1); |
| 2595 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2595 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2596 | 2596 |
| 2597 // Nothing in the blur outsets for the filteredSurface's replica is occl
uded. | 2597 // Nothing in the blur outsets for the filteredSurface's replica is occl
uded. |
| 2598 outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft +
outsetRight, 50 + outsetTop + outsetBottom); | 2598 outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft +
outsetRight, 50 + outsetTop + outsetBottom); |
| 2599 testRect = outsetRect; | 2599 testRect = outsetRect; |
| 2600 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2600 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2601 | 2601 |
| 2602 // Stuff outside the blur outsets is still occluded though. | 2602 // Stuff outside the blur outsets is still occluded though. |
| 2603 testRect = outsetRect; | 2603 testRect = outsetRect; |
| 2604 testRect.expand(1, 0); | 2604 testRect.expand(1, 0); |
| 2605 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2605 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2606 testRect = outsetRect; | 2606 testRect = outsetRect; |
| 2607 testRect.expand(0, 1); | 2607 testRect.expand(0, 1); |
| 2608 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2608 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2609 testRect = outsetRect; | 2609 testRect = outsetRect; |
| 2610 testRect.move(-1, 0); | 2610 testRect.move(-1, 0); |
| 2611 testRect.expand(1, 0); | 2611 testRect.expand(1, 0); |
| 2612 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2612 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2613 testRect = outsetRect; | 2613 testRect = outsetRect; |
| 2614 testRect.move(0, -1); | 2614 testRect.move(0, -1); |
| 2615 testRect.expand(0, 1); | 2615 testRect.expand(0, 1); |
| 2616 EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, t
estRect)); | 2616 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2617 } | 2617 } |
| 2618 }; | 2618 }; |
| 2619 | 2619 |
| 2620 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBack
groundFilter); | 2620 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBack
groundFilter); |
| 2621 | 2621 |
| 2622 template<class Types, bool opaqueLayers> | 2622 template<class Types, bool opaqueLayers> |
| 2623 class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CC
OcclusionTrackerTest<Types, opaqueLayers> { | 2623 class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CC
OcclusionTrackerTest<Types, opaqueLayers> { |
| 2624 protected: | 2624 protected: |
| 2625 void runMyTest() | 2625 void runMyTest() |
| 2626 { | 2626 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2644 // Save the distance of influence for the blur effect. | 2644 // Save the distance of influence for the blur effect. |
| 2645 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2645 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2646 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2646 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2647 | 2647 |
| 2648 this->calcDrawEtc(root); | 2648 this->calcDrawEtc(root); |
| 2649 | 2649 |
| 2650 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2650 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2651 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2651 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2652 | 2652 |
| 2653 this->visitLayer(occludingLayerAbove, occlusion); | 2653 this->visitLayer(occludingLayerAbove, occlusion); |
| 2654 EXPECT_INT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.
occlusionInScreenSpace().bounds()); | 2654 EXPECT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occl
usionInScreenSpace().bounds()); |
| 2655 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2655 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2656 EXPECT_INT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTarge
tSurface().bounds()); | 2656 EXPECT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); |
| 2657 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2657 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2658 | 2658 |
| 2659 this->visitLayer(filteredSurface2, occlusion); | 2659 this->visitLayer(filteredSurface2, occlusion); |
| 2660 this->visitContributingSurface(filteredSurface2, occlusion); | 2660 this->visitContributingSurface(filteredSurface2, occlusion); |
| 2661 this->visitLayer(filteredSurface1, occlusion); | 2661 this->visitLayer(filteredSurface1, occlusion); |
| 2662 this->visitContributingSurface(filteredSurface1, occlusion); | 2662 this->visitContributingSurface(filteredSurface1, occlusion); |
| 2663 | 2663 |
| 2664 ASSERT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2664 ASSERT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2665 ASSERT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2665 ASSERT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2666 | 2666 |
| 2667 // Test expectations in the target. | 2667 // Test expectations in the target. |
| 2668 IntRect expectedOcclusion = IntRect(100 + outsetRight * 2, 100 + outsetB
ottom * 2, 50 - (outsetLeft + outsetRight) * 2, 50 - (outsetTop + outsetBottom)
* 2); | 2668 IntRect expectedOcclusion = IntRect(100 + outsetRight * 2, 100 + outsetB
ottom * 2, 50 - (outsetLeft + outsetRight) * 2, 50 - (outsetTop + outsetBottom)
* 2); |
| 2669 EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface
().rects()[0]); | 2669 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().r
ects()[0]); |
| 2670 | 2670 |
| 2671 // Test expectations in the screen. Take the ceiling of half of the outs
ets. | 2671 // Test expectations in the screen. Take the ceiling of half of the outs
ets. |
| 2672 outsetTop = (outsetTop + 1) / 2; | 2672 outsetTop = (outsetTop + 1) / 2; |
| 2673 outsetRight = (outsetRight + 1) / 2; | 2673 outsetRight = (outsetRight + 1) / 2; |
| 2674 outsetBottom = (outsetBottom + 1) / 2; | 2674 outsetBottom = (outsetBottom + 1) / 2; |
| 2675 outsetLeft = (outsetLeft + 1) / 2; | 2675 outsetLeft = (outsetLeft + 1) / 2; |
| 2676 expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetB
ottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetB
ottom) * 2); | 2676 expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetB
ottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetB
ottom) * 2); |
| 2677 | 2677 |
| 2678 EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace()
.rects()[0]); | 2678 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rec
ts()[0]); |
| 2679 } | 2679 } |
| 2680 }; | 2680 }; |
| 2681 | 2681 |
| 2682 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTwoBackgroundFiltersReduceOccl
usionTwice); | 2682 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTwoBackgroundFiltersReduceOccl
usionTwice); |
| 2683 | 2683 |
| 2684 template<class Types, bool opaqueLayers> | 2684 template<class Types, bool opaqueLayers> |
| 2685 class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip :
public CCOcclusionTrackerTest<Types, opaqueLayers> { | 2685 class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip :
public CCOcclusionTrackerTest<Types, opaqueLayers> { |
| 2686 protected: | 2686 protected: |
| 2687 void runMyTest() | 2687 void runMyTest() |
| 2688 { | 2688 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2715 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2715 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2716 | 2716 |
| 2717 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2717 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
| 2718 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. | 2718 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. |
| 2719 this->visitLayer(occludingLayer5, occlusion); | 2719 this->visitLayer(occludingLayer5, occlusion); |
| 2720 this->visitLayer(occludingLayer4, occlusion); | 2720 this->visitLayer(occludingLayer4, occlusion); |
| 2721 this->visitLayer(occludingLayer3, occlusion); | 2721 this->visitLayer(occludingLayer3, occlusion); |
| 2722 this->visitLayer(occludingLayer2, occlusion); | 2722 this->visitLayer(occludingLayer2, occlusion); |
| 2723 this->visitLayer(occludingLayer1, occlusion); | 2723 this->visitLayer(occludingLayer1, occlusion); |
| 2724 | 2724 |
| 2725 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenS
pace().bounds()); | 2725 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2726 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2726 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2727 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetS
urface().bounds()); | 2727 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2728 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); | 2728 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2729 | 2729 |
| 2730 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. | 2730 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. |
| 2731 this->enterLayer(filteredSurface, occlusion); | 2731 this->enterLayer(filteredSurface, occlusion); |
| 2732 EXPECT_INT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRec
t(filteredSurface, IntRect(1, 0, 50, 50))); | 2732 EXPECT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(fi
lteredSurface, IntRect(1, 0, 50, 50))); |
| 2733 EXPECT_INT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRec
t(filteredSurface, IntRect(0, 1, 50, 50))); | 2733 EXPECT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(fi
lteredSurface, IntRect(0, 1, 50, 50))); |
| 2734 EXPECT_INT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRec
t(filteredSurface, IntRect(-1, 0, 50, 50))); | 2734 EXPECT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(fi
lteredSurface, IntRect(-1, 0, 50, 50))); |
| 2735 EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRec
t(filteredSurface, IntRect(0, -1, 50, 50))); | 2735 EXPECT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(fi
lteredSurface, IntRect(0, -1, 50, 50))); |
| 2736 | 2736 |
| 2737 EXPECT_INT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedCont
entRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); | 2737 EXPECT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentR
ect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); |
| 2738 EXPECT_INT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedCont
entRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); | 2738 EXPECT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentR
ect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); |
| 2739 EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedCont
entRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); | 2739 EXPECT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentR
ect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); |
| 2740 EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedCont
entRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); | 2740 EXPECT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentR
ect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); |
| 2741 this->leaveLayer(filteredSurface, occlusion); | 2741 this->leaveLayer(filteredSurface, occlusion); |
| 2742 | 2742 |
| 2743 // The filtered layer/replica does not occlude. | 2743 // The filtered layer/replica does not occlude. |
| 2744 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenS
pace().bounds()); | 2744 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2745 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2745 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2746 EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2746 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface()
.bounds()); |
| 2747 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2747 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2748 | 2748 |
| 2749 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels | 2749 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels |
| 2750 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. | 2750 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. |
| 2751 this->visitContributingSurface(filteredSurface, occlusion); | 2751 this->visitContributingSurface(filteredSurface, occlusion); |
| 2752 | 2752 |
| 2753 this->enterContributingSurface(clippingSurface, occlusion); | 2753 this->enterContributingSurface(clippingSurface, occlusion); |
| 2754 EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenS
pace().bounds()); | 2754 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2755 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2755 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2756 | 2756 |
| 2757 IntRect outsetRect; | 2757 IntRect outsetRect; |
| 2758 IntRect clippedOutsetRect; | 2758 IntRect clippedOutsetRect; |
| 2759 IntRect testRect; | 2759 IntRect testRect; |
| 2760 | 2760 |
| 2761 // Nothing in the (clipped) blur outsets for the filteredSurface is occl
uded. | 2761 // Nothing in the (clipped) blur outsets for the filteredSurface is occl
uded. |
| 2762 outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft +
outsetRight, 50 + outsetTop + outsetBottom); | 2762 outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft +
outsetRight, 50 + outsetTop + outsetBottom); |
| 2763 clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 -
outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); | 2763 clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 -
outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); |
| 2764 testRect = outsetRect; | 2764 testRect = outsetRect; |
| 2765 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2765 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2766 | 2766 |
| 2767 // Stuff outside the (clipped) blur outsets is still occluded though. | 2767 // Stuff outside the (clipped) blur outsets is still occluded though. |
| 2768 testRect = outsetRect; | 2768 testRect = outsetRect; |
| 2769 testRect.expand(1, 0); | 2769 testRect.expand(1, 0); |
| 2770 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2770 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2771 testRect = outsetRect; | 2771 testRect = outsetRect; |
| 2772 testRect.expand(0, 1); | 2772 testRect.expand(0, 1); |
| 2773 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2773 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2774 testRect = outsetRect; | 2774 testRect = outsetRect; |
| 2775 testRect.move(-1, 0); | 2775 testRect.move(-1, 0); |
| 2776 testRect.expand(1, 0); | 2776 testRect.expand(1, 0); |
| 2777 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2777 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2778 testRect = outsetRect; | 2778 testRect = outsetRect; |
| 2779 testRect.move(0, -1); | 2779 testRect.move(0, -1); |
| 2780 testRect.expand(0, 1); | 2780 testRect.expand(0, 1); |
| 2781 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2781 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2782 | 2782 |
| 2783 // Nothing in the (clipped) blur outsets for the filteredSurface's repli
ca is occluded. | 2783 // Nothing in the (clipped) blur outsets for the filteredSurface's repli
ca is occluded. |
| 2784 outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft +
outsetRight, 50 + outsetTop + outsetBottom); | 2784 outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft +
outsetRight, 50 + outsetTop + outsetBottom); |
| 2785 clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 -
outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); | 2785 clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 -
outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); |
| 2786 testRect = outsetRect; | 2786 testRect = outsetRect; |
| 2787 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2787 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2788 | 2788 |
| 2789 // Stuff outside the (clipped) blur outsets is still occluded though. | 2789 // Stuff outside the (clipped) blur outsets is still occluded though. |
| 2790 testRect = outsetRect; | 2790 testRect = outsetRect; |
| 2791 testRect.expand(1, 0); | 2791 testRect.expand(1, 0); |
| 2792 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2792 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2793 testRect = outsetRect; | 2793 testRect = outsetRect; |
| 2794 testRect.expand(0, 1); | 2794 testRect.expand(0, 1); |
| 2795 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2795 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2796 testRect = outsetRect; | 2796 testRect = outsetRect; |
| 2797 testRect.move(-1, 0); | 2797 testRect.move(-1, 0); |
| 2798 testRect.expand(1, 0); | 2798 testRect.expand(1, 0); |
| 2799 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2799 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2800 testRect = outsetRect; | 2800 testRect = outsetRect; |
| 2801 testRect.move(0, -1); | 2801 testRect.move(0, -1); |
| 2802 testRect.expand(0, 1); | 2802 testRect.expand(0, 1); |
| 2803 EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(cl
ippingSurface, testRect)); | 2803 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2804 } | 2804 } |
| 2805 }; | 2805 }; |
| 2806 | 2806 |
| 2807 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBack
groundFilterWithClip); | 2807 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBack
groundFilterWithClip); |
| 2808 | 2808 |
| 2809 template<class Types, bool opaqueLayers> | 2809 template<class Types, bool opaqueLayers> |
| 2810 class CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public CC
OcclusionTrackerTest<Types, opaqueLayers> { | 2810 class CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public CC
OcclusionTrackerTest<Types, opaqueLayers> { |
| 2811 protected: | 2811 protected: |
| 2812 void runMyTest() | 2812 void runMyTest() |
| 2813 { | 2813 { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2839 | 2839 |
| 2840 this->visitLayer(behindReplicaLayer, occlusion); | 2840 this->visitLayer(behindReplicaLayer, occlusion); |
| 2841 this->visitLayer(behindSurfaceLayer, occlusion); | 2841 this->visitLayer(behindSurfaceLayer, occlusion); |
| 2842 | 2842 |
| 2843 // The layers behind the surface are not blurred, and their occlusion do
es not change, until we leave the surface. | 2843 // The layers behind the surface are not blurred, and their occlusion do
es not change, until we leave the surface. |
| 2844 // So it should not be modified by the filter here. | 2844 // So it should not be modified by the filter here. |
| 2845 IntRect occlusionBehindSurface = IntRect(60, 60, 30, 30); | 2845 IntRect occlusionBehindSurface = IntRect(60, 60, 30, 30); |
| 2846 IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); | 2846 IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); |
| 2847 | 2847 |
| 2848 IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusi
onBehindReplica); | 2848 IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusi
onBehindReplica); |
| 2849 EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpac
e().bounds()); | 2849 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); |
| 2850 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2850 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2851 EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurf
ace().bounds()); | 2851 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); |
| 2852 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2852 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2853 } | 2853 } |
| 2854 }; | 2854 }; |
| 2855 | 2855 |
| 2856 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionBelowBackgr
oundFilter); | 2856 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionBelowBackgr
oundFilter); |
| 2857 | 2857 |
| 2858 template<class Types, bool opaqueLayers> | 2858 template<class Types, bool opaqueLayers> |
| 2859 class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : pu
blic CCOcclusionTrackerTest<Types, opaqueLayers> { | 2859 class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : pu
blic CCOcclusionTrackerTest<Types, opaqueLayers> { |
| 2860 protected: | 2860 protected: |
| 2861 void runMyTest() | 2861 void runMyTest() |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2887 | 2887 |
| 2888 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 2888 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
| 2889 this->visitLayer(filteredSurface, occlusion); | 2889 this->visitLayer(filteredSurface, occlusion); |
| 2890 this->visitContributingSurface(filteredSurface, occlusion); | 2890 this->visitContributingSurface(filteredSurface, occlusion); |
| 2891 | 2891 |
| 2892 // The filter is completely occluded, so it should not blur anything and
reduce any occlusion. | 2892 // The filter is completely occluded, so it should not blur anything and
reduce any occlusion. |
| 2893 IntRect occlusionAboveSurface = IntRect(50, 50, 50, 50); | 2893 IntRect occlusionAboveSurface = IntRect(50, 50, 50, 50); |
| 2894 IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); | 2894 IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); |
| 2895 | 2895 |
| 2896 IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusio
nAboveReplica); | 2896 IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusio
nAboveReplica); |
| 2897 EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpac
e().bounds()); | 2897 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); |
| 2898 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2898 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2899 EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurf
ace().bounds()); | 2899 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); |
| 2900 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2900 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2901 } | 2901 } |
| 2902 }; | 2902 }; |
| 2903 | 2903 |
| 2904 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionIfBackgroun
dFilterIsOccluded); | 2904 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionIfBackgroun
dFilterIsOccluded); |
| 2905 | 2905 |
| 2906 template<class Types, bool opaqueLayers> | 2906 template<class Types, bool opaqueLayers> |
| 2907 class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOcclud
ed : public CCOcclusionTrackerTest<Types, opaqueLayers> { | 2907 class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOcclud
ed : public CCOcclusionTrackerTest<Types, opaqueLayers> { |
| 2908 protected: | 2908 protected: |
| 2909 void runMyTest() | 2909 void runMyTest() |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2988 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true); | 2988 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true); |
| 2989 this->calcDrawEtc(parent); | 2989 this->calcDrawEtc(parent); |
| 2990 | 2990 |
| 2991 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2991 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2992 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2992 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2993 occlusion.setMinimumTrackingSize(trackingSize); | 2993 occlusion.setMinimumTrackingSize(trackingSize); |
| 2994 | 2994 |
| 2995 // The small layer is not tracked because it is too small. | 2995 // The small layer is not tracked because it is too small. |
| 2996 this->visitLayer(small, occlusion); | 2996 this->visitLayer(small, occlusion); |
| 2997 | 2997 |
| 2998 EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds(
)); | 2998 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); |
| 2999 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 2999 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
| 3000 EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bound
s()); | 3000 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds())
; |
| 3001 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 3001 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 3002 | 3002 |
| 3003 // The large layer is tracked as it is large enough. | 3003 // The large layer is tracked as it is large enough. |
| 3004 this->visitLayer(large, occlusion); | 3004 this->visitLayer(large, occlusion); |
| 3005 | 3005 |
| 3006 EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusio
nInScreenSpace().bounds()); | 3006 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInS
creenSpace().bounds()); |
| 3007 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 3007 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 3008 EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusio
nInTargetSurface().bounds()); | 3008 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInT
argetSurface().bounds()); |
| 3009 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 3009 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 3010 } | 3010 } |
| 3011 }; | 3011 }; |
| 3012 | 3012 |
| 3013 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestMinimumTrackingSize); | 3013 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestMinimumTrackingSize); |
| 3014 | 3014 |
| 3015 } // namespace | 3015 } // namespace |
| OLD | NEW |