| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCOcclusionTracker.h" | 7 #include "CCOcclusionTracker.h" |
| 8 | 8 |
| 9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
| 10 #include "CCGeometryTestUtils.h" | 10 #include "CCGeometryTestUtils.h" |
| 11 #include "CCLayerAnimationController.h" | 11 #include "CCLayerAnimationController.h" |
| 12 #include "CCLayerImpl.h" | |
| 13 #include "CCLayerTreeHostCommon.h" | 12 #include "CCLayerTreeHostCommon.h" |
| 14 #include "CCMathUtil.h" | 13 #include "CCMathUtil.h" |
| 15 #include "CCOcclusionTrackerTestCommon.h" | 14 #include "CCOcclusionTrackerTestCommon.h" |
| 16 #include "CCOverdrawMetrics.h" | 15 #include "CCOverdrawMetrics.h" |
| 17 #include "CCSingleThreadProxy.h" | 16 #include "CCSingleThreadProxy.h" |
| 18 #include "LayerChromium.h" | 17 #include "CCTiledLayerImpl.h" |
| 19 #include "Region.h" | 18 #include "Region.h" |
| 19 #include "TiledLayerChromium.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include <public/WebFilterOperation.h> | 22 #include <public/WebFilterOperation.h> |
| 23 #include <public/WebFilterOperations.h> | 23 #include <public/WebFilterOperations.h> |
| 24 #include <public/WebTransformationMatrix.h> | 24 #include <public/WebTransformationMatrix.h> |
| 25 | 25 |
| 26 using namespace cc; | 26 using namespace cc; |
| 27 using namespace WebKit; | 27 using namespace WebKit; |
| 28 using namespace WebKitTests; | 28 using namespace WebKitTests; |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 class TestContentLayerChromium : public LayerChromium { | 32 class TestContentLayerChromium : public TiledLayerChromium { |
| 33 public: | 33 public: |
| 34 TestContentLayerChromium() | 34 TestContentLayerChromium() |
| 35 : LayerChromium() | 35 : TiledLayerChromium() |
| 36 , m_overrideOpaqueContentsRect(false) | 36 , m_overrideOpaqueContentsRect(false) |
| 37 { | 37 { |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual bool drawsContent() const OVERRIDE { return true; } | 40 virtual bool drawsContent() const OVERRIDE { return true; } |
| 41 virtual Region visibleContentOpaqueRegion() const OVERRIDE | 41 virtual Region visibleContentOpaqueRegion() const OVERRIDE |
| 42 { | 42 { |
| 43 if (m_overrideOpaqueContentsRect) | 43 if (m_overrideOpaqueContentsRect) |
| 44 return intersection(m_opaqueContentsRect, visibleContentRect()); | 44 return intersection(m_opaqueContentsRect, visibleContentRect()); |
| 45 return LayerChromium::visibleContentOpaqueRegion(); | 45 return LayerChromium::visibleContentOpaqueRegion(); |
| 46 } | 46 } |
| 47 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) | 47 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) |
| 48 { | 48 { |
| 49 m_overrideOpaqueContentsRect = true; | 49 m_overrideOpaqueContentsRect = true; |
| 50 m_opaqueContentsRect = opaqueContentsRect; | 50 m_opaqueContentsRect = opaqueContentsRect; |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual LayerTextureUpdater* textureUpdater() const OVERRIDE { return 0; } |
| 54 virtual void createTextureUpdaterIfNeeded() OVERRIDE { } |
| 55 |
| 53 private: | 56 private: |
| 54 virtual ~TestContentLayerChromium() | 57 virtual ~TestContentLayerChromium() |
| 55 { | 58 { |
| 56 } | 59 } |
| 57 | 60 |
| 58 bool m_overrideOpaqueContentsRect; | 61 bool m_overrideOpaqueContentsRect; |
| 59 IntRect m_opaqueContentsRect; | 62 IntRect m_opaqueContentsRect; |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 class TestContentLayerImpl : public CCLayerImpl { | 65 class TestContentLayerImpl : public CCTiledLayerImpl { |
| 63 public: | 66 public: |
| 64 TestContentLayerImpl(int id) | 67 TestContentLayerImpl(int id) |
| 65 : CCLayerImpl(id) | 68 : CCTiledLayerImpl(id) |
| 66 , m_overrideOpaqueContentsRect(false) | 69 , m_overrideOpaqueContentsRect(false) |
| 67 { | 70 { |
| 68 setDrawsContent(true); | 71 setDrawsContent(true); |
| 69 } | 72 } |
| 70 | 73 |
| 71 virtual Region visibleContentOpaqueRegion() const OVERRIDE | 74 virtual Region visibleContentOpaqueRegion() const OVERRIDE |
| 72 { | 75 { |
| 73 if (m_overrideOpaqueContentsRect) | 76 if (m_overrideOpaqueContentsRect) |
| 74 return intersection(m_opaqueContentsRect, visibleContentRect()); | 77 return intersection(m_opaqueContentsRect, visibleContentRect()); |
| 75 return CCLayerImpl::visibleContentOpaqueRegion(); | 78 return CCLayerImpl::visibleContentOpaqueRegion(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 266 } |
| 264 | 267 |
| 265 void calcDrawEtc(TestContentLayerImpl* root) | 268 void calcDrawEtc(TestContentLayerImpl* root) |
| 266 { | 269 { |
| 267 ASSERT(root == m_root.get()); | 270 ASSERT(root == m_root.get()); |
| 268 int dummyMaxTextureSize = 512; | 271 int dummyMaxTextureSize = 512; |
| 269 CCLayerSorter layerSorter; | 272 CCLayerSorter layerSorter; |
| 270 | 273 |
| 271 ASSERT(!root->renderSurface()); | 274 ASSERT(!root->renderSurface()); |
| 272 | 275 |
| 273 CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1,
&layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); | 276 CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1,
1, &layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); |
| 274 | 277 |
| 275 m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_
renderSurfaceLayerListImpl); | 278 m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_
renderSurfaceLayerListImpl); |
| 276 } | 279 } |
| 277 | 280 |
| 278 void calcDrawEtc(TestContentLayerChromium* root) | 281 void calcDrawEtc(TestContentLayerChromium* root) |
| 279 { | 282 { |
| 280 ASSERT(root == m_root.get()); | 283 ASSERT(root == m_root.get()); |
| 281 int dummyMaxTextureSize = 512; | 284 int dummyMaxTextureSize = 512; |
| 282 | 285 |
| 283 ASSERT(!root->renderSurface()); | 286 ASSERT(!root->renderSurface()); |
| 284 | 287 |
| 285 CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1,
dummyMaxTextureSize, m_renderSurfaceLayerListChromium); | 288 CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1,
1, dummyMaxTextureSize, m_renderSurfaceLayerListChromium); |
| 286 | 289 |
| 287 m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_
renderSurfaceLayerListChromium); | 290 m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_
renderSurfaceLayerListChromium); |
| 288 } | 291 } |
| 289 | 292 |
| 290 void enterLayer(typename Types::LayerType* layer, typename Types::OcclusionT
rackerType& occlusion) | 293 void enterLayer(typename Types::LayerType* layer, typename Types::OcclusionT
rackerType& occlusion) |
| 291 { | 294 { |
| 292 ASSERT_EQ(layer, *m_layerIterator); | 295 ASSERT_EQ(layer, *m_layerIterator); |
| 293 ASSERT_TRUE(m_layerIterator.representsItself()); | 296 ASSERT_TRUE(m_layerIterator.representsItself()); |
| 294 occlusion.enterLayer(m_layerIterator); | 297 occlusion.enterLayer(m_layerIterator); |
| 295 } | 298 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 }; \ | 426 }; \ |
| 424 TEST_F(ClassName##ImplThreadOpaquePaints, runTest) { runMyTest(); } | 427 TEST_F(ClassName##ImplThreadOpaquePaints, runTest) { runMyTest(); } |
| 425 | 428 |
| 426 #define ALL_CCOCCLUSIONTRACKER_TEST(ClassName) \ | 429 #define ALL_CCOCCLUSIONTRACKER_TEST(ClassName) \ |
| 427 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ | 430 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 428 RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ | 431 RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ |
| 429 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ | 432 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 430 RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) | 433 RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) |
| 431 | 434 |
| 432 #define MAIN_THREAD_TEST(ClassName) \ | 435 #define MAIN_THREAD_TEST(ClassName) \ |
| 433 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) | 436 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 437 RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) |
| 434 | 438 |
| 435 #define IMPL_THREAD_TEST(ClassName) \ | 439 #define IMPL_THREAD_TEST(ClassName) \ |
| 436 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) | 440 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 441 RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) |
| 437 | 442 |
| 438 #define MAIN_AND_IMPL_THREAD_TEST(ClassName) \ | 443 #define MAIN_AND_IMPL_THREAD_TEST(ClassName) \ |
| 439 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ | 444 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 440 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) | 445 RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ |
| 446 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 447 RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) |
| 441 | 448 |
| 442 template<class Types, bool opaqueLayers> | 449 template<class Types, bool opaqueLayers> |
| 443 class CCOcclusionTrackerTestIdentityTransforms : public CCOcclusionTrackerTest<T
ypes, opaqueLayers> { | 450 class CCOcclusionTrackerTestIdentityTransforms : public CCOcclusionTrackerTest<T
ypes, opaqueLayers> { |
| 444 protected: | 451 protected: |
| 445 void runMyTest() | 452 void runMyTest() |
| 446 { | 453 { |
| 447 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 454 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 448 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); | 455 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); |
| 449 this->calcDrawEtc(parent); | 456 this->calcDrawEtc(parent); |
| 450 | 457 |
| (...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2194 void runMyTest() | 2201 void runMyTest() |
| 2195 { | 2202 { |
| 2196 WebTransformationMatrix surfaceTransform; | 2203 WebTransformationMatrix surfaceTransform; |
| 2197 surfaceTransform.translate(300, 300); | 2204 surfaceTransform.translate(300, 300); |
| 2198 surfaceTransform.scale(2); | 2205 surfaceTransform.scale(2); |
| 2199 surfaceTransform.translate(-150, -150); | 2206 surfaceTransform.translate(-150, -150); |
| 2200 | 2207 |
| 2201 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(500, 500)); | 2208 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(500, 500)); |
| 2202 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false); | 2209 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false); |
| 2203 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false); | 2210 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false); |
| 2204 surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); | 2211 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 400)); |
| 2205 surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); | 2212 surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); |
| 2206 this->calcDrawEtc(parent); | 2213 this->calcDrawEtc(parent); |
| 2207 | 2214 |
| 2208 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2215 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2209 | 2216 |
| 2210 this->visitLayer(surface2, occlusion); | 2217 this->visitLayer(surface2, occlusion); |
| 2211 this->visitContributingSurface(surface2, occlusion); | 2218 this->visitContributingSurface(surface2, occlusion); |
| 2212 | 2219 |
| 2213 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpa
ce().bounds()); | 2220 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpa
ce().bounds()); |
| 2214 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2221 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2215 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSur
face().bounds()); | 2222 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSur
face().bounds()); |
| 2216 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2223 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2217 | 2224 |
| 2218 // Clear any stored occlusion. | 2225 // Clear any stored occlusion. |
| 2219 occlusion.setOcclusionInScreenSpace(Region()); | 2226 occlusion.setOcclusionInScreenSpace(Region()); |
| 2220 occlusion.setOcclusionInTargetSurface(Region()); | 2227 occlusion.setOcclusionInTargetSurface(Region()); |
| 2221 | 2228 |
| 2222 this->visitLayer(surface, occlusion); | 2229 this->visitLayer(surface, occlusion); |
| 2223 this->visitContributingSurface(surface, occlusion); | 2230 this->visitContributingSurface(surface, occlusion); |
| 2224 | 2231 |
| 2225 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace
().bounds()); | 2232 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace
().bounds()); |
| 2226 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2233 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2227 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2234 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2228 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2235 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2229 } | 2236 } |
| 2230 }; | 2237 }; |
| 2231 | 2238 |
| 2232 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToPare
nt); | 2239 // Scale transforms require main thread+commit to get contentBounds right. |
| 2240 MAIN_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent); |
| 2233 | 2241 |
| 2234 template<class Types, bool opaqueLayers> | 2242 template<class Types, bool opaqueLayers> |
| 2235 class CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public CCOc
clusionTrackerTest<Types, opaqueLayers> { | 2243 class CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public CCOc
clusionTrackerTest<Types, opaqueLayers> { |
| 2236 protected: | 2244 protected: |
| 2237 void runMyTest() | 2245 void runMyTest() |
| 2238 { | 2246 { |
| 2239 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 2247 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 2240 parent->setMasksToBounds(true); | 2248 parent->setMasksToBounds(true); |
| 2241 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); | 2249 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); |
| 2242 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); | 2250 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2564 this->visitLayer(occludingLayer2, occlusion); | 2572 this->visitLayer(occludingLayer2, occlusion); |
| 2565 this->visitLayer(occludingLayer1, occlusion); | 2573 this->visitLayer(occludingLayer1, occlusion); |
| 2566 | 2574 |
| 2567 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); | 2575 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2568 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2576 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2569 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2577 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2570 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); | 2578 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2571 | 2579 |
| 2572 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. | 2580 // Everything outside the surface/replica is occluded but the surface/re
plica itself is not. |
| 2573 this->enterLayer(filteredSurface, occlusion); | 2581 this->enterLayer(filteredSurface, occlusion); |
| 2574 EXPECT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(f
ilteredSurface, IntRect(1, 0, 100, 100))); | 2582 EXPECT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(fi
lteredSurface, IntRect(1, 0, 50, 50))); |
| 2575 EXPECT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(f
ilteredSurface, IntRect(0, 1, 100, 100))); | 2583 EXPECT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(fi
lteredSurface, IntRect(0, 1, 50, 50))); |
| 2576 EXPECT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(f
ilteredSurface, IntRect(-1, 0, 100, 100))); | 2584 EXPECT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(fi
lteredSurface, IntRect(-1, 0, 50, 50))); |
| 2577 EXPECT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(f
ilteredSurface, IntRect(0, -1, 100, 100))); | 2585 EXPECT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(fi
lteredSurface, IntRect(0, -1, 50, 50))); |
| 2578 | 2586 |
| 2579 EXPECT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContent
Rect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); | 2587 EXPECT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentR
ect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); |
| 2580 EXPECT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContent
Rect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); | 2588 EXPECT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentR
ect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); |
| 2581 EXPECT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContent
Rect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); | 2589 EXPECT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentR
ect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); |
| 2582 EXPECT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContent
Rect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); | 2590 EXPECT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentR
ect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); |
| 2583 this->leaveLayer(filteredSurface, occlusion); | 2591 this->leaveLayer(filteredSurface, occlusion); |
| 2584 | 2592 |
| 2585 // The filtered layer/replica does not occlude. | 2593 // The filtered layer/replica does not occlude. |
| 2586 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); | 2594 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2587 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2595 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2588 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface()
.bounds()); | 2596 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface()
.bounds()); |
| 2589 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2597 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2590 | 2598 |
| 2591 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels | 2599 // The surface has a background blur, so it needs pixels that are curren
tly considered occluded in order to be drawn. So the pixels |
| 2592 // it needs should be removed some the occluded area so that when we get
to the parent they are drawn. | 2600 // it needs should be removed from the occluded area so that when we get
to the parent they are drawn. |
| 2593 this->visitContributingSurface(filteredSurface, occlusion); | 2601 this->visitContributingSurface(filteredSurface, occlusion); |
| 2594 | 2602 |
| 2595 this->enterLayer(parent, occlusion); | 2603 this->enterLayer(parent, occlusion); |
| 2596 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); | 2604 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace
().bounds()); |
| 2597 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); | 2605 EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2598 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2606 EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2599 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); | 2607 EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2600 | 2608 |
| 2601 IntRect outsetRect; | 2609 IntRect outsetRect; |
| 2602 IntRect testRect; | 2610 IntRect testRect; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2638 testRect.move(-1, 0); | 2646 testRect.move(-1, 0); |
| 2639 testRect.expand(1, 0); | 2647 testRect.expand(1, 0); |
| 2640 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); | 2648 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2641 testRect = outsetRect; | 2649 testRect = outsetRect; |
| 2642 testRect.move(0, -1); | 2650 testRect.move(0, -1); |
| 2643 testRect.expand(0, 1); | 2651 testRect.expand(0, 1); |
| 2644 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); | 2652 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2645 } | 2653 } |
| 2646 }; | 2654 }; |
| 2647 | 2655 |
| 2648 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBack
groundFilter); | 2656 // Scale transforms require main thread+commit to get contentBounds right. |
| 2657 MAIN_THREAD_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilte
r); |
| 2649 | 2658 |
| 2650 template<class Types, bool opaqueLayers> | 2659 template<class Types, bool opaqueLayers> |
| 2651 class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CC
OcclusionTrackerTest<Types, opaqueLayers> { | 2660 class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CC
OcclusionTrackerTest<Types, opaqueLayers> { |
| 2652 protected: | 2661 protected: |
| 2653 void runMyTest() | 2662 void runMyTest() |
| 2654 { | 2663 { |
| 2655 WebTransformationMatrix scaleByHalf; | 2664 WebTransformationMatrix scaleByHalf; |
| 2656 scaleByHalf.scale(0.5); | 2665 scaleByHalf.scale(0.5); |
| 2657 | 2666 |
| 2658 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. | 2667 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. |
| 2659 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, FloatPoint(0, 0), IntSize(75, 75)); | 2668 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, FloatPoint(0, 0), IntSize(150, 150)); |
| 2660 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, FloatPoint(0, 0), IntSize(150, 150)); | 2669 typename Types::LayerType* parent = this->createDrawingSurface(root, sca
leByHalf, FloatPoint(0, 0), IntSize(300, 300), false); |
| 2661 parent->setMasksToBounds(true); | 2670 parent->setMasksToBounds(true); |
| 2662 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); | 2671 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), IntSize(600, 600), false); |
| 2663 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); | 2672 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), IntSize(600, 600), false); |
| 2664 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(50, 50), true); | 2673 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, FloatPoint(200, 200), IntSize(100, 100), true); |
| 2665 | 2674 |
| 2666 // Filters make the layers own surfaces. | 2675 // Filters make the layers own surfaces. |
| 2667 WebFilterOperations filters; | 2676 WebFilterOperations filters; |
| 2668 filters.append(WebFilterOperation::createBlurFilter(3)); | 2677 filters.append(WebFilterOperation::createBlurFilter(3)); |
| 2669 filteredSurface1->setBackgroundFilters(filters); | 2678 filteredSurface1->setBackgroundFilters(filters); |
| 2670 filteredSurface2->setBackgroundFilters(filters); | 2679 filteredSurface2->setBackgroundFilters(filters); |
| 2671 | 2680 |
| 2672 // Save the distance of influence for the blur effect. | 2681 // Save the distance of influence for the blur effect. |
| 2673 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2682 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2674 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2683 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2675 | 2684 |
| 2676 this->calcDrawEtc(root); | 2685 this->calcDrawEtc(root); |
| 2677 | 2686 |
| 2678 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2687 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2679 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2688 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2680 | 2689 |
| 2681 this->visitLayer(occludingLayerAbove, occlusion); | 2690 this->visitLayer(occludingLayerAbove, occlusion); |
| 2682 EXPECT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occl
usionInScreenSpace().bounds()); | 2691 EXPECT_RECT_EQ(IntRect(200 / 2, 200 / 2, 100 / 2, 100 / 2), occlusion.oc
clusionInScreenSpace().bounds()); |
| 2683 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2692 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2684 EXPECT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 2693 EXPECT_RECT_EQ(IntRect(200 / 2, 200 / 2, 100 / 2, 100 / 2), occlusion.oc
clusionInTargetSurface().bounds()); |
| 2685 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2694 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2686 | 2695 |
| 2687 this->visitLayer(filteredSurface2, occlusion); | 2696 this->visitLayer(filteredSurface2, occlusion); |
| 2688 this->visitContributingSurface(filteredSurface2, occlusion); | 2697 this->visitContributingSurface(filteredSurface2, occlusion); |
| 2689 this->visitLayer(filteredSurface1, occlusion); | 2698 this->visitLayer(filteredSurface1, occlusion); |
| 2690 this->visitContributingSurface(filteredSurface1, occlusion); | 2699 this->visitContributingSurface(filteredSurface1, occlusion); |
| 2691 | 2700 |
| 2692 ASSERT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2701 ASSERT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2693 ASSERT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2702 ASSERT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2694 | 2703 |
| 2695 // Test expectations in the target. | 2704 // Test expectations in the target. The target is scaled in half so the
occlusion should be scaled within its contents as well. |
| 2696 IntRect expectedOcclusion = IntRect(100 + outsetRight * 2, 100 + outsetB
ottom * 2, 50 - (outsetLeft + outsetRight) * 2, 50 - (outsetTop + outsetBottom)
* 2); | 2705 IntRect expectedOcclusion = IntRect(200 / 2 + outsetRight * 2, 200 / 2 +
outsetBottom * 2, 100 / 2 - (outsetLeft + outsetRight) * 2, 100 / 2 - (outsetTo
p + outsetBottom) * 2); |
| 2697 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().r
ects()[0]); | 2706 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().r
ects()[0]); |
| 2698 | 2707 |
| 2699 // Test expectations in the screen. Take the ceiling of half of the outs
ets. | 2708 // Test expectations in the screen. The parent is scaled in half so it w
ill scale the occlusion to the screen as well. |
| 2700 outsetTop = (outsetTop + 1) / 2; | 2709 expectedOcclusion = IntRect(200 / 2 + outsetRight * 2, 200 / 2 + outsetB
ottom * 2, 100 / 2 - (outsetLeft + outsetRight) * 2, 100 / 2 - (outsetTop + outs
etBottom) * 2); |
| 2701 outsetRight = (outsetRight + 1) / 2; | |
| 2702 outsetBottom = (outsetBottom + 1) / 2; | |
| 2703 outsetLeft = (outsetLeft + 1) / 2; | |
| 2704 expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetB
ottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetB
ottom) * 2); | |
| 2705 | |
| 2706 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rec
ts()[0]); | 2710 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rec
ts()[0]); |
| 2707 } | 2711 } |
| 2708 }; | 2712 }; |
| 2709 | 2713 |
| 2710 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTwoBackgroundFiltersReduceOccl
usionTwice); | 2714 // Scale transforms require main thread+commit to get contentBounds right. |
| 2715 MAIN_THREAD_TEST(CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice)
; |
| 2711 | 2716 |
| 2712 template<class Types, bool opaqueLayers> | 2717 template<class Types, bool opaqueLayers> |
| 2713 class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip :
public CCOcclusionTrackerTest<Types, opaqueLayers> { | 2718 class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip :
public CCOcclusionTrackerTest<Types, opaqueLayers> { |
| 2714 protected: | 2719 protected: |
| 2715 void runMyTest() | 2720 void runMyTest() |
| 2716 { | 2721 { |
| 2717 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. | 2722 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. |
| 2718 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); | 2723 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); |
| 2719 // We stick the filtered surface inside a clipping surface so that we ca
n make sure the clip is honored when exposing pixels for | 2724 // We stick the filtered surface inside a clipping surface so that we ca
n make sure the clip is honored when exposing pixels for |
| 2720 // the background filter. | 2725 // the background filter. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2874 IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); | 2879 IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); |
| 2875 | 2880 |
| 2876 IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusi
onBehindReplica); | 2881 IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusi
onBehindReplica); |
| 2877 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); | 2882 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); |
| 2878 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2883 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2879 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); | 2884 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); |
| 2880 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2885 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2881 } | 2886 } |
| 2882 }; | 2887 }; |
| 2883 | 2888 |
| 2884 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionBelowBackgr
oundFilter); | 2889 // Scale transforms require main thread+commit to get contentBounds right. |
| 2890 MAIN_THREAD_TEST(CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter)
; |
| 2885 | 2891 |
| 2886 template<class Types, bool opaqueLayers> | 2892 template<class Types, bool opaqueLayers> |
| 2887 class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : pu
blic CCOcclusionTrackerTest<Types, opaqueLayers> { | 2893 class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : pu
blic CCOcclusionTrackerTest<Types, opaqueLayers> { |
| 2888 protected: | 2894 protected: |
| 2889 void runMyTest() | 2895 void runMyTest() |
| 2890 { | 2896 { |
| 2891 WebTransformationMatrix scaleByHalf; | 2897 WebTransformationMatrix scaleByHalf; |
| 2892 scaleByHalf.scale(0.5); | 2898 scaleByHalf.scale(0.5); |
| 2893 | 2899 |
| 2894 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. | 2900 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2922 IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); | 2928 IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); |
| 2923 | 2929 |
| 2924 IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusio
nAboveReplica); | 2930 IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusio
nAboveReplica); |
| 2925 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); | 2931 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); |
| 2926 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2932 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2927 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); | 2933 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); |
| 2928 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2934 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2929 } | 2935 } |
| 2930 }; | 2936 }; |
| 2931 | 2937 |
| 2932 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionIfBackgroun
dFilterIsOccluded); | 2938 // Scale transforms require main thread+commit to get contentBounds right. |
| 2939 MAIN_THREAD_TEST(CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOc
cluded); |
| 2933 | 2940 |
| 2934 template<class Types, bool opaqueLayers> | 2941 template<class Types, bool opaqueLayers> |
| 2935 class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOcclud
ed : public CCOcclusionTrackerTest<Types, opaqueLayers> { | 2942 class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOcclud
ed : public CCOcclusionTrackerTest<Types, opaqueLayers> { |
| 2936 protected: | 2943 protected: |
| 2937 void runMyTest() | 2944 void runMyTest() |
| 2938 { | 2945 { |
| 2939 WebTransformationMatrix scaleByHalf; | 2946 WebTransformationMatrix scaleByHalf; |
| 2940 scaleByHalf.scale(0.5); | 2947 scaleByHalf.scale(0.5); |
| 2941 | 2948 |
| 2942 // Make a surface and its replica, each 50x50, that are partially occlud
ed by opaque layers which are above them in the z-order. | 2949 // Make a surface and its replica, each 50x50, that are partially occlud
ed by opaque layers which are above them in the z-order. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) { | 3001 for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) { |
| 2995 IntRect expectedRect = expectedOcclusion.rects()[i]; | 3002 IntRect expectedRect = expectedOcclusion.rects()[i]; |
| 2996 IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[i]; | 3003 IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[i]; |
| 2997 IntRect targetRect = occlusion.occlusionInTargetSurface().rects()[i]
; | 3004 IntRect targetRect = occlusion.occlusionInTargetSurface().rects()[i]
; |
| 2998 EXPECT_EQ(expectedRect, screenRect); | 3005 EXPECT_EQ(expectedRect, screenRect); |
| 2999 EXPECT_EQ(expectedRect, targetRect); | 3006 EXPECT_EQ(expectedRect, targetRect); |
| 3000 } | 3007 } |
| 3001 } | 3008 } |
| 3002 }; | 3009 }; |
| 3003 | 3010 |
| 3004 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReduceOcclusionWhenBackgroundF
ilterIsPartiallyOccluded); | 3011 // Scale transforms require main thread+commit to get contentBounds right. |
| 3012 MAIN_THREAD_TEST(CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPart
iallyOccluded); |
| 3005 | 3013 |
| 3006 template<class Types, bool opaqueLayers> | 3014 template<class Types, bool opaqueLayers> |
| 3007 class CCOcclusionTrackerTestMinimumTrackingSize : public CCOcclusionTrackerTest<
Types, opaqueLayers> { | 3015 class CCOcclusionTrackerTestMinimumTrackingSize : public CCOcclusionTrackerTest<
Types, opaqueLayers> { |
| 3008 protected: | 3016 protected: |
| 3009 void runMyTest() | 3017 void runMyTest() |
| 3010 { | 3018 { |
| 3011 IntSize trackingSize(100, 100); | 3019 IntSize trackingSize(100, 100); |
| 3012 IntSize belowTrackingSize(99, 99); | 3020 IntSize belowTrackingSize(99, 99); |
| 3013 | 3021 |
| 3014 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(400, 400)); | 3022 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(400, 400)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3034 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInS
creenSpace().bounds()); | 3042 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInS
creenSpace().bounds()); |
| 3035 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 3043 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 3036 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInT
argetSurface().bounds()); | 3044 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInT
argetSurface().bounds()); |
| 3037 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 3045 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 3038 } | 3046 } |
| 3039 }; | 3047 }; |
| 3040 | 3048 |
| 3041 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestMinimumTrackingSize); | 3049 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestMinimumTrackingSize); |
| 3042 | 3050 |
| 3043 } // namespace | 3051 } // namespace |
| OLD | NEW |