| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "CCLayerTreeHostImpl.h" | 7 #include "CCLayerTreeHostImpl.h" |
| 8 | 8 |
| 9 #include "CCDelegatedRendererLayerImpl.h" | 9 #include "CCDelegatedRendererLayerImpl.h" |
| 10 #include "CCHeadsUpDisplayLayerImpl.h" | 10 #include "CCHeadsUpDisplayLayerImpl.h" |
| 11 #include "CCIOSurfaceLayerImpl.h" | 11 #include "CCIOSurfaceLayerImpl.h" |
| 12 #include "CCLayerImpl.h" | 12 #include "CCLayerImpl.h" |
| 13 #include "CCLayerTilingData.h" | 13 #include "CCLayerTilingData.h" |
| 14 #include "CCQuadSink.h" | 14 #include "CCQuadSink.h" |
| 15 #include "CCRenderPassDrawQuad.h" | 15 #include "CCRenderPassDrawQuad.h" |
| 16 #include "CCRendererGL.h" | 16 #include "CCRendererGL.h" |
| 17 #include "CCScrollbarGeometryFixedThumb.h" | 17 #include "CCScrollbarGeometryFixedThumb.h" |
| 18 #include "CCScrollbarLayerImpl.h" | 18 #include "CCScrollbarLayerImpl.h" |
| 19 #include "CCSettings.h" | |
| 20 #include "CCSingleThreadProxy.h" | 19 #include "CCSingleThreadProxy.h" |
| 21 #include "CCSolidColorDrawQuad.h" | 20 #include "CCSolidColorDrawQuad.h" |
| 22 #include "CCTextureDrawQuad.h" | 21 #include "CCTextureDrawQuad.h" |
| 23 #include "CCTextureLayerImpl.h" | 22 #include "CCTextureLayerImpl.h" |
| 24 #include "CCTileDrawQuad.h" | 23 #include "CCTileDrawQuad.h" |
| 25 #include "CCTiledLayerImpl.h" | 24 #include "CCTiledLayerImpl.h" |
| 26 #include "CCVideoLayerImpl.h" | 25 #include "CCVideoLayerImpl.h" |
| 26 #include "base/command_line.h" |
| 27 #include "base/hash_tables.h" | 27 #include "base/hash_tables.h" |
| 28 #include "cc/test/animation_test_common.h" | 28 #include "cc/test/animation_test_common.h" |
| 29 #include "cc/test/fake_web_compositor_output_surface.h" | 29 #include "cc/test/fake_web_compositor_output_surface.h" |
| 30 #include "cc/test/fake_web_graphics_context_3d.h" | 30 #include "cc/test/fake_web_graphics_context_3d.h" |
| 31 #include "cc/test/fake_web_scrollbar_theme_geometry.h" | 31 #include "cc/test/fake_web_scrollbar_theme_geometry.h" |
| 32 #include "cc/test/geometry_test_utils.h" | 32 #include "cc/test/geometry_test_utils.h" |
| 33 #include "cc/test/layer_test_common.h" | 33 #include "cc/test/layer_test_common.h" |
| 34 #include "cc/test/render_pass_test_common.h" | 34 #include "cc/test/render_pass_test_common.h" |
| 35 #include "cc/test/test_common.h" | 35 #include "cc/test/test_common.h" |
| 36 #include "cc/settings.h" |
| 36 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
| 37 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| 38 #include <public/WebVideoFrame.h> | 39 #include <public/WebVideoFrame.h> |
| 39 #include <public/WebVideoFrameProvider.h> | 40 #include <public/WebVideoFrameProvider.h> |
| 40 | 41 |
| 41 using namespace cc; | 42 using namespace cc; |
| 42 using namespace CCLayerTestCommon; | 43 using namespace CCLayerTestCommon; |
| 43 using namespace WebKit; | 44 using namespace WebKit; |
| 44 using namespace WebKitTests; | 45 using namespace WebKitTests; |
| 45 | 46 |
| 46 using ::testing::Mock; | 47 using ::testing::Mock; |
| 47 using ::testing::Return; | 48 using ::testing::Return; |
| 48 using ::testing::AnyNumber; | 49 using ::testing::AnyNumber; |
| 49 using ::testing::AtLeast; | 50 using ::testing::AtLeast; |
| 50 using ::testing::_; | 51 using ::testing::_; |
| 51 | 52 |
| 52 namespace { | 53 namespace { |
| 53 | 54 |
| 54 // This test is parametrized to run all tests with the | 55 // This test is parametrized to run all tests with the |
| 55 // CCSettings::pageScalePinchZoomEnabled field enabled and disabled. | 56 // Settings::pageScalePinchZoomEnabled field enabled and disabled. |
| 56 class CCLayerTreeHostImplTest : public testing::TestWithParam<bool>, | 57 class CCLayerTreeHostImplTest : public testing::TestWithParam<bool>, |
| 57 public CCLayerTreeHostImplClient { | 58 public CCLayerTreeHostImplClient { |
| 58 public: | 59 public: |
| 59 CCLayerTreeHostImplTest() | 60 CCLayerTreeHostImplTest() |
| 60 : m_onCanDrawStateChangedCalled(false) | 61 : m_onCanDrawStateChangedCalled(false) |
| 61 , m_didRequestCommit(false) | 62 , m_didRequestCommit(false) |
| 62 , m_didRequestRedraw(false) | 63 , m_didRequestRedraw(false) |
| 63 , m_reduceMemoryResult(true) | 64 , m_reduceMemoryResult(true) |
| 64 { | 65 { |
| 65 } | 66 } |
| 66 | 67 |
| 67 virtual void SetUp() | 68 virtual void SetUp() |
| 68 { | 69 { |
| 69 CCSettings::setPageScalePinchZoomEnabled(GetParam()); | 70 Settings::setPageScalePinchZoomEnabled(GetParam()); |
| 70 CCLayerTreeSettings settings; | 71 CCLayerTreeSettings settings; |
| 71 settings.minimumOcclusionTrackingSize = IntSize(); | 72 settings.minimumOcclusionTrackingSize = IntSize(); |
| 72 | 73 |
| 73 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 74 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
| 74 m_hostImpl->initializeRenderer(createContext()); | 75 m_hostImpl->initializeRenderer(createContext()); |
| 75 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 76 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
| 76 } | 77 } |
| 77 | 78 |
| 78 virtual void TearDown() | 79 virtual void TearDown() |
| 79 { | 80 { |
| 80 CCSettings::reset(); | |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void didLoseContextOnImplThread() OVERRIDE { } | 83 virtual void didLoseContextOnImplThread() OVERRIDE { } |
| 84 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } | 84 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } |
| 85 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } | 85 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } |
| 86 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } | 86 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } |
| 87 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } | 87 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } |
| 88 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } | 88 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } |
| 89 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE { } | 89 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE { } |
| 90 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) OVER
RIDE { return m_reduceMemoryResult; } | 90 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) OVER
RIDE { return m_reduceMemoryResult; } |
| 91 | 91 |
| 92 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult =
reduceMemoryResult; } | 92 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult =
reduceMemoryResult; } |
| 93 | 93 |
| 94 scoped_ptr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped
_ptr<CCGraphicsContext> graphicsContext, scoped_ptr<CCLayerImpl> root) | 94 scoped_ptr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped
_ptr<CCGraphicsContext> graphicsContext, scoped_ptr<CCLayerImpl> root) |
| 95 { | 95 { |
| 96 CCSettings::setPartialSwapEnabled(partialSwap); | 96 Settings::setPartialSwapEnabled(partialSwap); |
| 97 | 97 |
| 98 CCLayerTreeSettings settings; | 98 CCLayerTreeSettings settings; |
| 99 settings.minimumOcclusionTrackingSize = IntSize(); | 99 settings.minimumOcclusionTrackingSize = IntSize(); |
| 100 | 100 |
| 101 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create
(settings, this); | 101 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create
(settings, this); |
| 102 | 102 |
| 103 myHostImpl->initializeRenderer(graphicsContext.Pass()); | 103 myHostImpl->initializeRenderer(graphicsContext.Pass()); |
| 104 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 104 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
| 105 | 105 |
| 106 root->setAnchorPoint(FloatPoint(0, 0)); | 106 root->setAnchorPoint(FloatPoint(0, 0)); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 475 |
| 476 deviceScaleFactor = 1; | 476 deviceScaleFactor = 1; |
| 477 m_hostImpl->setViewportSize(layoutViewport, layoutViewport); | 477 m_hostImpl->setViewportSize(layoutViewport, layoutViewport); |
| 478 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); | 478 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); |
| 479 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(75, 75)); | 479 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(75, 75)); |
| 480 } | 480 } |
| 481 | 481 |
| 482 TEST_P(CCLayerTreeHostImplTest, implPinchZoom) | 482 TEST_P(CCLayerTreeHostImplTest, implPinchZoom) |
| 483 { | 483 { |
| 484 // This test is specific to the page-scale based pinch zoom. | 484 // This test is specific to the page-scale based pinch zoom. |
| 485 if (!CCSettings::pageScalePinchZoomEnabled()) | 485 if (!Settings::pageScalePinchZoomEnabled()) |
| 486 return; | 486 return; |
| 487 | 487 |
| 488 setupScrollAndContentsLayers(IntSize(100, 100)); | 488 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 489 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 489 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 490 initializeRendererAndDrawFrame(); | 490 initializeRendererAndDrawFrame(); |
| 491 | 491 |
| 492 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 492 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 493 ASSERT(scrollLayer); | 493 ASSERT(scrollLayer); |
| 494 | 494 |
| 495 const float minPageScale = 1, maxPageScale = 4; | 495 const float minPageScale = 1, maxPageScale = 4; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 538 |
| 539 TEST_P(CCLayerTreeHostImplTest, pinchGesture) | 539 TEST_P(CCLayerTreeHostImplTest, pinchGesture) |
| 540 { | 540 { |
| 541 setupScrollAndContentsLayers(IntSize(100, 100)); | 541 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 542 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 542 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 543 initializeRendererAndDrawFrame(); | 543 initializeRendererAndDrawFrame(); |
| 544 | 544 |
| 545 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 545 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 546 ASSERT(scrollLayer); | 546 ASSERT(scrollLayer); |
| 547 | 547 |
| 548 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; | 548 const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5; |
| 549 const float maxPageScale = 4; | 549 const float maxPageScale = 4; |
| 550 const WebTransformationMatrix identityScaleTransform; | 550 const WebTransformationMatrix identityScaleTransform; |
| 551 | 551 |
| 552 // Basic pinch zoom in gesture | 552 // Basic pinch zoom in gesture |
| 553 { | 553 { |
| 554 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 554 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| 555 scrollLayer->setImplTransform(identityScaleTransform); | 555 scrollLayer->setImplTransform(identityScaleTransform); |
| 556 scrollLayer->setScrollDelta(IntSize()); | 556 scrollLayer->setScrollDelta(IntSize()); |
| 557 | 557 |
| 558 float pageScaleDelta = 2; | 558 float pageScaleDelta = 2; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 589 scrollLayer->setScrollPosition(IntPoint(50, 50)); | 589 scrollLayer->setScrollPosition(IntPoint(50, 50)); |
| 590 | 590 |
| 591 float pageScaleDelta = 0.1f; | 591 float pageScaleDelta = 0.1f; |
| 592 m_hostImpl->pinchGestureBegin(); | 592 m_hostImpl->pinchGestureBegin(); |
| 593 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(0, 0)); | 593 m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(0, 0)); |
| 594 m_hostImpl->pinchGestureEnd(); | 594 m_hostImpl->pinchGestureEnd(); |
| 595 | 595 |
| 596 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDe
ltas(); | 596 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDe
ltas(); |
| 597 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); | 597 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); |
| 598 | 598 |
| 599 if (!CCSettings::pageScalePinchZoomEnabled()) { | 599 if (!Settings::pageScalePinchZoomEnabled()) { |
| 600 // Pushed to (0,0) via clamping against contents layer size. | 600 // Pushed to (0,0) via clamping against contents layer size. |
| 601 expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50)); | 601 expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50)); |
| 602 } else { | 602 } else { |
| 603 EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); | 603 EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); |
| 604 } | 604 } |
| 605 } | 605 } |
| 606 | 606 |
| 607 // Two-finger panning | 607 // Two-finger panning |
| 608 { | 608 { |
| 609 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 609 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 625 | 625 |
| 626 TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) | 626 TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) |
| 627 { | 627 { |
| 628 setupScrollAndContentsLayers(IntSize(100, 100)); | 628 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 629 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 629 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 630 initializeRendererAndDrawFrame(); | 630 initializeRendererAndDrawFrame(); |
| 631 | 631 |
| 632 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 632 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 633 ASSERT(scrollLayer); | 633 ASSERT(scrollLayer); |
| 634 | 634 |
| 635 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; | 635 const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5; |
| 636 const float maxPageScale = 4; | 636 const float maxPageScale = 4; |
| 637 const double startTime = 1; | 637 const double startTime = 1; |
| 638 const double duration = 0.1; | 638 const double duration = 0.1; |
| 639 const double halfwayThroughAnimation = startTime + duration / 2; | 639 const double halfwayThroughAnimation = startTime + duration / 2; |
| 640 const double endTime = startTime + duration; | 640 const double endTime = startTime + duration; |
| 641 const WebTransformationMatrix identityScaleTransform; | 641 const WebTransformationMatrix identityScaleTransform; |
| 642 | 642 |
| 643 // Non-anchor zoom-in | 643 // Non-anchor zoom-in |
| 644 { | 644 { |
| 645 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 645 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 677 |
| 678 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin
g) | 678 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin
g) |
| 679 { | 679 { |
| 680 setupScrollAndContentsLayers(IntSize(100, 100)); | 680 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 681 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 681 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 682 initializeRendererAndDrawFrame(); | 682 initializeRendererAndDrawFrame(); |
| 683 | 683 |
| 684 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 684 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 685 ASSERT(scrollLayer); | 685 ASSERT(scrollLayer); |
| 686 | 686 |
| 687 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; | 687 const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5; |
| 688 const float maxPageScale = 4; | 688 const float maxPageScale = 4; |
| 689 | 689 |
| 690 // Pinch zoom in. | 690 // Pinch zoom in. |
| 691 { | 691 { |
| 692 // Start a pinch in gesture at the bottom right corner of the viewport. | 692 // Start a pinch in gesture at the bottom right corner of the viewport. |
| 693 const float zoomInDelta = 2; | 693 const float zoomInDelta = 2; |
| 694 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 694 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| 695 m_hostImpl->pinchGestureBegin(); | 695 m_hostImpl->pinchGestureBegin(); |
| 696 m_hostImpl->pinchGestureUpdate(zoomInDelta, IntPoint(50, 50)); | 696 m_hostImpl->pinchGestureUpdate(zoomInDelta, IntPoint(50, 50)); |
| 697 | 697 |
| 698 // Because we are pinch zooming in, we shouldn't get any scroll or page | 698 // Because we are pinch zooming in, we shouldn't get any scroll or page |
| 699 // scale deltas. | 699 // scale deltas. |
| 700 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDe
ltas(); | 700 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDe
ltas(); |
| 701 EXPECT_EQ(scrollInfo->pageScaleDelta, 1); | 701 EXPECT_EQ(scrollInfo->pageScaleDelta, 1); |
| 702 EXPECT_EQ(scrollInfo->scrolls.size(), 0u); | 702 EXPECT_EQ(scrollInfo->scrolls.size(), 0u); |
| 703 | 703 |
| 704 // Once the gesture ends, we get the final scroll and page scale values. | 704 // Once the gesture ends, we get the final scroll and page scale values. |
| 705 m_hostImpl->pinchGestureEnd(); | 705 m_hostImpl->pinchGestureEnd(); |
| 706 scrollInfo = m_hostImpl->processScrollDeltas(); | 706 scrollInfo = m_hostImpl->processScrollDeltas(); |
| 707 EXPECT_EQ(scrollInfo->pageScaleDelta, zoomInDelta); | 707 EXPECT_EQ(scrollInfo->pageScaleDelta, zoomInDelta); |
| 708 if (!CCSettings::pageScalePinchZoomEnabled()) { | 708 if (!Settings::pageScalePinchZoomEnabled()) { |
| 709 expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); | 709 expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); |
| 710 } else { | 710 } else { |
| 711 EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); | 711 EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); |
| 712 } | 712 } |
| 713 } | 713 } |
| 714 | 714 |
| 715 // Pinch zoom out. | 715 // Pinch zoom out. |
| 716 { | 716 { |
| 717 // Start a pinch out gesture at the bottom right corner of the viewport. | 717 // Start a pinch out gesture at the bottom right corner of the viewport. |
| 718 const float zoomOutDelta = 0.75; | 718 const float zoomOutDelta = 0.75; |
| 719 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 719 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| 720 m_hostImpl->pinchGestureBegin(); | 720 m_hostImpl->pinchGestureBegin(); |
| 721 m_hostImpl->pinchGestureUpdate(zoomOutDelta, IntPoint(50, 50)); | 721 m_hostImpl->pinchGestureUpdate(zoomOutDelta, IntPoint(50, 50)); |
| 722 | 722 |
| 723 // Since we are pinch zooming out, we should get an update to zoom all | 723 // Since we are pinch zooming out, we should get an update to zoom all |
| 724 // the way out to the minimum page scale. | 724 // the way out to the minimum page scale. |
| 725 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDe
ltas(); | 725 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDe
ltas(); |
| 726 if (!CCSettings::pageScalePinchZoomEnabled()) { | 726 if (!Settings::pageScalePinchZoomEnabled()) { |
| 727 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); | 727 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); |
| 728 expectContains(*scrollInfo, scrollLayer->id(), IntSize(0, 0)); | 728 expectContains(*scrollInfo, scrollLayer->id(), IntSize(0, 0)); |
| 729 } else { | 729 } else { |
| 730 EXPECT_EQ(scrollInfo->pageScaleDelta, 1); | 730 EXPECT_EQ(scrollInfo->pageScaleDelta, 1); |
| 731 EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); | 731 EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); |
| 732 } | 732 } |
| 733 | 733 |
| 734 // Once the gesture ends, we get the final scroll and page scale values. | 734 // Once the gesture ends, we get the final scroll and page scale values. |
| 735 m_hostImpl->pinchGestureEnd(); | 735 m_hostImpl->pinchGestureEnd(); |
| 736 scrollInfo = m_hostImpl->processScrollDeltas(); | 736 scrollInfo = m_hostImpl->processScrollDeltas(); |
| 737 if (CCSettings::pageScalePinchZoomEnabled()) { | 737 if (Settings::pageScalePinchZoomEnabled()) { |
| 738 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); | 738 EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale); |
| 739 expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); | 739 expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); |
| 740 } else { | 740 } else { |
| 741 EXPECT_EQ(scrollInfo->pageScaleDelta, zoomOutDelta); | 741 EXPECT_EQ(scrollInfo->pageScaleDelta, zoomOutDelta); |
| 742 expectContains(*scrollInfo, scrollLayer->id(), IntSize(8, 8)); | 742 expectContains(*scrollInfo, scrollLayer->id(), IntSize(8, 8)); |
| 743 } | 743 } |
| 744 } | 744 } |
| 745 } | 745 } |
| 746 | 746 |
| 747 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa
geScale) | 747 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa
geScale) |
| 748 { | 748 { |
| 749 setupScrollAndContentsLayers(IntSize(100, 100)); | 749 setupScrollAndContentsLayers(IntSize(100, 100)); |
| 750 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); | 750 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); |
| 751 initializeRendererAndDrawFrame(); | 751 initializeRendererAndDrawFrame(); |
| 752 | 752 |
| 753 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); | 753 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); |
| 754 ASSERT(scrollLayer); | 754 ASSERT(scrollLayer); |
| 755 | 755 |
| 756 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5
; | 756 const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5; |
| 757 const float maxPageScale = 4; | 757 const float maxPageScale = 4; |
| 758 const double startTime = 1; | 758 const double startTime = 1; |
| 759 const double duration = 0.1; | 759 const double duration = 0.1; |
| 760 const double halfwayThroughAnimation = startTime + duration / 2; | 760 const double halfwayThroughAnimation = startTime + duration / 2; |
| 761 const double endTime = startTime + duration; | 761 const double endTime = startTime + duration; |
| 762 | 762 |
| 763 // Start a page scale animation. | 763 // Start a page scale animation. |
| 764 const float pageScaleDelta = 2; | 764 const float pageScaleDelta = 2; |
| 765 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); | 765 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); |
| 766 m_hostImpl->startPageScaleAnimation(IntSize(50, 50), false, pageScaleDelta,
startTime, duration); | 766 m_hostImpl->startPageScaleAnimation(IntSize(50, 50), false, pageScaleDelta,
startTime, duration); |
| 767 | 767 |
| 768 // We should immediately get the final zoom and scroll values for the | 768 // We should immediately get the final zoom and scroll values for the |
| 769 // animation. | 769 // animation. |
| 770 m_hostImpl->animate(halfwayThroughAnimation, halfwayThroughAnimation); | 770 m_hostImpl->animate(halfwayThroughAnimation, halfwayThroughAnimation); |
| 771 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas
(); | 771 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas
(); |
| 772 | 772 |
| 773 if (!CCSettings::pageScalePinchZoomEnabled()) { | 773 if (!Settings::pageScalePinchZoomEnabled()) { |
| 774 EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); | 774 EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta); |
| 775 expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); | 775 expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); |
| 776 } else { | 776 } else { |
| 777 EXPECT_EQ(scrollInfo->pageScaleDelta, 1); | 777 EXPECT_EQ(scrollInfo->pageScaleDelta, 1); |
| 778 EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); | 778 EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); |
| 779 } | 779 } |
| 780 | 780 |
| 781 // Scrolling during the animation is ignored. | 781 // Scrolling during the animation is ignored. |
| 782 const IntSize scrollDelta(0, 10); | 782 const IntSize scrollDelta(0, 10); |
| 783 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wh
eel), CCInputHandlerClient::ScrollStarted); | 783 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wh
eel), CCInputHandlerClient::ScrollStarted); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 IntSize scrollDelta(0, 10); | 1147 IntSize scrollDelta(0, 10); |
| 1148 IntSize expectedScrollDelta(scrollDelta); | 1148 IntSize expectedScrollDelta(scrollDelta); |
| 1149 IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); | 1149 IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition()); |
| 1150 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollStarted); | 1150 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollStarted); |
| 1151 m_hostImpl->scrollBy(IntPoint(), scrollDelta); | 1151 m_hostImpl->scrollBy(IntPoint(), scrollDelta); |
| 1152 m_hostImpl->scrollEnd(); | 1152 m_hostImpl->scrollEnd(); |
| 1153 | 1153 |
| 1154 // Set new page scale from main thread. | 1154 // Set new page scale from main thread. |
| 1155 m_hostImpl->setPageScaleFactorAndLimits(pageScale, pageScale, pageScale); | 1155 m_hostImpl->setPageScaleFactorAndLimits(pageScale, pageScale, pageScale); |
| 1156 | 1156 |
| 1157 if (!CCSettings::pageScalePinchZoomEnabled()) { | 1157 if (!Settings::pageScalePinchZoomEnabled()) { |
| 1158 // The scale should apply to the scroll delta. | 1158 // The scale should apply to the scroll delta. |
| 1159 expectedScrollDelta.scale(pageScale); | 1159 expectedScrollDelta.scale(pageScale); |
| 1160 } | 1160 } |
| 1161 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas
(); | 1161 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas
(); |
| 1162 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr
ollDelta); | 1162 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScr
ollDelta); |
| 1163 | 1163 |
| 1164 // The scroll range should also have been updated. | 1164 // The scroll range should also have been updated. |
| 1165 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), expectedMaxScroll); | 1165 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), expectedMaxScroll); |
| 1166 | 1166 |
| 1167 // The page scale delta remains constant because the impl thread did not sca
le. | 1167 // The page scale delta remains constant because the impl thread did not sca
le. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 IntSize expectedMaxScroll(child->maxScrollPosition()); | 1270 IntSize expectedMaxScroll(child->maxScrollPosition()); |
| 1271 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollStarted); | 1271 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollStarted); |
| 1272 m_hostImpl->scrollBy(IntPoint(), scrollDelta); | 1272 m_hostImpl->scrollBy(IntPoint(), scrollDelta); |
| 1273 m_hostImpl->scrollEnd(); | 1273 m_hostImpl->scrollEnd(); |
| 1274 | 1274 |
| 1275 float pageScale = 2; | 1275 float pageScale = 2; |
| 1276 m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale); | 1276 m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale); |
| 1277 | 1277 |
| 1278 m_hostImpl->updateRootScrollLayerImplTransform(); | 1278 m_hostImpl->updateRootScrollLayerImplTransform(); |
| 1279 | 1279 |
| 1280 if (!CCSettings::pageScalePinchZoomEnabled()) { | 1280 if (!Settings::pageScalePinchZoomEnabled()) { |
| 1281 // The scale should apply to the scroll delta. | 1281 // The scale should apply to the scroll delta. |
| 1282 expectedScrollDelta.scale(pageScale); | 1282 expectedScrollDelta.scale(pageScale); |
| 1283 } | 1283 } |
| 1284 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas
(); | 1284 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas
(); |
| 1285 expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta); | 1285 expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta); |
| 1286 | 1286 |
| 1287 // The scroll range should not have changed. | 1287 // The scroll range should not have changed. |
| 1288 EXPECT_EQ(child->maxScrollPosition(), expectedMaxScroll); | 1288 EXPECT_EQ(child->maxScrollPosition(), expectedMaxScroll); |
| 1289 | 1289 |
| 1290 // The page scale delta remains constant because the impl thread did not sca
le. | 1290 // The page scale delta remains constant because the impl thread did not sca
le. |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 // Make sure damage tracking propagates all the way to the graphics context, | 1933 // Make sure damage tracking propagates all the way to the graphics context, |
| 1934 // where it should request to swap only the subBuffer that is damaged. | 1934 // where it should request to swap only the subBuffer that is damaged. |
| 1935 TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) | 1935 TEST_P(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) |
| 1936 { | 1936 { |
| 1937 scoped_ptr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::cr
eate(adoptPtr(new PartialSwapTrackerContext)).PassAs<CCGraphicsContext>(); | 1937 scoped_ptr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::cr
eate(adoptPtr(new PartialSwapTrackerContext)).PassAs<CCGraphicsContext>(); |
| 1938 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(ccContext->context3D()); | 1938 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(ccContext->context3D()); |
| 1939 | 1939 |
| 1940 // This test creates its own CCLayerTreeHostImpl, so | 1940 // This test creates its own CCLayerTreeHostImpl, so |
| 1941 // that we can force partial swap enabled. | 1941 // that we can force partial swap enabled. |
| 1942 CCLayerTreeSettings settings; | 1942 CCLayerTreeSettings settings; |
| 1943 CCSettings::setPartialSwapEnabled(true); | 1943 Settings::setPartialSwapEnabled(true); |
| 1944 scoped_ptr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::cre
ate(settings, this); | 1944 scoped_ptr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::cre
ate(settings, this); |
| 1945 layerTreeHostImpl->initializeRenderer(ccContext.Pass()); | 1945 layerTreeHostImpl->initializeRenderer(ccContext.Pass()); |
| 1946 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); | 1946 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); |
| 1947 | 1947 |
| 1948 scoped_ptr<CCLayerImpl> root = FakeDrawableCCLayerImpl::create(1); | 1948 scoped_ptr<CCLayerImpl> root = FakeDrawableCCLayerImpl::create(1); |
| 1949 scoped_ptr<CCLayerImpl> child = FakeDrawableCCLayerImpl::create(2); | 1949 scoped_ptr<CCLayerImpl> child = FakeDrawableCCLayerImpl::create(2); |
| 1950 child->setPosition(FloatPoint(12, 13)); | 1950 child->setPosition(FloatPoint(12, 13)); |
| 1951 child->setAnchorPoint(FloatPoint(0, 0)); | 1951 child->setAnchorPoint(FloatPoint(0, 0)); |
| 1952 child->setBounds(IntSize(14, 15)); | 1952 child->setBounds(IntSize(14, 15)); |
| 1953 child->setContentBounds(IntSize(14, 15)); | 1953 child->setContentBounds(IntSize(14, 15)); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2216 // Unlimited texture size. | 2216 // Unlimited texture size. |
| 2217 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) | 2217 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) |
| 2218 { | 2218 { |
| 2219 if (pname == cc::GraphicsContext3D::MAX_TEXTURE_SIZE) | 2219 if (pname == cc::GraphicsContext3D::MAX_TEXTURE_SIZE) |
| 2220 *value = 8192; | 2220 *value = 8192; |
| 2221 } | 2221 } |
| 2222 }; | 2222 }; |
| 2223 | 2223 |
| 2224 static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) | 2224 static scoped_ptr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) |
| 2225 { | 2225 { |
| 2226 CCSettings::setPartialSwapEnabled(partialSwap); | 2226 Settings::setPartialSwapEnabled(partialSwap); |
| 2227 | 2227 |
| 2228 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); | 2228 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); |
| 2229 | 2229 |
| 2230 CCLayerTreeSettings settings; | 2230 CCLayerTreeSettings settings; |
| 2231 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, client); | 2231 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, client); |
| 2232 myHostImpl->initializeRenderer(context.Pass()); | 2232 myHostImpl->initializeRenderer(context.Pass()); |
| 2233 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); | 2233 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); |
| 2234 | 2234 |
| 2235 /* | 2235 /* |
| 2236 Layers are created as follows: | 2236 Layers are created as follows: |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 addDrawingLayerTo(surfaceLayerPtr, 4, IntRect(5, 5, rootSize.width() - 25, r
ootSize.height() - 25), &childPtr); | 2981 addDrawingLayerTo(surfaceLayerPtr, 4, IntRect(5, 5, rootSize.width() - 25, r
ootSize.height() - 25), &childPtr); |
| 2982 } | 2982 } |
| 2983 | 2983 |
| 2984 class CCRendererGLWithReleaseTextures : public CCRendererGL { | 2984 class CCRendererGLWithReleaseTextures : public CCRendererGL { |
| 2985 public: | 2985 public: |
| 2986 using CCRendererGL::releaseRenderPassTextures; | 2986 using CCRendererGL::releaseRenderPassTextures; |
| 2987 }; | 2987 }; |
| 2988 | 2988 |
| 2989 TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) | 2989 TEST_P(CCLayerTreeHostImplTest, textureCachingWithClipping) |
| 2990 { | 2990 { |
| 2991 CCSettings::setPartialSwapEnabled(true); | 2991 Settings::setPartialSwapEnabled(true); |
| 2992 | 2992 |
| 2993 CCLayerTreeSettings settings; | 2993 CCLayerTreeSettings settings; |
| 2994 settings.minimumOcclusionTrackingSize = IntSize(); | 2994 settings.minimumOcclusionTrackingSize = IntSize(); |
| 2995 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 2995 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 2996 | 2996 |
| 2997 CCLayerImpl* rootPtr; | 2997 CCLayerImpl* rootPtr; |
| 2998 CCLayerImpl* surfaceLayerPtr; | 2998 CCLayerImpl* surfaceLayerPtr; |
| 2999 | 2999 |
| 3000 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); | 3000 scoped_ptr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::crea
te(adoptPtr(new PartialSwapContext)).PassAs<CCGraphicsContext>(); |
| 3001 | 3001 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); | 3078 EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); |
| 3079 ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size()); | 3079 ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size()); |
| 3080 | 3080 |
| 3081 myHostImpl->drawLayers(frame); | 3081 myHostImpl->drawLayers(frame); |
| 3082 myHostImpl->didDrawAllLayers(frame); | 3082 myHostImpl->didDrawAllLayers(frame); |
| 3083 } | 3083 } |
| 3084 } | 3084 } |
| 3085 | 3085 |
| 3086 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) | 3086 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusion) |
| 3087 { | 3087 { |
| 3088 CCSettings::setPartialSwapEnabled(false); | 3088 Settings::setPartialSwapEnabled(false); |
| 3089 | 3089 |
| 3090 CCLayerTreeSettings settings; | 3090 CCLayerTreeSettings settings; |
| 3091 settings.minimumOcclusionTrackingSize = IntSize(); | 3091 settings.minimumOcclusionTrackingSize = IntSize(); |
| 3092 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 3092 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 3093 | 3093 |
| 3094 // Layers are structure as follows: | 3094 // Layers are structure as follows: |
| 3095 // | 3095 // |
| 3096 // R +-- S1 +- L10 (owning) | 3096 // R +-- S1 +- L10 (owning) |
| 3097 // | +- L11 | 3097 // | +- L11 |
| 3098 // | +- L12 | 3098 // | +- L12 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3194 EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); | 3194 EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); |
| 3195 | 3195 |
| 3196 myHostImpl->drawLayers(frame); | 3196 myHostImpl->drawLayers(frame); |
| 3197 myHostImpl->didDrawAllLayers(frame); | 3197 myHostImpl->didDrawAllLayers(frame); |
| 3198 } | 3198 } |
| 3199 | 3199 |
| 3200 } | 3200 } |
| 3201 | 3201 |
| 3202 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) | 3202 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) |
| 3203 { | 3203 { |
| 3204 CCSettings::setPartialSwapEnabled(false); | 3204 Settings::setPartialSwapEnabled(false); |
| 3205 | 3205 |
| 3206 CCLayerTreeSettings settings; | 3206 CCLayerTreeSettings settings; |
| 3207 settings.minimumOcclusionTrackingSize = IntSize(); | 3207 settings.minimumOcclusionTrackingSize = IntSize(); |
| 3208 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 3208 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 3209 | 3209 |
| 3210 // Layers are structure as follows: | 3210 // Layers are structure as follows: |
| 3211 // | 3211 // |
| 3212 // R +-- S1 +- L10 (owning, non drawing) | 3212 // R +-- S1 +- L10 (owning, non drawing) |
| 3213 // | +- L11 (corner, unoccluded) | 3213 // | +- L11 (corner, unoccluded) |
| 3214 // | +- L12 (corner, unoccluded) | 3214 // | +- L12 (corner, unoccluded) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3310 | 3310 |
| 3311 EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); | 3311 EXPECT_EQ(2U, frame.renderPasses[0]->quadList().size()); |
| 3312 | 3312 |
| 3313 myHostImpl->drawLayers(frame); | 3313 myHostImpl->drawLayers(frame); |
| 3314 myHostImpl->didDrawAllLayers(frame); | 3314 myHostImpl->didDrawAllLayers(frame); |
| 3315 } | 3315 } |
| 3316 } | 3316 } |
| 3317 | 3317 |
| 3318 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) | 3318 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) |
| 3319 { | 3319 { |
| 3320 CCSettings::setPartialSwapEnabled(false); | 3320 Settings::setPartialSwapEnabled(false); |
| 3321 | 3321 |
| 3322 CCLayerTreeSettings settings; | 3322 CCLayerTreeSettings settings; |
| 3323 settings.minimumOcclusionTrackingSize = IntSize(); | 3323 settings.minimumOcclusionTrackingSize = IntSize(); |
| 3324 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 3324 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 3325 | 3325 |
| 3326 // Layers are structured as follows: | 3326 // Layers are structured as follows: |
| 3327 // | 3327 // |
| 3328 // R +-- S1 +- L10 (owning, drawing) | 3328 // R +-- S1 +- L10 (owning, drawing) |
| 3329 // | +- L11 (corner, occluded by L12) | 3329 // | +- L11 (corner, occluded by L12) |
| 3330 // | +- L12 (opposite corner) | 3330 // | +- L12 (opposite corner) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3399 EXPECT_GT(frame.renderPasses[0]->quadList().size(), 0U); | 3399 EXPECT_GT(frame.renderPasses[0]->quadList().size(), 0U); |
| 3400 EXPECT_EQ(2U, frame.renderPasses[1]->quadList().size()); | 3400 EXPECT_EQ(2U, frame.renderPasses[1]->quadList().size()); |
| 3401 | 3401 |
| 3402 myHostImpl->drawLayers(frame); | 3402 myHostImpl->drawLayers(frame); |
| 3403 myHostImpl->didDrawAllLayers(frame); | 3403 myHostImpl->didDrawAllLayers(frame); |
| 3404 } | 3404 } |
| 3405 } | 3405 } |
| 3406 | 3406 |
| 3407 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) | 3407 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) |
| 3408 { | 3408 { |
| 3409 CCSettings::setPartialSwapEnabled(false); | 3409 Settings::setPartialSwapEnabled(false); |
| 3410 | 3410 |
| 3411 CCLayerTreeSettings settings; | 3411 CCLayerTreeSettings settings; |
| 3412 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 3412 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 3413 | 3413 |
| 3414 // Layers are structured as follows: | 3414 // Layers are structured as follows: |
| 3415 // | 3415 // |
| 3416 // R +-- S1 +- L10 (rotated, drawing) | 3416 // R +-- S1 +- L10 (rotated, drawing) |
| 3417 // +- L11 (occupies half surface) | 3417 // +- L11 (occupies half surface) |
| 3418 | 3418 |
| 3419 CCLayerImpl* rootPtr; | 3419 CCLayerImpl* rootPtr; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3473 | 3473 |
| 3474 EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); | 3474 EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); |
| 3475 | 3475 |
| 3476 myHostImpl->drawLayers(frame); | 3476 myHostImpl->drawLayers(frame); |
| 3477 myHostImpl->didDrawAllLayers(frame); | 3477 myHostImpl->didDrawAllLayers(frame); |
| 3478 } | 3478 } |
| 3479 } | 3479 } |
| 3480 | 3480 |
| 3481 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) | 3481 TEST_P(CCLayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) |
| 3482 { | 3482 { |
| 3483 CCSettings::setPartialSwapEnabled(true); | 3483 Settings::setPartialSwapEnabled(true); |
| 3484 | 3484 |
| 3485 CCLayerTreeSettings settings; | 3485 CCLayerTreeSettings settings; |
| 3486 settings.minimumOcclusionTrackingSize = IntSize(); | 3486 settings.minimumOcclusionTrackingSize = IntSize(); |
| 3487 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 3487 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 3488 | 3488 |
| 3489 // Layers are structure as follows: | 3489 // Layers are structure as follows: |
| 3490 // | 3490 // |
| 3491 // R +-- S1 +- L10 (owning) | 3491 // R +-- S1 +- L10 (owning) |
| 3492 // | +- L11 | 3492 // | +- L11 |
| 3493 // | +- L12 | 3493 // | +- L12 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3586 // Root render pass only. | 3586 // Root render pass only. |
| 3587 ASSERT_EQ(1U, frame.renderPasses.size()); | 3587 ASSERT_EQ(1U, frame.renderPasses.size()); |
| 3588 | 3588 |
| 3589 myHostImpl->drawLayers(frame); | 3589 myHostImpl->drawLayers(frame); |
| 3590 myHostImpl->didDrawAllLayers(frame); | 3590 myHostImpl->didDrawAllLayers(frame); |
| 3591 } | 3591 } |
| 3592 } | 3592 } |
| 3593 | 3593 |
| 3594 TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) | 3594 TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) |
| 3595 { | 3595 { |
| 3596 CCSettings::setPartialSwapEnabled(false); | 3596 Settings::setPartialSwapEnabled(false); |
| 3597 | 3597 |
| 3598 CCLayerTreeSettings settings; | 3598 CCLayerTreeSettings settings; |
| 3599 settings.minimumOcclusionTrackingSize = IntSize(); | 3599 settings.minimumOcclusionTrackingSize = IntSize(); |
| 3600 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 3600 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 3601 | 3601 |
| 3602 /* | 3602 /* |
| 3603 Layers are created as follows: | 3603 Layers are created as follows: |
| 3604 | 3604 |
| 3605 +--------------------+ | 3605 +--------------------+ |
| 3606 | 1 | | 3606 | 1 | |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3693 myHostImpl->drawLayers(frame); | 3693 myHostImpl->drawLayers(frame); |
| 3694 myHostImpl->didDrawAllLayers(frame); | 3694 myHostImpl->didDrawAllLayers(frame); |
| 3695 } | 3695 } |
| 3696 | 3696 |
| 3697 // We should have a cached texture for surface 2 again even though it was da
maged. | 3697 // We should have a cached texture for surface 2 again even though it was da
maged. |
| 3698 EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(child
PassId)); | 3698 EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(child
PassId)); |
| 3699 } | 3699 } |
| 3700 | 3700 |
| 3701 TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) | 3701 TEST_P(CCLayerTreeHostImplTest, surfaceTextureCaching) |
| 3702 { | 3702 { |
| 3703 CCSettings::setPartialSwapEnabled(true); | 3703 Settings::setPartialSwapEnabled(true); |
| 3704 | 3704 |
| 3705 CCLayerTreeSettings settings; | 3705 CCLayerTreeSettings settings; |
| 3706 settings.minimumOcclusionTrackingSize = IntSize(); | 3706 settings.minimumOcclusionTrackingSize = IntSize(); |
| 3707 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 3707 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 3708 | 3708 |
| 3709 CCLayerImpl* rootPtr; | 3709 CCLayerImpl* rootPtr; |
| 3710 CCLayerImpl* intermediateLayerPtr; | 3710 CCLayerImpl* intermediateLayerPtr; |
| 3711 CCLayerImpl* surfaceLayerPtr; | 3711 CCLayerImpl* surfaceLayerPtr; |
| 3712 CCLayerImpl* childPtr; | 3712 CCLayerImpl* childPtr; |
| 3713 | 3713 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3854 CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId
()); | 3854 CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId
()); |
| 3855 EXPECT_TRUE(targetPass->damageRect().isEmpty()); | 3855 EXPECT_TRUE(targetPass->damageRect().isEmpty()); |
| 3856 | 3856 |
| 3857 myHostImpl->drawLayers(frame); | 3857 myHostImpl->drawLayers(frame); |
| 3858 myHostImpl->didDrawAllLayers(frame); | 3858 myHostImpl->didDrawAllLayers(frame); |
| 3859 } | 3859 } |
| 3860 } | 3860 } |
| 3861 | 3861 |
| 3862 TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) | 3862 TEST_P(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) |
| 3863 { | 3863 { |
| 3864 CCSettings::setPartialSwapEnabled(false); | 3864 Settings::setPartialSwapEnabled(false); |
| 3865 | 3865 |
| 3866 CCLayerTreeSettings settings; | 3866 CCLayerTreeSettings settings; |
| 3867 settings.minimumOcclusionTrackingSize = IntSize(); | 3867 settings.minimumOcclusionTrackingSize = IntSize(); |
| 3868 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 3868 scoped_ptr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
| 3869 | 3869 |
| 3870 CCLayerImpl* rootPtr; | 3870 CCLayerImpl* rootPtr; |
| 3871 CCLayerImpl* intermediateLayerPtr; | 3871 CCLayerImpl* intermediateLayerPtr; |
| 3872 CCLayerImpl* surfaceLayerPtr; | 3872 CCLayerImpl* surfaceLayerPtr; |
| 3873 CCLayerImpl* childPtr; | 3873 CCLayerImpl* childPtr; |
| 3874 | 3874 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4374 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4374 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
| 4375 testCaseIndex++; | 4375 testCaseIndex++; |
| 4376 } | 4376 } |
| 4377 } | 4377 } |
| 4378 | 4378 |
| 4379 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, | 4379 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, |
| 4380 CCLayerTreeHostImplTest, | 4380 CCLayerTreeHostImplTest, |
| 4381 ::testing::Values(false, true)); | 4381 ::testing::Values(false, true)); |
| 4382 | 4382 |
| 4383 } // namespace | 4383 } // namespace |
| OLD | NEW |