OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/occlusion_tracker.h" | 5 #include "cc/occlusion_tracker.h" |
6 | 6 |
7 #include "cc/layer.h" | 7 #include "cc/layer.h" |
8 #include "cc/layer_animation_controller.h" | 8 #include "cc/layer_animation_controller.h" |
9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
10 #include "cc/layer_tree_host_common.h" | 10 #include "cc/layer_tree_host_common.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 }; | 82 }; |
83 | 83 |
84 static inline bool layerImplDrawTransformIsUnknown(const Layer* layer) { return
layer->drawTransformIsAnimating(); } | 84 static inline bool layerImplDrawTransformIsUnknown(const Layer* layer) { return
layer->drawTransformIsAnimating(); } |
85 static inline bool layerImplDrawTransformIsUnknown(const LayerImpl*) { return fa
lse; } | 85 static inline bool layerImplDrawTransformIsUnknown(const LayerImpl*) { return fa
lse; } |
86 | 86 |
87 template<typename LayerType, typename RenderSurfaceType> | 87 template<typename LayerType, typename RenderSurfaceType> |
88 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType,
RenderSurfaceType> { | 88 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType,
RenderSurfaceType> { |
89 public: | 89 public: |
90 TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFr
ame = false) | 90 TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFr
ame = false) |
91 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r
ecordMetricsForFrame) | 91 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r
ecordMetricsForFrame) |
92 , m_overrideLayerClipRect(false) | |
93 { | 92 { |
94 } | 93 } |
95 | 94 |
96 void setLayerClipRect(const gfx::Rect& rect) { m_overrideLayerClipRect = tru
e; m_layerClipRect = rect;} | |
97 void useDefaultLayerClipRect() { m_overrideLayerClipRect = false; } | |
98 // Returns true if the given rect in content space for the layer is fully oc
cluded in either screen space or the layer's target surface. | |
99 bool occludedLayer(const LayerType* layer, const gfx::Rect& contentRect, boo
l* hasOcclusionFromOutsideTargetSurface = 0) const | 95 bool occludedLayer(const LayerType* layer, const gfx::Rect& contentRect, boo
l* hasOcclusionFromOutsideTargetSurface = 0) const |
100 { | 96 { |
101 return this->occluded(layer->renderTarget(), contentRect, layer->drawTra
nsform(), layerImplDrawTransformIsUnknown(layer), layerClipRectInTarget(layer),
hasOcclusionFromOutsideTargetSurface); | 97 return this->occluded(layer->renderTarget(), contentRect, layer->drawTra
nsform(), layerImplDrawTransformIsUnknown(layer), layer->isClipped(), layer->cli
pRect(), hasOcclusionFromOutsideTargetSurface); |
102 } | 98 } |
103 // Gives an unoccluded sub-rect of |contentRect| in the content space of the
layer. Simple wrapper around unoccludedContentRect. | 99 // Gives an unoccluded sub-rect of |contentRect| in the content space of the
layer. Simple wrapper around unoccludedContentRect. |
104 gfx::Rect unoccludedLayerContentRect(const LayerType* layer, const gfx::Rect
& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const | 100 gfx::Rect unoccludedLayerContentRect(const LayerType* layer, const gfx::Rect
& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const |
105 { | 101 { |
106 return this->unoccludedContentRect(layer->renderTarget(), contentRect, l
ayer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layerClipRectInTa
rget(layer), hasOcclusionFromOutsideTargetSurface); | 102 return this->unoccludedContentRect(layer->renderTarget(), contentRect, l
ayer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layer->isClipped(
), layer->clipRect(), hasOcclusionFromOutsideTargetSurface); |
107 } | 103 } |
108 | |
109 | |
110 protected: | |
111 virtual gfx::Rect layerClipRectInTarget(const LayerType* layer) const { retu
rn m_overrideLayerClipRect ? m_layerClipRect : OcclusionTrackerBase<LayerType, R
enderSurfaceType>::layerClipRectInTarget(layer); } | |
112 | |
113 private: | |
114 bool m_overrideLayerClipRect; | |
115 gfx::Rect m_layerClipRect; | |
116 }; | 104 }; |
117 | 105 |
118 struct OcclusionTrackerTestMainThreadTypes { | 106 struct OcclusionTrackerTestMainThreadTypes { |
119 typedef Layer LayerType; | 107 typedef Layer LayerType; |
120 typedef LayerTreeHost HostType; | 108 typedef LayerTreeHost HostType; |
121 typedef RenderSurface RenderSurfaceType; | 109 typedef RenderSurface RenderSurfaceType; |
122 typedef TestContentLayer ContentLayerType; | 110 typedef TestContentLayer ContentLayerType; |
123 typedef scoped_refptr<Layer> LayerPtrType; | 111 typedef scoped_refptr<Layer> LayerPtrType; |
124 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; | 112 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; |
125 typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurfa
ce, LayerIteratorActions::FrontToBack> TestLayerIterator; | 113 typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurfa
ce, LayerIteratorActions::FrontToBack> TestLayerIterator; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 466 |
479 void runMyTest() | 467 void runMyTest() |
480 { | 468 { |
481 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); | 469 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); |
482 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 470 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
483 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 471 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
484 parent->setMasksToBounds(true); | 472 parent->setMasksToBounds(true); |
485 this->calcDrawEtc(root); | 473 this->calcDrawEtc(root); |
486 | 474 |
487 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 475 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
488 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
489 | 476 |
490 this->visitLayer(layer, occlusion); | 477 this->visitLayer(layer, occlusion); |
491 this->enterLayer(parent, occlusion); | 478 this->enterLayer(parent, occlusion); |
492 | 479 |
493 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 480 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
494 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); | 481 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
495 | 482 |
496 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | 483 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); |
497 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; | 484 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; |
498 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; | 485 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; |
499 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)))
; | |
500 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)))
; | |
501 | |
502 occlusion.useDefaultLayerClipRect(); | |
503 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | |
504 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; | |
505 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; | |
506 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70))); | 486 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70))); |
507 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70))); | 487 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70))); |
508 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
509 | 488 |
510 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 3
0, 70, 70)).IsEmpty()); | 489 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 3
0, 70, 70)).IsEmpty()); |
511 EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 30, 70, 70))); | 490 EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 30, 70, 70))); |
512 EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(29, 29, 70, 70))); | 491 EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(29, 29, 70, 70))); |
513 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 29, 70, 70))); | 492 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 29, 70, 70))); |
514 EXPECT_RECT_EQ(gfx::Rect(31, 29, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 29, 70, 70))); | 493 EXPECT_RECT_EQ(gfx::Rect(31, 29, 69, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(31, 29, 70, 70))); |
515 EXPECT_RECT_EQ(gfx::Rect(100, 30, 1, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 30, 70, 70))); | 494 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(31, 30, 70, 70))); |
516 EXPECT_RECT_EQ(gfx::Rect(31, 31, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 31, 70, 70))); | 495 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(31, 31, 70, 70))); |
517 EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 31, 70, 70))); | 496 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(30, 31, 70, 70))); |
518 EXPECT_RECT_EQ(gfx::Rect(29, 31, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(29, 31, 70, 70))); | 497 EXPECT_RECT_EQ(gfx::Rect(29, 31, 1, 69), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 31, 70, 70))); |
519 } | 498 } |
520 }; | 499 }; |
521 | 500 |
522 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); | 501 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); |
523 | 502 |
524 template<class Types> | 503 template<class Types> |
525 class OcclusionTrackerTestQuadsMismatchLayer : public OcclusionTrackerTest<Types
> { | 504 class OcclusionTrackerTestQuadsMismatchLayer : public OcclusionTrackerTest<Types
> { |
526 protected: | 505 protected: |
527 OcclusionTrackerTestQuadsMismatchLayer(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} | 506 OcclusionTrackerTestQuadsMismatchLayer(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} |
528 void runMyTest() | 507 void runMyTest() |
(...skipping 15 matching lines...) Expand all Loading... |
544 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); | 523 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
545 | 524 |
546 // This checks cases where the quads don't match their "containing" | 525 // This checks cases where the quads don't match their "containing" |
547 // layers, e.g. in terms of transforms or clip rect. This is typical for | 526 // layers, e.g. in terms of transforms or clip rect. This is typical for |
548 // DelegatedRendererLayer. | 527 // DelegatedRendererLayer. |
549 | 528 |
550 gfx::Transform quadTransform; | 529 gfx::Transform quadTransform; |
551 quadTransform.Translate(30, 30); | 530 quadTransform.Translate(30, 30); |
552 gfx::Rect clipRectInTarget(0, 0, 100, 100); | 531 gfx::Rect clipRectInTarget(0, 0, 100, 100); |
553 | 532 |
554 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10,
10), quadTransform, false, clipRectInTarget).IsEmpty()); | 533 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10,
10), quadTransform, false, true, clipRectInTarget).IsEmpty()); |
555 EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), occlusion.unoccludedContentRect(
parent, gfx::Rect(0, 0, 10, 10), quadTransform, true, clipRectInTarget)); | 534 EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), occlusion.unoccludedContentRect(
parent, gfx::Rect(0, 0, 10, 10), quadTransform, true, true, clipRectInTarget)); |
556 EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), occlusion.unoccludedContentRec
t(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, clipRectInTarget)); | 535 EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), occlusion.unoccludedContentRec
t(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, true, clipRectInTarge
t)); |
557 EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), occlusion.unoccludedContentRect
(parent, gfx::Rect(35, 30, 10, 10), quadTransform, false, clipRectInTarget)); | 536 EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), occlusion.unoccludedContentRect
(parent, gfx::Rect(35, 30, 10, 10), quadTransform, false, true, clipRectInTarget
)); |
558 EXPECT_RECT_EQ(gfx::Rect(40, 40, 5, 5), occlusion.unoccludedContentRect(
parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, gfx::Rect(0, 0, 75, 75)
)); | 537 EXPECT_RECT_EQ(gfx::Rect(40, 40, 5, 5), occlusion.unoccludedContentRect(
parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, true, gfx::Rect(0, 0, 7
5, 75))); |
559 } | 538 } |
560 }; | 539 }; |
561 | 540 |
562 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestQuadsMismatchLayer); | 541 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestQuadsMismatchLayer); |
563 | 542 |
564 template<class Types> | 543 template<class Types> |
565 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { | 544 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { |
566 protected: | 545 protected: |
567 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T
ypes>(opaqueLayers) {} | 546 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T
ypes>(opaqueLayers) {} |
568 void runMyTest() | 547 void runMyTest() |
569 { | 548 { |
570 gfx::Transform layerTransform; | 549 gfx::Transform layerTransform; |
571 layerTransform.Translate(250, 250); | 550 layerTransform.Translate(250, 250); |
572 layerTransform.Rotate(90); | 551 layerTransform.Rotate(90); |
573 layerTransform.Translate(-250, -250); | 552 layerTransform.Translate(-250, -250); |
574 | 553 |
575 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::Point(0, 0), gfx::Size(200, 200)); | 554 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::Point(0, 0), gfx::Size(200, 200)); |
576 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 555 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
577 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 556 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
578 parent->setMasksToBounds(true); | 557 parent->setMasksToBounds(true); |
579 this->calcDrawEtc(root); | 558 this->calcDrawEtc(root); |
580 | 559 |
581 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 560 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
582 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
583 | 561 |
584 this->visitLayer(layer, occlusion); | 562 this->visitLayer(layer, occlusion); |
585 this->enterLayer(parent, occlusion); | 563 this->enterLayer(parent, occlusion); |
586 | 564 |
587 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 565 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
588 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); | 566 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
589 | 567 |
590 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | 568 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); |
591 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; | 569 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; |
592 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; | 570 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; |
593 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)))
; | |
594 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)))
; | |
595 | |
596 occlusion.useDefaultLayerClipRect(); | |
597 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70))); | |
598 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)))
; | |
599 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)))
; | |
600 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70))); | 571 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70))); |
601 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70))); | 572 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70))); |
602 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
603 | 573 |
604 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 3
0, 70, 70)).IsEmpty()); | 574 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 3
0, 70, 70)).IsEmpty()); |
605 EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 30, 70, 70))); | 575 EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 30, 70, 70))); |
606 EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(29, 29, 70, 70))); | 576 EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(29, 29, 70, 70))); |
607 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 29, 70, 70))); | 577 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 29, 70, 70))); |
608 EXPECT_RECT_EQ(gfx::Rect(31, 29, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 29, 70, 70))); | 578 EXPECT_RECT_EQ(gfx::Rect(31, 29, 69, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(31, 29, 70, 70))); |
609 EXPECT_RECT_EQ(gfx::Rect(100, 30, 1, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 30, 70, 70))); | 579 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(31, 30, 70, 70))); |
610 EXPECT_RECT_EQ(gfx::Rect(31, 31, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 31, 70, 70))); | 580 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(31, 31, 70, 70))); |
611 EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 31, 70, 70))); | 581 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(30, 31, 70, 70))); |
612 EXPECT_RECT_EQ(gfx::Rect(29, 31, 70, 70), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(29, 31, 70, 70))); | 582 EXPECT_RECT_EQ(gfx::Rect(29, 31, 1, 69), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 31, 70, 70))); |
613 } | 583 } |
614 }; | 584 }; |
615 | 585 |
616 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); | 586 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); |
617 | 587 |
618 template<class Types> | 588 template<class Types> |
619 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { | 589 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { |
620 protected: | 590 protected: |
621 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 591 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
622 void runMyTest() | 592 void runMyTest() |
623 { | 593 { |
624 gfx::Transform layerTransform; | 594 gfx::Transform layerTransform; |
625 layerTransform.Translate(20, 20); | 595 layerTransform.Translate(20, 20); |
626 | 596 |
627 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); | 597 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); |
628 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 598 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
629 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 599 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
630 parent->setMasksToBounds(true); | 600 parent->setMasksToBounds(true); |
631 this->calcDrawEtc(root); | 601 this->calcDrawEtc(root); |
632 | 602 |
633 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 603 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
634 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
635 | 604 |
636 this->visitLayer(layer, occlusion); | 605 this->visitLayer(layer, occlusion); |
637 this->enterLayer(parent, occlusion); | 606 this->enterLayer(parent, occlusion); |
638 | 607 |
639 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 608 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
640 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); | 609 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
641 | 610 |
642 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); | 611 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); |
643 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)))
; | 612 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)))
; |
644 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)))
; | 613 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)))
; |
645 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50)))
; | |
646 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50)))
; | |
647 | |
648 occlusion.useDefaultLayerClipRect(); | |
649 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50))); | |
650 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)))
; | |
651 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)))
; | |
652 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50))); | 614 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50))); |
653 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50))); | 615 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50))); |
654 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
655 | 616 |
656 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 5
0, 50, 50)).IsEmpty()); | 617 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 5
0, 50, 50)).IsEmpty()); |
657 EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(49, 50, 50, 50))); | 618 EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(49, 50, 50, 50))); |
658 EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(49, 49, 50, 50))); | 619 EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(49, 49, 50, 50))); |
659 EXPECT_RECT_EQ(gfx::Rect(50, 49, 50, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(50, 49, 50, 50))); | |
660 EXPECT_RECT_EQ(gfx::Rect(51, 49, 50, 50), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(51, 49, 50, 50))); | |
661 EXPECT_RECT_EQ(gfx::Rect(100, 50, 1, 50), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(51, 50, 50, 50))); | |
662 EXPECT_RECT_EQ(gfx::Rect(51, 51, 50, 50), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(51, 51, 50, 50))); | |
663 EXPECT_RECT_EQ(gfx::Rect(50, 100, 50, 1), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(50, 51, 50, 50))); | |
664 EXPECT_RECT_EQ(gfx::Rect(49, 51, 50, 50), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(49, 51, 50, 50))); | |
665 | |
666 occlusion.useDefaultLayerClipRect(); | |
667 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 5
0, 50, 50)).IsEmpty()); | |
668 EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(49, 50, 50, 50))); | |
669 EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(49, 49, 50, 50))); | |
670 EXPECT_RECT_EQ(gfx::Rect(50, 49, 50, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(50, 49, 50, 50))); | 620 EXPECT_RECT_EQ(gfx::Rect(50, 49, 50, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(50, 49, 50, 50))); |
671 EXPECT_RECT_EQ(gfx::Rect(51, 49, 49, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(51, 49, 50, 50))); | 621 EXPECT_RECT_EQ(gfx::Rect(51, 49, 49, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(51, 49, 50, 50))); |
672 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 5
0, 50, 50)).IsEmpty()); | 622 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 5
0, 50, 50)).IsEmpty()); |
673 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 5
1, 50, 50)).IsEmpty()); | 623 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 5
1, 50, 50)).IsEmpty()); |
674 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 5
1, 50, 50)).IsEmpty()); | 624 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 5
1, 50, 50)).IsEmpty()); |
675 EXPECT_RECT_EQ(gfx::Rect(49, 51, 1, 49), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(49, 51, 50, 50))); | 625 EXPECT_RECT_EQ(gfx::Rect(49, 51, 1, 49), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(49, 51, 50, 50))); |
676 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
677 } | 626 } |
678 }; | 627 }; |
679 | 628 |
680 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); | 629 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); |
681 | 630 |
682 template<class Types> | 631 template<class Types> |
683 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type
s> { | 632 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type
s> { |
684 protected: | 633 protected: |
685 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 634 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
686 void runMyTest() | 635 void runMyTest() |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 parent->setMasksToBounds(true); | 748 parent->setMasksToBounds(true); |
800 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 749 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
801 child->setMasksToBounds(true); | 750 child->setMasksToBounds(true); |
802 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 751 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
803 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in | 752 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in |
804 // leaveToTargetRenderSurface, as the target surface has already been se
en. | 753 // leaveToTargetRenderSurface, as the target surface has already been se
en. |
805 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); | 754 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); |
806 this->calcDrawEtc(root); | 755 this->calcDrawEtc(root); |
807 | 756 |
808 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 757 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
809 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000)); | |
810 | 758 |
811 this->visitLayer(child2, occlusion); | 759 this->visitLayer(child2, occlusion); |
812 | 760 |
813 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 761 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
814 EXPECT_EQ(gfx::Rect(30, 30, 60, 20).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); | 762 EXPECT_EQ(gfx::Rect(30, 30, 60, 20).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
815 | 763 |
816 this->visitLayer(layer, occlusion); | 764 this->visitLayer(layer, occlusion); |
817 | 765 |
818 EXPECT_EQ(gfx::Rect(0, 440, 20, 60).ToString(), occlusion.occlusionFromO
utsideTarget().ToString()); | 766 EXPECT_EQ(gfx::Rect(0, 440, 20, 60).ToString(), occlusion.occlusionFromO
utsideTarget().ToString()); |
819 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionFrom
InsideTarget().ToString()); | 767 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionFrom
InsideTarget().ToString()); |
(...skipping 30 matching lines...) Expand all Loading... |
850 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 3
1, 60, 10)).IsEmpty()); | 798 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 3
1, 60, 10)).IsEmpty()); |
851 | 799 |
852 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 4
0, 70, 60)).IsEmpty()); | 800 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 4
0, 70, 60)).IsEmpty()); |
853 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 40, 70, 60))); | 801 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 40, 70, 60))); |
854 // This rect is mostly occluded by |child2|. | 802 // This rect is mostly occluded by |child2|. |
855 EXPECT_RECT_EQ(gfx::Rect(90, 39, 10, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 39, 70, 60))); | 803 EXPECT_RECT_EQ(gfx::Rect(90, 39, 10, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 39, 70, 60))); |
856 // This rect extends past top/right ends of |child2|. | 804 // This rect extends past top/right ends of |child2|. |
857 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 11), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 29, 70, 70))); | 805 EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 11), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 29, 70, 70))); |
858 // This rect extends past left/right ends of |child2|. | 806 // This rect extends past left/right ends of |child2|. |
859 EXPECT_RECT_EQ(gfx::Rect(20, 39, 80, 60), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(20, 39, 80, 60))); | 807 EXPECT_RECT_EQ(gfx::Rect(20, 39, 80, 60), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(20, 39, 80, 60))); |
860 EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 40, 70, 60))); | 808 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(31, 40, 70, 60))); |
861 EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 41, 70, 60))); | 809 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(30, 41, 70, 60))); |
862 | 810 |
863 /* Justification for the above occlusion from |layer|: | 811 /* Justification for the above occlusion from |layer|: |
864 100 | 812 100 |
865 +---------------------+ +--------
-------------+ | 813 +---------------------+ +--------
-------------+ |
866 | | |
|30 Visible region of |layer|: ///// | 814 | | |
|30 Visible region of |layer|: ///// |
867 | 30 | rotate(90) | 30
60 | |child2|: \\\\\ | 815 | 30 | rotate(90) | 30
60 | |child2|: \\\\\ |
868 | 30 + ------------+--------------------+ | 30 +--
----------+--------------------+ | 816 | 30 + ------------+--------------------+ | 30 +--
----------+--------------------+ |
869 100 | | 10 | | | ==> | |\\
\\\\\\\\\\| |10 | | 817 100 | | 10 | | | ==> | |\\
\\\\\\\\\\| |10 | |
870 | |10+----------|----------------------+ | +--|\\
\\\\\\\\\\|-----------------+ | | 818 | |10+----------|----------------------+ | +--|\\
\\\\\\\\\\|-----------------+ | |
871 | + ------------+ | | | | | +--
----------+//| 420 | | | 819 | + ------------+ | | | | | +--
----------+//| 420 | | |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 layerTransform.Translate(10, 10); | 852 layerTransform.Translate(10, 10); |
905 | 853 |
906 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(1000, 1000)); | 854 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(1000, 1000)); |
907 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 855 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
908 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 856 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
909 child->setMasksToBounds(true); | 857 child->setMasksToBounds(true); |
910 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, gfx::PointF(0, 0), gfx::Size(500, 500), true); | 858 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, gfx::PointF(0, 0), gfx::Size(500, 500), true); |
911 this->calcDrawEtc(root); | 859 this->calcDrawEtc(root); |
912 | 860 |
913 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 861 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
914 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
915 | 862 |
916 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); | 863 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); |
917 | 864 |
918 this->visitLayer(layer, occlusion); | 865 this->visitLayer(layer, occlusion); |
919 this->enterContributingSurface(child, occlusion); | 866 this->enterContributingSurface(child, occlusion); |
920 | 867 |
921 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 868 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
922 EXPECT_EQ(clippedLayerInChild.ToString(), occlusion.occlusionFromInsideT
arget().ToString()); | 869 EXPECT_EQ(clippedLayerInChild.ToString(), occlusion.occlusionFromInsideT
arget().ToString()); |
923 | 870 |
924 this->leaveContributingSurface(child, occlusion); | 871 this->leaveContributingSurface(child, occlusion); |
(...skipping 23 matching lines...) Expand all Loading... |
948 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(1000, 1000)); | 895 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(1000, 1000)); |
949 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 896 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
950 parent->setMasksToBounds(true); | 897 parent->setMasksToBounds(true); |
951 typename Types::ContentLayerType* child = this->createDrawingLayer(paren
t, childTransform, gfx::PointF(30, 30), gfx::Size(500, 500), false); | 898 typename Types::ContentLayerType* child = this->createDrawingLayer(paren
t, childTransform, gfx::PointF(30, 30), gfx::Size(500, 500), false); |
952 child->setMasksToBounds(true); | 899 child->setMasksToBounds(true); |
953 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 900 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
954 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true); | 901 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true); |
955 this->calcDrawEtc(root); | 902 this->calcDrawEtc(root); |
956 | 903 |
957 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 904 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
958 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
959 | 905 |
960 this->visitLayer(layer2, occlusion); | 906 this->visitLayer(layer2, occlusion); |
961 this->visitLayer(layer1, occlusion); | 907 this->visitLayer(layer1, occlusion); |
962 this->visitLayer(child, occlusion); | 908 this->visitLayer(child, occlusion); |
963 this->enterContributingSurface(child, occlusion); | 909 this->enterContributingSurface(child, occlusion); |
964 | 910 |
965 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 911 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
966 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionFrom
InsideTarget().ToString()); | 912 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusionFrom
InsideTarget().ToString()); |
967 | 913 |
968 EXPECT_TRUE(occlusion.occludedLayer(child, gfx::Rect(10, 430, 60, 70))); | 914 EXPECT_TRUE(occlusion.occludedLayer(child, gfx::Rect(10, 430, 60, 70))); |
(...skipping 16 matching lines...) Expand all Loading... |
985 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 931 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
986 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); | 932 EXPECT_EQ(gfx::Rect(30, 40, 70, 60).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
987 | 933 |
988 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); | 934 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60))); |
989 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)))
; | 935 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)))
; |
990 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)))
; | 936 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)))
; |
991 | 937 |
992 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 4
0, 70, 60)).IsEmpty()); | 938 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 4
0, 70, 60)).IsEmpty()); |
993 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 40, 70, 60))); | 939 EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(29, 40, 70, 60))); |
994 EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 39, 70, 60))); | 940 EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), occlusion.unoccludedLayerConten
tRect(parent, gfx::Rect(30, 39, 70, 60))); |
995 EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(31, 40, 70, 60))); | 941 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(31, 40, 70, 60))); |
996 EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(30, 41, 70, 60))); | 942 EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent,
gfx::Rect(30, 41, 70, 60))); |
997 | 943 |
998 /* Justification for the above occlusion from |layer1| and |layer2|: | 944 /* Justification for the above occlusion from |layer1| and |layer2|: |
999 | 945 |
1000 +---------------------+ | 946 +---------------------+ |
1001 | |30 Visible region of |layer1|: ///// | 947 | |30 Visible region of |layer1|: ///// |
1002 | | Visible region of |layer2|: \\\\\ | 948 | | Visible region of |layer2|: \\\\\ |
1003 | +---------------------------------+ | 949 | +---------------------------------+ |
1004 | | |10 | | 950 | | |10 | |
1005 | +---------------+-----------------+ | | 951 | +---------------+-----------------+ | |
1006 | | |\\\\\\\\\\\\|//| 420 | | | 952 | | |\\\\\\\\\\\\|//| 420 | | |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 | 1078 |
1133 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1079 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
1134 parent->setMasksToBounds(true); | 1080 parent->setMasksToBounds(true); |
1135 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, gfx::PointF(30, 20), gfx::Size(10, 10)); | 1081 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, gfx::PointF(30, 20), gfx::Size(10, 10)); |
1136 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, gfx::PointF(20, 40), gfx::Size(10, 10), false); | 1082 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, gfx::PointF(20, 40), gfx::Size(10, 10), false); |
1137 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true); | 1083 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true); |
1138 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 1084 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
1139 this->calcDrawEtc(parent); | 1085 this->calcDrawEtc(parent); |
1140 | 1086 |
1141 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1087 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1142 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000)); | |
1143 | 1088 |
1144 this->visitLayer(layer2, occlusion); | 1089 this->visitLayer(layer2, occlusion); |
1145 this->enterLayer(child2, occlusion); | 1090 this->enterLayer(child2, occlusion); |
1146 | 1091 |
1147 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 1092 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
1148 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), occlusion.occlusionFro
mInsideTarget().ToString()); | 1093 EXPECT_EQ(gfx::Rect(-10, 420, 70, 80).ToString(), occlusion.occlusionFro
mInsideTarget().ToString()); |
1149 | 1094 |
1150 this->leaveLayer(child2, occlusion); | 1095 this->leaveLayer(child2, occlusion); |
1151 this->enterContributingSurface(child2, occlusion); | 1096 this->enterContributingSurface(child2, occlusion); |
1152 | 1097 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); | 1169 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); |
1225 opaqueLayer->setFilters(filters); | 1170 opaqueLayer->setFilters(filters); |
1226 | 1171 |
1227 filters.clear(); | 1172 filters.clear(); |
1228 filters.append(WebKit::WebFilterOperation::createOpacityFilter(0.5)); | 1173 filters.append(WebKit::WebFilterOperation::createOpacityFilter(0.5)); |
1229 opacityLayer->setFilters(filters); | 1174 opacityLayer->setFilters(filters); |
1230 | 1175 |
1231 this->calcDrawEtc(parent); | 1176 this->calcDrawEtc(parent); |
1232 | 1177 |
1233 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1178 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1234 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
1235 | 1179 |
1236 // Opacity layer won't contribute to occlusion. | 1180 // Opacity layer won't contribute to occlusion. |
1237 this->visitLayer(opacityLayer, occlusion); | 1181 this->visitLayer(opacityLayer, occlusion); |
1238 this->enterContributingSurface(opacityLayer, occlusion); | 1182 this->enterContributingSurface(opacityLayer, occlusion); |
1239 | 1183 |
1240 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty()); | 1184 EXPECT_TRUE(occlusion.occlusionFromOutsideTarget().IsEmpty()); |
1241 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty()); | 1185 EXPECT_TRUE(occlusion.occlusionFromInsideTarget().IsEmpty()); |
1242 | 1186 |
1243 // And has nothing to contribute to its parent surface. | 1187 // And has nothing to contribute to its parent surface. |
1244 this->leaveContributingSurface(opacityLayer, occlusion); | 1188 this->leaveContributingSurface(opacityLayer, occlusion); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 protected: | 1227 protected: |
1284 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} | 1228 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} |
1285 void runMyTest() | 1229 void runMyTest() |
1286 { | 1230 { |
1287 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 1231 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
1288 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); | 1232 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1289 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); | 1233 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); |
1290 this->calcDrawEtc(parent); | 1234 this->calcDrawEtc(parent); |
1291 | 1235 |
1292 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1236 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1293 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
1294 | 1237 |
1295 this->visitLayer(surface, occlusion); | 1238 this->visitLayer(surface, occlusion); |
1296 | 1239 |
1297 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns
ideTarget().ToString()); | 1240 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns
ideTarget().ToString()); |
1298 | 1241 |
1299 this->visitContributingSurface(surface, occlusion); | 1242 this->visitContributingSurface(surface, occlusion); |
1300 this->enterLayer(parent, occlusion); | 1243 this->enterLayer(parent, occlusion); |
1301 | 1244 |
1302 // The surface and replica should both be occluding the parent. | 1245 // The surface and replica should both be occluding the parent. |
1303 EXPECT_EQ(UnionRegions(gfx::Rect(0, 100, 50, 50), gfx::Rect(50, 150, 50,
50)).ToString(), occlusion.occlusionFromInsideTarget().ToString()); | 1246 EXPECT_EQ(UnionRegions(gfx::Rect(0, 100, 50, 50), gfx::Rect(50, 150, 50,
50)).ToString(), occlusion.occlusionFromInsideTarget().ToString()); |
1304 } | 1247 } |
1305 }; | 1248 }; |
1306 | 1249 |
1307 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); | 1250 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); |
1308 | 1251 |
1309 template<class Types> | 1252 template<class Types> |
1310 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s> { | 1253 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s> { |
1311 protected: | 1254 protected: |
1312 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 1255 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
1313 void runMyTest() | 1256 void runMyTest() |
1314 { | 1257 { |
1315 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170)); | 1258 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170)); |
1316 parent->setMasksToBounds(true); | 1259 parent->setMasksToBounds(true); |
1317 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); | 1260 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1318 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); | 1261 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); |
1319 this->calcDrawEtc(parent); | 1262 this->calcDrawEtc(parent); |
1320 | 1263 |
1321 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1264 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1322 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
1323 | 1265 |
1324 this->visitLayer(surface, occlusion); | 1266 this->visitLayer(surface, occlusion); |
1325 | 1267 |
1326 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns
ideTarget().ToString()); | 1268 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns
ideTarget().ToString()); |
1327 | 1269 |
1328 this->visitContributingSurface(surface, occlusion); | 1270 this->visitContributingSurface(surface, occlusion); |
1329 this->enterLayer(parent, occlusion); | 1271 this->enterLayer(parent, occlusion); |
1330 | 1272 |
1331 // The surface and replica should both be occluding the parent. | 1273 // The surface and replica should both be occluding the parent. |
1332 EXPECT_EQ(UnionRegions(gfx::Rect(0, 100, 50, 50), gfx::Rect(50, 150, 50,
20)).ToString(), occlusion.occlusionFromInsideTarget().ToString()); | 1274 EXPECT_EQ(UnionRegions(gfx::Rect(0, 100, 50, 50), gfx::Rect(50, 150, 50,
20)).ToString(), occlusion.occlusionFromInsideTarget().ToString()); |
1333 } | 1275 } |
1334 }; | 1276 }; |
1335 | 1277 |
1336 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); | 1278 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); |
1337 | 1279 |
1338 template<class Types> | 1280 template<class Types> |
1339 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { | 1281 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { |
1340 protected: | 1282 protected: |
1341 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 1283 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
1342 void runMyTest() | 1284 void runMyTest() |
1343 { | 1285 { |
1344 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 1286 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
1345 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); | 1287 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1346 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, gfx::PointF(50, 50), gfx::Size()); | 1288 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, gfx::PointF(50, 50), gfx::Size()); |
1347 this->createMaskLayer(replica, gfx::Size(10, 10)); | 1289 this->createMaskLayer(replica, gfx::Size(10, 10)); |
1348 this->calcDrawEtc(parent); | 1290 this->calcDrawEtc(parent); |
1349 | 1291 |
1350 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1292 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1351 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
1352 | 1293 |
1353 this->visitLayer(surface, occlusion); | 1294 this->visitLayer(surface, occlusion); |
1354 | 1295 |
1355 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns
ideTarget().ToString()); | 1296 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusionFromIns
ideTarget().ToString()); |
1356 | 1297 |
1357 this->visitContributingSurface(surface, occlusion); | 1298 this->visitContributingSurface(surface, occlusion); |
1358 this->enterLayer(parent, occlusion); | 1299 this->enterLayer(parent, occlusion); |
1359 | 1300 |
1360 // The replica should not be occluding the parent, since it has a mask a
pplied to it. | 1301 // The replica should not be occluding the parent, since it has a mask a
pplied to it. |
1361 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); | 1302 EXPECT_EQ(gfx::Rect(0, 100, 50, 50).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
1362 } | 1303 } |
1363 }; | 1304 }; |
1364 | 1305 |
1365 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); | 1306 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); |
1366 | 1307 |
1367 template<class Types> | 1308 template<class Types> |
1368 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types> { | 1309 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types> { |
1369 protected: | 1310 protected: |
1370 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} | 1311 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} |
1371 void runMyTest() | 1312 void runMyTest() |
1372 { | 1313 { |
1373 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1314 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1374 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1315 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(200, 100), gfx::Size(100, 100), false); |
| 1316 clip->setMasksToBounds(true); |
| 1317 typename Types::ContentLayerType* layer = this->createDrawingLayer(clip,
this->identityMatrix, gfx::PointF(-200, -100), gfx::Size(200, 200), false); |
1375 this->calcDrawEtc(parent); | 1318 this->calcDrawEtc(parent); |
1376 | 1319 |
1377 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1320 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1378 occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100)); | |
1379 | 1321 |
1380 this->enterLayer(layer, occlusion); | 1322 this->enterLayer(layer, occlusion); |
1381 | 1323 |
1382 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1324 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1383 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1325 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
1384 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1326 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
1385 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)
)); | 1327 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)
)); |
1386 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100
))); | 1328 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100
))); |
1387 | 1329 |
1388 occlusion.useDefaultLayerClipRect(); | 1330 this->leaveLayer(layer, occlusion); |
1389 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)
)); | 1331 this->enterLayer(clip, occlusion); |
1390 occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100)); | |
1391 | 1332 |
1392 this->leaveLayer(layer, occlusion); | 1333 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(-100, 0, 100, 100)))
; |
1393 this->enterLayer(parent, occlusion); | 1334 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, -100, 100, 100)))
; |
| 1335 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(100, 0, 100, 100))); |
| 1336 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, 100, 100, 100))); |
| 1337 EXPECT_FALSE(occlusion.occludedLayer(clip, gfx::Rect(0, 0, 100, 100))); |
1394 | 1338 |
1395 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100))); | 1339 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedLayerConte
ntRect(clip, gfx::Rect(-100, -100, 300, 300))); |
1396 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))
); | |
1397 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100))
); | |
1398 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))
); | |
1399 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 10
0))); | |
1400 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100))
); | |
1401 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100))
); | |
1402 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100
))); | |
1403 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100
))); | |
1404 | |
1405 EXPECT_RECT_EQ(gfx::Rect(200, 100, 100, 100), occlusion.unoccludedLayerC
ontentRect(parent, gfx::Rect(0, 0, 300, 300))); | |
1406 } | 1340 } |
1407 }; | 1341 }; |
1408 | 1342 |
1409 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); | 1343 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); |
1410 | 1344 |
1411 template<class Types> | 1345 template<class Types> |
1412 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest
<Types> { | 1346 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest
<Types> { |
1413 protected: | 1347 protected: |
1414 OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionT
rackerTest<Types>(opaqueLayers) {} | 1348 OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionT
rackerTest<Types>(opaqueLayers) {} |
1415 void runMyTest() | 1349 void runMyTest() |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 | 1382 |
1449 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); | 1383 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); |
1450 | 1384 |
1451 template<class Types> | 1385 template<class Types> |
1452 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T
ypes> { | 1386 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T
ypes> { |
1453 protected: | 1387 protected: |
1454 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra
ckerTest<Types>(opaqueLayers) {} | 1388 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra
ckerTest<Types>(opaqueLayers) {} |
1455 void runMyTest() | 1389 void runMyTest() |
1456 { | 1390 { |
1457 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1391 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1458 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1392 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(100, 100), false); |
| 1393 clip->setMasksToBounds(true); |
| 1394 typename Types::ContentLayerType* layer = this->createDrawingSurface(cli
p, this->identityMatrix, gfx::PointF(-100, -100), gfx::Size(200, 200), true); |
1459 this->calcDrawEtc(parent); | 1395 this->calcDrawEtc(parent); |
1460 | 1396 |
1461 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1397 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1462 occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100)); | |
1463 | 1398 |
1464 this->enterLayer(layer, occlusion); | 1399 this->enterLayer(layer, occlusion); |
1465 | 1400 |
1466 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1401 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1467 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1402 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
1468 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1403 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
1469 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); | 1404 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); |
1470 | 1405 |
1471 this->leaveLayer(layer, occlusion); | 1406 this->leaveLayer(layer, occlusion); |
1472 this->visitContributingSurface(layer, occlusion); | 1407 this->visitContributingSurface(layer, occlusion); |
1473 this->enterLayer(parent, occlusion); | |
1474 | 1408 |
1475 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100))); | 1409 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusionF
romInsideTarget().ToString()); |
1476 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))
); | |
1477 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100))
); | |
1478 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100
))); | |
1479 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100
))); | |
1480 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100))
); | |
1481 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100))
); | |
1482 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100
))); | |
1483 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100
))); | |
1484 | 1410 |
1485 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0,
300, 300)).IsEmpty()); | 1411 this->enterLayer(clip, occlusion); |
| 1412 |
| 1413 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, 0, 100, 100))); |
| 1414 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, 100, 100, 100))); |
| 1415 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(100, 0, 100, 100))); |
| 1416 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(100, 100, 100, 100))
); |
| 1417 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(200, 100, 100, 100))
); |
| 1418 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(200, 0, 100, 100))); |
| 1419 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, 200, 100, 100))); |
| 1420 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(100, 200, 100, 100))
); |
| 1421 EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(200, 200, 100, 100))
); |
| 1422 |
| 1423 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(clip, gfx::Rect(0, 0, 3
00, 300)).IsEmpty()); |
1486 } | 1424 } |
1487 }; | 1425 }; |
1488 | 1426 |
1489 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); | 1427 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); |
1490 | 1428 |
1491 template<class Types> | 1429 template<class Types> |
1492 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty
pes> { | 1430 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty
pes> { |
1493 protected: | 1431 protected: |
1494 OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrac
kerTest<Types>(opaqueLayers) {} | 1432 OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrac
kerTest<Types>(opaqueLayers) {} |
1495 void runMyTest() | 1433 void runMyTest() |
1496 { | 1434 { |
1497 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1435 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1498 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1436 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1499 this->calcDrawEtc(parent); | 1437 this->calcDrawEtc(parent); |
1500 | 1438 |
1501 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100)); | 1439 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100)); |
1502 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
1503 | 1440 |
1504 this->enterLayer(layer, occlusion); | 1441 this->enterLayer(layer, occlusion); |
1505 | 1442 |
1506 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1443 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1507 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1444 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
1508 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1445 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
1509 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); | 1446 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); |
1510 | 1447 |
1511 this->leaveLayer(layer, occlusion); | 1448 this->leaveLayer(layer, occlusion); |
1512 this->visitContributingSurface(layer, occlusion); | 1449 this->visitContributingSurface(layer, occlusion); |
(...skipping 15 matching lines...) Expand all Loading... |
1528 | 1465 |
1529 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); | 1466 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); |
1530 | 1467 |
1531 template<class Types> | 1468 template<class Types> |
1532 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker
Test<Types> { | 1469 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker
Test<Types> { |
1533 protected: | 1470 protected: |
1534 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 1471 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
1535 void runMyTest() | 1472 void runMyTest() |
1536 { | 1473 { |
1537 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1474 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1538 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1475 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(200, 200), false); |
| 1476 clip->setMasksToBounds(true); |
| 1477 typename Types::ContentLayerType* layer = this->createDrawingSurface(cli
p, this->identityMatrix, gfx::PointF(-50, -50), gfx::Size(200, 200), true); |
1539 this->calcDrawEtc(parent); | 1478 this->calcDrawEtc(parent); |
1540 | 1479 |
1541 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1480 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1542 occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200)); | |
1543 | 1481 |
1544 this->enterLayer(layer, occlusion); | 1482 this->enterLayer(layer, occlusion); |
1545 | 1483 |
1546 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1484 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1547 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); | 1485 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); |
1548 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); | 1486 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); |
1549 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); | 1487 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); |
1550 | 1488 |
| 1489 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 50))); |
| 1490 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 50, 100))); |
| 1491 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 50))); |
| 1492 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 50, 100))); |
| 1493 |
1551 this->leaveLayer(layer, occlusion); | 1494 this->leaveLayer(layer, occlusion); |
1552 this->visitContributingSurface(layer, occlusion); | 1495 this->visitContributingSurface(layer, occlusion); |
1553 this->enterLayer(parent, occlusion); | 1496 this->enterLayer(clip, occlusion); |
1554 | 1497 |
1555 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100))); | 1498 EXPECT_EQ(gfx::Rect(50, 50, 150, 150).ToString(), occlusion.occlusionFro
mInsideTarget().ToString()); |
1556 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))
); | |
1557 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100))
); | |
1558 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100
))); | |
1559 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 10
0))); | |
1560 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)
)); | |
1561 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)
)); | |
1562 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 10
0))); | |
1563 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 10
0))); | |
1564 | |
1565 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.unoccludedLayerCon
tentRect(parent, gfx::Rect(0, 0, 300, 300))); | |
1566 EXPECT_RECT_EQ(gfx::Rect(200, 50, 50, 50), occlusion.unoccludedLayerCont
entRect(parent, gfx::Rect(0, 0, 300, 100))); | |
1567 EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(0, 100, 300, 100))); | |
1568 EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(200, 100, 100, 100))); | |
1569 EXPECT_RECT_EQ(gfx::Rect(100, 200, 100, 50), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(100, 200, 100, 100))); | |
1570 } | 1499 } |
1571 }; | 1500 }; |
1572 | 1501 |
1573 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); | 1502 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); |
1574 | 1503 |
1575 template<class Types> | 1504 template<class Types> |
1576 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT
est<Types> { | 1505 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT
est<Types> { |
1577 protected: | 1506 protected: |
1578 OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : Occlusi
onTrackerTest<Types>(opaqueLayers) {} | 1507 OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : Occlusi
onTrackerTest<Types>(opaqueLayers) {} |
1579 void runMyTest() | 1508 void runMyTest() |
1580 { | 1509 { |
1581 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1510 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1582 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1511 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1583 this->calcDrawEtc(parent); | 1512 this->calcDrawEtc(parent); |
1584 | 1513 |
1585 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200)); | 1514 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200)); |
1586 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
1587 | 1515 |
1588 this->enterLayer(layer, occlusion); | 1516 this->enterLayer(layer, occlusion); |
1589 | 1517 |
1590 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1518 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1591 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); | 1519 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); |
1592 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); | 1520 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); |
1593 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); | 1521 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); |
1594 | 1522 |
1595 this->leaveLayer(layer, occlusion); | 1523 this->leaveLayer(layer, occlusion); |
1596 this->visitContributingSurface(layer, occlusion); | 1524 this->visitContributingSurface(layer, occlusion); |
(...skipping 13 matching lines...) Expand all Loading... |
1610 EXPECT_RECT_EQ(gfx::Rect(200, 50, 50, 50), occlusion.unoccludedLayerCont
entRect(parent, gfx::Rect(0, 0, 300, 100))); | 1538 EXPECT_RECT_EQ(gfx::Rect(200, 50, 50, 50), occlusion.unoccludedLayerCont
entRect(parent, gfx::Rect(0, 0, 300, 100))); |
1611 EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(0, 100, 300, 100))); | 1539 EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(0, 100, 300, 100))); |
1612 EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(200, 100, 100, 100))); | 1540 EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(200, 100, 100, 100))); |
1613 EXPECT_RECT_EQ(gfx::Rect(100, 200, 100, 50), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(100, 200, 100, 100))); | 1541 EXPECT_RECT_EQ(gfx::Rect(100, 200, 100, 50), occlusion.unoccludedLayerCo
ntentRect(parent, gfx::Rect(100, 200, 100, 100))); |
1614 } | 1542 } |
1615 }; | 1543 }; |
1616 | 1544 |
1617 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); | 1545 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); |
1618 | 1546 |
1619 template<class Types> | 1547 template<class Types> |
1620 class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest
<Types> { | |
1621 protected: | |
1622 OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionT
rackerTest<Types>(opaqueLayers) {} | |
1623 void runMyTest() | |
1624 { | |
1625 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | |
1626 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); | |
1627 this->calcDrawEtc(parent); | |
1628 | |
1629 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | |
1630 occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100)); | |
1631 | |
1632 this->enterLayer(layer, occlusion); | |
1633 | |
1634 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | |
1635 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | |
1636 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | |
1637 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)
)); | |
1638 | |
1639 this->leaveLayer(layer, occlusion); | |
1640 this->visitContributingSurface(layer, occlusion); | |
1641 this->enterLayer(parent, occlusion); | |
1642 | |
1643 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100))); | |
1644 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100))
); | |
1645 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100))
); | |
1646 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100
))); | |
1647 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100
))); | |
1648 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100))
); | |
1649 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100))
); | |
1650 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100
))); | |
1651 EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100
))); | |
1652 | |
1653 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0,
300, 300)).IsEmpty()); | |
1654 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0,
300, 100)).IsEmpty()); | |
1655 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 10
0, 300, 100)).IsEmpty()); | |
1656 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(200,
100, 100, 100)).IsEmpty()); | |
1657 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(100,
200, 100, 100)).IsEmpty()); | |
1658 } | |
1659 }; | |
1660 | |
1661 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing); | |
1662 | |
1663 template<class Types> | |
1664 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest<
Types> { | 1548 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest<
Types> { |
1665 protected: | 1549 protected: |
1666 OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTr
ackerTest<Types>(opaqueLayers) {} | 1550 OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTr
ackerTest<Types>(opaqueLayers) {} |
1667 void runMyTest() | 1551 void runMyTest() |
1668 { | 1552 { |
1669 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1553 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1670 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1554 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1671 this->calcDrawEtc(parent); | 1555 this->calcDrawEtc(parent); |
1672 | 1556 |
1673 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100)); | 1557 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100)); |
1674 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
1675 | 1558 |
1676 this->enterLayer(layer, occlusion); | 1559 this->enterLayer(layer, occlusion); |
1677 | 1560 |
1678 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1561 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1679 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1562 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
1680 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1563 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
1681 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)
)); | 1564 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)
)); |
1682 | 1565 |
1683 this->leaveLayer(layer, occlusion); | 1566 this->leaveLayer(layer, occlusion); |
1684 this->visitContributingSurface(layer, occlusion); | 1567 this->visitContributingSurface(layer, occlusion); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 | 1891 |
2009 // 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. | 1892 // 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. |
2010 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); | 1893 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); |
2011 | 1894 |
2012 template<class Types> | 1895 template<class Types> |
2013 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke
rTest<Types> { | 1896 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke
rTest<Types> { |
2014 protected: | 1897 protected: |
2015 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} | 1898 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} |
2016 void runMyTest() | 1899 void runMyTest() |
2017 { | 1900 { |
| 1901 // parent |
| 1902 // +--layer |
| 1903 // +--surface |
| 1904 // | +--surfaceChild |
| 1905 // | +--surfaceChild2 |
| 1906 // +--parent2 |
| 1907 // +--topmost |
| 1908 |
2018 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1909 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
2019 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1910 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
2020 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1911 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
2021 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); | 1912 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
2022 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); | 1913 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
2023 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 1914 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
2024 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); | 1915 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); |
2025 | 1916 |
2026 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
0, 1, false); | 1917 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
0, 1, false); |
2027 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 0, 1, false); | 1918 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 0, 1, false); |
2028 this->calcDrawEtc(parent); | 1919 this->calcDrawEtc(parent); |
2029 | 1920 |
2030 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 1921 EXPECT_TRUE(layer->drawOpacityIsAnimating()); |
2031 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 1922 EXPECT_FALSE(surface->drawOpacityIsAnimating()); |
2032 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); | 1923 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); |
2033 | 1924 |
2034 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1925 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2035 | 1926 |
2036 this->visitLayer(topmost, occlusion); | 1927 this->visitLayer(topmost, occlusion); |
2037 this->enterLayer(parent2, occlusion); | 1928 this->enterLayer(parent2, occlusion); |
2038 // This occlusion will affect all surfaces. | 1929 // This occlusion will affect all surfaces. |
2039 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent2, gfx::Rect(0, 0, 300, 300))); | 1930 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFrom
InsideTarget().ToString()); |
| 1931 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
| 1932 EXPECT_EQ(gfx::Rect(0, 0, 250, 300).ToString(), occlusion.unoccludedLaye
rContentRect(parent2, gfx::Rect(0, 0, 300, 300)).ToString()); |
2040 this->leaveLayer(parent2, occlusion); | 1933 this->leaveLayer(parent2, occlusion); |
2041 | 1934 |
2042 this->visitLayer(surfaceChild2, occlusion); | 1935 this->visitLayer(surfaceChild2, occlusion); |
2043 this->enterLayer(surfaceChild, occlusion); | 1936 this->enterLayer(surfaceChild, occlusion); |
2044 EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerCon
tentRect(surfaceChild, gfx::Rect(0, 0, 300, 300))); | 1937 EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
| 1938 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFrom
OutsideTarget().ToString()); |
| 1939 EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerCon
tentRect(surfaceChild, gfx::Rect(0, 0, 200, 300))); |
2045 this->leaveLayer(surfaceChild, occlusion); | 1940 this->leaveLayer(surfaceChild, occlusion); |
2046 this->enterLayer(surface, occlusion); | 1941 this->enterLayer(surface, occlusion); |
| 1942 EXPECT_EQ(gfx::Rect(0, 0, 200, 300).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
| 1943 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFrom
OutsideTarget().ToString()); |
2047 EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.unoccludedLayerCont
entRect(surface, gfx::Rect(0, 0, 300, 300))); | 1944 EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.unoccludedLayerCont
entRect(surface, gfx::Rect(0, 0, 300, 300))); |
2048 this->leaveLayer(surface, occlusion); | 1945 this->leaveLayer(surface, occlusion); |
2049 | 1946 |
2050 this->enterContributingSurface(surface, occlusion); | 1947 this->enterContributingSurface(surface, occlusion); |
2051 // Occlusion within the surface is lost when leaving the animating surfa
ce. | 1948 // Occlusion within the surface is lost when leaving the animating surfa
ce. |
| 1949 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget().
ToString()); |
| 1950 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
2052 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300))); | 1951 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300))); |
2053 this->leaveContributingSurface(surface, occlusion); | 1952 this->leaveContributingSurface(surface, occlusion); |
2054 | 1953 |
| 1954 // Occlusion from outside the animating surface still exists. |
| 1955 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFrom
InsideTarget().ToString()); |
| 1956 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
| 1957 |
2055 this->visitLayer(layer, occlusion); | 1958 this->visitLayer(layer, occlusion); |
2056 this->enterLayer(parent, occlusion); | 1959 this->enterLayer(parent, occlusion); |
2057 | 1960 |
2058 // Occlusion is not added for the animating |layer|. | 1961 // Occlusion is not added for the animating |layer|. |
2059 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(0, 0, 300, 300))); | 1962 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(0, 0, 300, 300))); |
2060 } | 1963 } |
2061 }; | 1964 }; |
2062 | 1965 |
2063 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread); | 1966 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread); |
2064 | 1967 |
(...skipping 17 matching lines...) Expand all Loading... |
2082 | 1985 |
2083 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 1986 EXPECT_TRUE(layer->drawOpacityIsAnimating()); |
2084 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 1987 EXPECT_FALSE(surface->drawOpacityIsAnimating()); |
2085 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); | 1988 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); |
2086 | 1989 |
2087 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1990 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2088 | 1991 |
2089 this->visitLayer(topmost, occlusion); | 1992 this->visitLayer(topmost, occlusion); |
2090 this->enterLayer(parent2, occlusion); | 1993 this->enterLayer(parent2, occlusion); |
2091 // This occlusion will affect all surfaces. | 1994 // This occlusion will affect all surfaces. |
| 1995 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFrom
InsideTarget().ToString()); |
| 1996 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
2092 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(0, 0, 300, 300))); | 1997 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(0, 0, 300, 300))); |
2093 this->leaveLayer(parent2, occlusion); | 1998 this->leaveLayer(parent2, occlusion); |
2094 | 1999 |
2095 this->visitLayer(surfaceChild2, occlusion); | 2000 this->visitLayer(surfaceChild2, occlusion); |
2096 this->enterLayer(surfaceChild, occlusion); | 2001 this->enterLayer(surfaceChild, occlusion); |
2097 EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerCon
tentRect(surfaceChild, gfx::Rect(0, 0, 300, 300))); | 2002 EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
| 2003 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFrom
OutsideTarget().ToString()); |
| 2004 EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerCon
tentRect(surfaceChild, gfx::Rect(0, 0, 200, 300))); |
2098 this->leaveLayer(surfaceChild, occlusion); | 2005 this->leaveLayer(surfaceChild, occlusion); |
2099 this->enterLayer(surface, occlusion); | 2006 this->enterLayer(surface, occlusion); |
| 2007 EXPECT_EQ(gfx::Rect(0, 0, 200, 300).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
| 2008 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFrom
OutsideTarget().ToString()); |
2100 EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.unoccludedLayerCont
entRect(surface, gfx::Rect(0, 0, 300, 300))); | 2009 EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.unoccludedLayerCont
entRect(surface, gfx::Rect(0, 0, 300, 300))); |
2101 this->leaveLayer(surface, occlusion); | 2010 this->leaveLayer(surface, occlusion); |
2102 | 2011 |
2103 this->enterContributingSurface(surface, occlusion); | 2012 this->enterContributingSurface(surface, occlusion); |
2104 // Occlusion within the surface is lost when leaving the animating surfa
ce. | 2013 // Occlusion within the surface is lost when leaving the animating surfa
ce. |
| 2014 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget().
ToString()); |
| 2015 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
2105 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300))); | 2016 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedContributi
ngSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300))); |
2106 this->leaveContributingSurface(surface, occlusion); | 2017 this->leaveContributingSurface(surface, occlusion); |
2107 | 2018 |
| 2019 // Occlusion from outside the animating surface still exists. |
| 2020 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFrom
InsideTarget().ToString()); |
| 2021 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
| 2022 |
2108 this->visitLayer(layer, occlusion); | 2023 this->visitLayer(layer, occlusion); |
2109 this->enterLayer(parent, occlusion); | 2024 this->enterLayer(parent, occlusion); |
2110 | 2025 |
2111 // Occlusion is not added for the animating |layer|. | 2026 // Occlusion is not added for the animating |layer|. |
2112 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(0, 0, 300, 300))); | 2027 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(0, 0, 300, 300))); |
2113 } | 2028 } |
2114 }; | 2029 }; |
2115 | 2030 |
2116 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread); | 2031 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread); |
2117 | 2032 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 2187 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
2273 void runMyTest() | 2188 void runMyTest() |
2274 { | 2189 { |
2275 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 2190 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2276 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2191 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2277 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); | 2192 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); |
2278 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 100), gfx::Size(100, 100), true); | 2193 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 100), gfx::Size(100, 100), true); |
2279 this->calcDrawEtc(parent); | 2194 this->calcDrawEtc(parent); |
2280 | 2195 |
2281 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2196 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2282 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2283 | 2197 |
2284 // |topmost| occludes the replica, but not the surface itself. | 2198 // |topmost| occludes the replica, but not the surface itself. |
2285 this->visitLayer(topmost, occlusion); | 2199 this->visitLayer(topmost, occlusion); |
2286 | 2200 |
2287 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 2201 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
2288 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusionFro
mInsideTarget().ToString()); | 2202 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusionFro
mInsideTarget().ToString()); |
2289 | 2203 |
2290 this->visitLayer(surface, occlusion); | 2204 this->visitLayer(surface, occlusion); |
2291 | 2205 |
2292 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusionFro
mOutsideTarget().ToString()); | 2206 EXPECT_EQ(gfx::Rect(0, 100, 100, 100).ToString(), occlusion.occlusionFro
mOutsideTarget().ToString()); |
(...skipping 14 matching lines...) Expand all Loading... |
2307 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 2221 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
2308 void runMyTest() | 2222 void runMyTest() |
2309 { | 2223 { |
2310 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 2224 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2311 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2225 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2312 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); | 2226 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); |
2313 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 110), true); | 2227 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 110), true); |
2314 this->calcDrawEtc(parent); | 2228 this->calcDrawEtc(parent); |
2315 | 2229 |
2316 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2230 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2317 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2318 | 2231 |
2319 // |topmost| occludes the surface, but not the entire surface's replica. | 2232 // |topmost| occludes the surface, but not the entire surface's replica. |
2320 this->visitLayer(topmost, occlusion); | 2233 this->visitLayer(topmost, occlusion); |
2321 | 2234 |
2322 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 2235 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
2323 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); | 2236 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionFromI
nsideTarget().ToString()); |
2324 | 2237 |
2325 this->visitLayer(surface, occlusion); | 2238 this->visitLayer(surface, occlusion); |
2326 | 2239 |
2327 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionFromO
utsideTarget().ToString()); | 2240 EXPECT_EQ(gfx::Rect(0, 0, 100, 110).ToString(), occlusion.occlusionFromO
utsideTarget().ToString()); |
(...skipping 16 matching lines...) Expand all Loading... |
2344 void runMyTest() | 2257 void runMyTest() |
2345 { | 2258 { |
2346 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); | 2259 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2347 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2260 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2348 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); | 2261 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); |
2349 typename Types::LayerType* overSurface = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(40, 100), true); | 2262 typename Types::LayerType* overSurface = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(40, 100), true); |
2350 typename Types::LayerType* overReplica = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 100), true); | 2263 typename Types::LayerType* overReplica = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 100), true); |
2351 this->calcDrawEtc(parent); | 2264 this->calcDrawEtc(parent); |
2352 | 2265 |
2353 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2266 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2354 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2355 | 2267 |
2356 // These occlude the surface and replica differently, so we can test eac
h one. | 2268 // These occlude the surface and replica differently, so we can test eac
h one. |
2357 this->visitLayer(overReplica, occlusion); | 2269 this->visitLayer(overReplica, occlusion); |
2358 this->visitLayer(overSurface, occlusion); | 2270 this->visitLayer(overSurface, occlusion); |
2359 | 2271 |
2360 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 2272 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
2361 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 1
00)).ToString(), occlusion.occlusionFromInsideTarget().ToString()); | 2273 EXPECT_EQ(UnionRegions(gfx::Rect(0, 0, 40, 100), gfx::Rect(0, 100, 50, 1
00)).ToString(), occlusion.occlusionFromInsideTarget().ToString()); |
2362 | 2274 |
2363 this->visitLayer(surface, occlusion); | 2275 this->visitLayer(surface, occlusion); |
2364 | 2276 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2477 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. | 2389 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. |
2478 | 2390 |
2479 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(80, 200)); | 2391 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(80, 200)); |
2480 parent->setMasksToBounds(true); | 2392 parent->setMasksToBounds(true); |
2481 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2393 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2482 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2394 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2483 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); | 2395 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); |
2484 this->calcDrawEtc(parent); | 2396 this->calcDrawEtc(parent); |
2485 | 2397 |
2486 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2398 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2487 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2488 | 2399 |
2489 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2400 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
2490 this->visitLayer(topmost, occlusion); | 2401 this->visitLayer(topmost, occlusion); |
2491 | 2402 |
2492 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 2403 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
2493 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), occlusion.occlusionFromIns
ideTarget().ToString()); | 2404 EXPECT_EQ(gfx::Rect(0, 0, 80, 50).ToString(), occlusion.occlusionFromIns
ideTarget().ToString()); |
2494 | 2405 |
2495 // surfaceChild is not opaque and does not occlude, so we have a non-emp
ty unoccluded area on surface. | 2406 // surfaceChild is not opaque and does not occlude, so we have a non-emp
ty unoccluded area on surface. |
2496 this->visitLayer(surfaceChild, occlusion); | 2407 this->visitLayer(surfaceChild, occlusion); |
2497 | 2408 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 filters.append(WebKit::WebFilterOperation::createBlurFilter(10)); | 2453 filters.append(WebKit::WebFilterOperation::createBlurFilter(10)); |
2543 filteredSurface->setBackgroundFilters(filters); | 2454 filteredSurface->setBackgroundFilters(filters); |
2544 | 2455 |
2545 // Save the distance of influence for the blur effect. | 2456 // Save the distance of influence for the blur effect. |
2546 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2457 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2547 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2458 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2548 | 2459 |
2549 this->calcDrawEtc(parent); | 2460 this->calcDrawEtc(parent); |
2550 | 2461 |
2551 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2462 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2552 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2553 | 2463 |
2554 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2464 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
2555 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. | 2465 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. |
2556 this->visitLayer(occludingLayer5, occlusion); | 2466 this->visitLayer(occludingLayer5, occlusion); |
2557 this->visitLayer(occludingLayer4, occlusion); | 2467 this->visitLayer(occludingLayer4, occlusion); |
2558 this->visitLayer(occludingLayer3, occlusion); | 2468 this->visitLayer(occludingLayer3, occlusion); |
2559 this->visitLayer(occludingLayer2, occlusion); | 2469 this->visitLayer(occludingLayer2, occlusion); |
2560 this->visitLayer(occludingLayer1, occlusion); | 2470 this->visitLayer(occludingLayer1, occlusion); |
2561 | 2471 |
2562 Region expectedOcclusion; | 2472 Region expectedOcclusion; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 filteredSurface1->setBackgroundFilters(filters); | 2576 filteredSurface1->setBackgroundFilters(filters); |
2667 filteredSurface2->setBackgroundFilters(filters); | 2577 filteredSurface2->setBackgroundFilters(filters); |
2668 | 2578 |
2669 // Save the distance of influence for the blur effect. | 2579 // Save the distance of influence for the blur effect. |
2670 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2580 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2671 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2581 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2672 | 2582 |
2673 this->calcDrawEtc(root); | 2583 this->calcDrawEtc(root); |
2674 | 2584 |
2675 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2585 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2676 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2677 | 2586 |
2678 this->visitLayer(occludingLayerAbove, occlusion); | 2587 this->visitLayer(occludingLayerAbove, occlusion); |
2679 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 2588 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
2680 EXPECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2).ToString(), occlus
ion.occlusionFromInsideTarget().ToString()); | 2589 EXPECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2).ToString(), occlus
ion.occlusionFromInsideTarget().ToString()); |
2681 | 2590 |
2682 this->visitLayer(filteredSurface2, occlusion); | 2591 this->visitLayer(filteredSurface2, occlusion); |
2683 this->visitContributingSurface(filteredSurface2, occlusion); | 2592 this->visitContributingSurface(filteredSurface2, occlusion); |
2684 this->visitLayer(filteredSurface1, occlusion); | 2593 this->visitLayer(filteredSurface1, occlusion); |
2685 this->visitContributingSurface(filteredSurface1, occlusion); | 2594 this->visitContributingSurface(filteredSurface1, occlusion); |
2686 | 2595 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2720 filters.append(WebKit::WebFilterOperation::createBlurFilter(12)); | 2629 filters.append(WebKit::WebFilterOperation::createBlurFilter(12)); |
2721 filteredSurface->setBackgroundFilters(filters); | 2630 filteredSurface->setBackgroundFilters(filters); |
2722 | 2631 |
2723 // Save the distance of influence for the blur effect. | 2632 // Save the distance of influence for the blur effect. |
2724 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2633 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2725 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2634 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2726 | 2635 |
2727 this->calcDrawEtc(parent); | 2636 this->calcDrawEtc(parent); |
2728 | 2637 |
2729 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2638 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2730 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2731 | 2639 |
2732 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2640 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
2733 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. | 2641 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. |
2734 this->visitLayer(occludingLayer5, occlusion); | 2642 this->visitLayer(occludingLayer5, occlusion); |
2735 this->visitLayer(occludingLayer4, occlusion); | 2643 this->visitLayer(occludingLayer4, occlusion); |
2736 this->visitLayer(occludingLayer3, occlusion); | 2644 this->visitLayer(occludingLayer3, occlusion); |
2737 this->visitLayer(occludingLayer2, occlusion); | 2645 this->visitLayer(occludingLayer2, occlusion); |
2738 this->visitLayer(occludingLayer1, occlusion); | 2646 this->visitLayer(occludingLayer1, occlusion); |
2739 | 2647 |
2740 Region expectedOcclusion; | 2648 Region expectedOcclusion; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2849 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2757 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
2850 | 2758 |
2851 // Filters make the layer own a surface. | 2759 // Filters make the layer own a surface. |
2852 WebKit::WebFilterOperations filters; | 2760 WebKit::WebFilterOperations filters; |
2853 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); | 2761 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
2854 filteredSurface->setBackgroundFilters(filters); | 2762 filteredSurface->setBackgroundFilters(filters); |
2855 | 2763 |
2856 this->calcDrawEtc(parent); | 2764 this->calcDrawEtc(parent); |
2857 | 2765 |
2858 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2766 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2859 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2860 | 2767 |
2861 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 2768 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
2862 this->visitLayer(filteredSurface, occlusion); | 2769 this->visitLayer(filteredSurface, occlusion); |
2863 this->visitContributingSurface(filteredSurface, occlusion); | 2770 this->visitContributingSurface(filteredSurface, occlusion); |
2864 | 2771 |
2865 this->visitLayer(behindReplicaLayer, occlusion); | 2772 this->visitLayer(behindReplicaLayer, occlusion); |
2866 this->visitLayer(behindSurfaceLayer, occlusion); | 2773 this->visitLayer(behindSurfaceLayer, occlusion); |
2867 | 2774 |
2868 // The layers behind the surface are not blurred, and their occlusion do
es not change, until we leave the surface. | 2775 // The layers behind the surface are not blurred, and their occlusion do
es not change, until we leave the surface. |
2869 // So it should not be modified by the filter here. | 2776 // So it should not be modified by the filter here. |
(...skipping 28 matching lines...) Expand all Loading... |
2898 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); | 2805 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); |
2899 | 2806 |
2900 // Filters make the layer own a surface. | 2807 // Filters make the layer own a surface. |
2901 WebKit::WebFilterOperations filters; | 2808 WebKit::WebFilterOperations filters; |
2902 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); | 2809 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
2903 filteredSurface->setBackgroundFilters(filters); | 2810 filteredSurface->setBackgroundFilters(filters); |
2904 | 2811 |
2905 this->calcDrawEtc(parent); | 2812 this->calcDrawEtc(parent); |
2906 | 2813 |
2907 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2814 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2908 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2909 | 2815 |
2910 this->visitLayer(aboveReplicaLayer, occlusion); | 2816 this->visitLayer(aboveReplicaLayer, occlusion); |
2911 this->visitLayer(aboveSurfaceLayer, occlusion); | 2817 this->visitLayer(aboveSurfaceLayer, occlusion); |
2912 | 2818 |
2913 this->visitLayer(filteredSurface, occlusion); | 2819 this->visitLayer(filteredSurface, occlusion); |
2914 | 2820 |
2915 { | 2821 { |
2916 // The layers above the filtered surface occlude from outside. | 2822 // The layers above the filtered surface occlude from outside. |
2917 gfx::Rect occlusionAboveSurface = gfx::Rect(0, 0, 50, 50); | 2823 gfx::Rect occlusionAboveSurface = gfx::Rect(0, 0, 50, 50); |
2918 gfx::Rect occlusionAboveReplica = gfx::Rect(150, 0, 50, 50); | 2824 gfx::Rect occlusionAboveReplica = gfx::Rect(150, 0, 50, 50); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); | 2870 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
2965 filteredSurface->setBackgroundFilters(filters); | 2871 filteredSurface->setBackgroundFilters(filters); |
2966 | 2872 |
2967 // Save the distance of influence for the blur effect. | 2873 // Save the distance of influence for the blur effect. |
2968 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2874 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2969 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2875 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2970 | 2876 |
2971 this->calcDrawEtc(parent); | 2877 this->calcDrawEtc(parent); |
2972 | 2878 |
2973 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2879 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2974 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
2975 | 2880 |
2976 this->visitLayer(besideReplicaLayer, occlusion); | 2881 this->visitLayer(besideReplicaLayer, occlusion); |
2977 this->visitLayer(besideSurfaceLayer, occlusion); | 2882 this->visitLayer(besideSurfaceLayer, occlusion); |
2978 this->visitLayer(aboveReplicaLayer, occlusion); | 2883 this->visitLayer(aboveReplicaLayer, occlusion); |
2979 this->visitLayer(aboveSurfaceLayer, occlusion); | 2884 this->visitLayer(aboveSurfaceLayer, occlusion); |
2980 | 2885 |
2981 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 2886 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
2982 this->visitLayer(filteredSurface, occlusion); | 2887 this->visitLayer(filteredSurface, occlusion); |
2983 this->visitContributingSurface(filteredSurface, occlusion); | 2888 this->visitContributingSurface(filteredSurface, occlusion); |
2984 | 2889 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 { | 2924 { |
3020 gfx::Size trackingSize(100, 100); | 2925 gfx::Size trackingSize(100, 100); |
3021 gfx::Size belowTrackingSize(99, 99); | 2926 gfx::Size belowTrackingSize(99, 99); |
3022 | 2927 |
3023 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); | 2928 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); |
3024 typename Types::LayerType* large = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), trackingSize, true); | 2929 typename Types::LayerType* large = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), trackingSize, true); |
3025 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), belowTrackingSize, true); | 2930 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), belowTrackingSize, true); |
3026 this->calcDrawEtc(parent); | 2931 this->calcDrawEtc(parent); |
3027 | 2932 |
3028 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2933 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
3029 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | |
3030 occlusion.setMinimumTrackingSize(trackingSize); | 2934 occlusion.setMinimumTrackingSize(trackingSize); |
3031 | 2935 |
3032 // The small layer is not tracked because it is too small. | 2936 // The small layer is not tracked because it is too small. |
3033 this->visitLayer(small, occlusion); | 2937 this->visitLayer(small, occlusion); |
3034 | 2938 |
3035 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); | 2939 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget()
.ToString()); |
3036 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget().
ToString()); | 2940 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget().
ToString()); |
3037 | 2941 |
3038 // The large layer is tracked as it is large enough. | 2942 // The large layer is tracked as it is large enough. |
3039 this->visitLayer(large, occlusion); | 2943 this->visitLayer(large, occlusion); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 hasOcclusionFromOutsideTargetSurface = false; | 3050 hasOcclusionFromOutsideTargetSurface = false; |
3147 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.unoccludedContributing
SurfaceContentRect(smaller, false, gfx::Rect(0, 0, 100, 100), &hasOcclusionFromO
utsideTargetSurface)); | 3051 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.unoccludedContributing
SurfaceContentRect(smaller, false, gfx::Rect(0, 0, 100, 100), &hasOcclusionFromO
utsideTargetSurface)); |
3148 EXPECT_FALSE(hasOcclusionFromOutsideTargetSurface); | 3052 EXPECT_FALSE(hasOcclusionFromOutsideTargetSurface); |
3149 } | 3053 } |
3150 }; | 3054 }; |
3151 | 3055 |
3152 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) | 3056 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) |
3153 | 3057 |
3154 } // namespace | 3058 } // namespace |
3155 } // namespace cc | 3059 } // namespace cc |
OLD | NEW |