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 "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
8 | 8 |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "cc/content_layer.h" | 10 #include "cc/content_layer.h" |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1682 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1683 | 1683 |
1684 m_layerTreeHost->setRootLayer(rootLayer); | 1684 m_layerTreeHost->setRootLayer(rootLayer); |
1685 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1685 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1686 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1686 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1687 ResourceUpdateQueue queue; | 1687 ResourceUpdateQueue queue; |
1688 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1688 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1689 m_layerTreeHost->commitComplete(); | 1689 m_layerTreeHost->commitComplete(); |
1690 | 1690 |
1691 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1691 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); |
1692 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1692 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1693 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1693 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); |
1694 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1694 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); |
1695 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), rootLayer->occludedScreenSpa
ce().bounds()); | 1695 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), rootLayer->occludedScreenSpa
ce().bounds()); |
1696 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1696 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1697 | 1697 |
1698 // If the child layer is opaque, then it adds to the occlusion seen by t
he rootLayer. | 1698 // If the child layer is opaque, then it adds to the occlusion seen by t
he rootLayer. |
1699 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1699 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1700 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1700 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1701 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1701 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1702 | 1702 |
1703 m_layerTreeHost->setRootLayer(rootLayer); | 1703 m_layerTreeHost->setRootLayer(rootLayer); |
1704 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1704 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1705 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1705 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1706 m_layerTreeHost->commitComplete(); | 1706 m_layerTreeHost->commitComplete(); |
1707 | 1707 |
1708 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1708 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); |
1709 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1709 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1710 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1710 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); |
1711 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1711 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); |
1712 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), rootLayer->occludedScreenSpa
ce().bounds()); | 1712 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), rootLayer->occludedScreenSpa
ce().bounds()); |
1713 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1713 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1714 | 1714 |
1715 // Add a second child to the root layer and the regions should merge | 1715 // Add a second child to the root layer and the regions should merge |
1716 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1716 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1717 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(70, 20), gfx::Size(500, 500), true); | 1717 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(70, 20), gfx::Size(500, 500), true); |
1718 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1718 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1719 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1719 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1720 | 1720 |
1721 m_layerTreeHost->setRootLayer(rootLayer); | 1721 m_layerTreeHost->setRootLayer(rootLayer); |
1722 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1722 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1723 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1723 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1724 m_layerTreeHost->commitComplete(); | 1724 m_layerTreeHost->commitComplete(); |
1725 | 1725 |
1726 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1726 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); |
1727 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1727 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1728 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1728 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); |
1729 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1729 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); |
1730 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace(
).bounds()); | 1730 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace(
).bounds()); |
1731 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); | 1731 EXPECT_EQ(1u, Region::Iterator(child2->occludedScreenSpace()).size()); |
1732 EXPECT_RECT_EQ(gfx::Rect(30, 20, 170, 180), rootLayer->occludedScreenSpa
ce().bounds()); | 1732 EXPECT_RECT_EQ(gfx::Rect(30, 20, 170, 180), rootLayer->occludedScreenSpa
ce().bounds()); |
1733 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); | 1733 EXPECT_EQ(2u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1734 | 1734 |
1735 // Move the second child to be sure. | 1735 // Move the second child to be sure. |
1736 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1736 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1737 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1737 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1738 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1738 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1739 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1739 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1740 | 1740 |
1741 m_layerTreeHost->setRootLayer(rootLayer); | 1741 m_layerTreeHost->setRootLayer(rootLayer); |
1742 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1742 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1743 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1743 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1744 m_layerTreeHost->commitComplete(); | 1744 m_layerTreeHost->commitComplete(); |
1745 | 1745 |
1746 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1746 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); |
1747 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1747 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1748 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1748 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); |
1749 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1749 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); |
1750 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace(
).bounds()); | 1750 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace(
).bounds()); |
1751 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); | 1751 EXPECT_EQ(1u, Region::Iterator(child2->occludedScreenSpace()).size()); |
1752 EXPECT_RECT_EQ(gfx::Rect(10, 30, 190, 170), rootLayer->occludedScreenSpa
ce().bounds()); | 1752 EXPECT_RECT_EQ(gfx::Rect(10, 30, 190, 170), rootLayer->occludedScreenSpa
ce().bounds()); |
1753 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); | 1753 EXPECT_EQ(2u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1754 | 1754 |
1755 // If the child layer has a mask on it, then it shouldn't contribute to
occlusion on stuff below it | 1755 // If the child layer has a mask on it, then it shouldn't contribute to
occlusion on stuff below it |
1756 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1756 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1757 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1757 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1758 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1758 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1759 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1759 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1760 | 1760 |
1761 child->setMaskLayer(mask.get()); | 1761 child->setMaskLayer(mask.get()); |
1762 | 1762 |
1763 m_layerTreeHost->setRootLayer(rootLayer); | 1763 m_layerTreeHost->setRootLayer(rootLayer); |
1764 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1764 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1765 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1765 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1766 m_layerTreeHost->commitComplete(); | 1766 m_layerTreeHost->commitComplete(); |
1767 | 1767 |
1768 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1768 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); |
1769 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1769 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1770 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1770 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); |
1771 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1771 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); |
1772 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1772 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); |
1773 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1773 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); |
1774 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | 1774 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); |
1775 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1775 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1776 | 1776 |
1777 // If the child layer with a mask is below child2, then child2 should co
ntribute to occlusion on everything, and child shouldn't contribute to the rootL
ayer | 1777 // If the child layer with a mask is below child2, then child2 should co
ntribute to occlusion on everything, and child shouldn't contribute to the rootL
ayer |
1778 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1778 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1779 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1779 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1780 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1780 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1781 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1781 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1782 | 1782 |
1783 child->setMaskLayer(mask.get()); | 1783 child->setMaskLayer(mask.get()); |
1784 | 1784 |
1785 m_layerTreeHost->setRootLayer(rootLayer); | 1785 m_layerTreeHost->setRootLayer(rootLayer); |
1786 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1786 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1787 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1787 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1788 m_layerTreeHost->commitComplete(); | 1788 m_layerTreeHost->commitComplete(); |
1789 | 1789 |
1790 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1790 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); |
1791 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1791 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); |
1792 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); | 1792 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); |
1793 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); | 1793 EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1794 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); | 1794 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); |
1795 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); | 1795 EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size()); |
1796 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | 1796 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); |
1797 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1797 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1798 | 1798 |
1799 // If the child layer has a non-opaque drawOpacity, then it shouldn't co
ntribute to occlusion on stuff below it | 1799 // If the child layer has a non-opaque drawOpacity, then it shouldn't co
ntribute to occlusion on stuff below it |
1800 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1800 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1801 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1801 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1802 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1802 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1803 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1803 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1804 | 1804 |
1805 child->setMaskLayer(0); | 1805 child->setMaskLayer(0); |
1806 child->setOpacity(0.5); | 1806 child->setOpacity(0.5); |
1807 | 1807 |
1808 m_layerTreeHost->setRootLayer(rootLayer); | 1808 m_layerTreeHost->setRootLayer(rootLayer); |
1809 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1809 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1810 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1810 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1811 m_layerTreeHost->commitComplete(); | 1811 m_layerTreeHost->commitComplete(); |
1812 | 1812 |
1813 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1813 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); |
1814 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1814 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1815 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1815 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); |
1816 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1816 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); |
1817 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1817 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); |
1818 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1818 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); |
1819 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | 1819 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); |
1820 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1820 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1821 | 1821 |
1822 // If the child layer with non-opaque drawOpacity is below child2, then
child2 should contribute to occlusion on everything, and child shouldn't contrib
ute to the rootLayer | 1822 // If the child layer with non-opaque drawOpacity is below child2, then
child2 should contribute to occlusion on everything, and child shouldn't contrib
ute to the rootLayer |
1823 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1823 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1824 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1824 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1825 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1825 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1826 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1826 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1827 | 1827 |
1828 child->setMaskLayer(0); | 1828 child->setMaskLayer(0); |
1829 child->setOpacity(0.5); | 1829 child->setOpacity(0.5); |
1830 | 1830 |
1831 m_layerTreeHost->setRootLayer(rootLayer); | 1831 m_layerTreeHost->setRootLayer(rootLayer); |
1832 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1832 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1833 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1833 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1834 m_layerTreeHost->commitComplete(); | 1834 m_layerTreeHost->commitComplete(); |
1835 | 1835 |
1836 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1836 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); |
1837 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1837 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); |
1838 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); | 1838 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); |
1839 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); | 1839 EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1840 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); | 1840 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); |
1841 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); | 1841 EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size()); |
1842 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | 1842 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); |
1843 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1843 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1844 | 1844 |
1845 // Kill the layerTreeHost immediately. | 1845 // Kill the layerTreeHost immediately. |
1846 m_layerTreeHost->setRootLayer(0); | 1846 m_layerTreeHost->setRootLayer(0); |
1847 m_layerTreeHost.reset(); | 1847 m_layerTreeHost.reset(); |
1848 | 1848 |
1849 endTest(); | 1849 endTest(); |
1850 } | 1850 } |
1851 | 1851 |
1852 virtual void afterTest() OVERRIDE | 1852 virtual void afterTest() OVERRIDE |
1853 { | 1853 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 } | 1890 } |
1891 | 1891 |
1892 m_layerTreeHost->setRootLayer(rootLayer); | 1892 m_layerTreeHost->setRootLayer(rootLayer); |
1893 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1893 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1894 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1894 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1895 ResourceUpdateQueue queue; | 1895 ResourceUpdateQueue queue; |
1896 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1896 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1897 m_layerTreeHost->commitComplete(); | 1897 m_layerTreeHost->commitComplete(); |
1898 | 1898 |
1899 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1899 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); |
1900 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1900 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); |
1901 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); | 1901 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); |
1902 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); | 1902 EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1903 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); | 1903 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); |
1904 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); | 1904 EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size()); |
1905 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | 1905 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); |
1906 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1906 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1907 | 1907 |
1908 // If the child layer has a filter that moves pixels/changes alpha, and
is below child2, then child should not inherit occlusion from outside its subtre
e, | 1908 // If the child layer has a filter that moves pixels/changes alpha, and
is below child2, then child should not inherit occlusion from outside its subtre
e, |
1909 // and should not contribute to the rootLayer | 1909 // and should not contribute to the rootLayer |
1910 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1910 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1911 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1911 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1912 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1912 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1913 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1913 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1914 | 1914 |
1915 { | 1915 { |
1916 WebFilterOperations filters; | 1916 WebFilterOperations filters; |
1917 filters.append(WebFilterOperation::createBlurFilter(10)); | 1917 filters.append(WebFilterOperation::createBlurFilter(10)); |
1918 child->setFilters(filters); | 1918 child->setFilters(filters); |
1919 } | 1919 } |
1920 | 1920 |
1921 m_layerTreeHost->setRootLayer(rootLayer); | 1921 m_layerTreeHost->setRootLayer(rootLayer); |
1922 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1922 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1923 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1923 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1924 m_layerTreeHost->commitComplete(); | 1924 m_layerTreeHost->commitComplete(); |
1925 | 1925 |
1926 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1926 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); |
1927 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1927 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); |
1928 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1928 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); |
1929 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1929 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); |
1930 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1930 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); |
1931 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1931 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); |
1932 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | 1932 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); |
1933 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1933 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; |
1934 | 1934 |
1935 // Kill the layerTreeHost immediately. | 1935 // Kill the layerTreeHost immediately. |
1936 m_layerTreeHost->setRootLayer(0); | 1936 m_layerTreeHost->setRootLayer(0); |
1937 m_layerTreeHost.reset(); | 1937 m_layerTreeHost.reset(); |
1938 | 1938 |
1939 LayerTreeHost::setNeedsFilterContext(false); | 1939 LayerTreeHost::setNeedsFilterContext(false); |
1940 endTest(); | 1940 endTest(); |
1941 } | 1941 } |
1942 | 1942 |
1943 virtual void afterTest() OVERRIDE | 1943 virtual void afterTest() OVERRIDE |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds(
)); | 1982 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds(
)); |
1983 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1983 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1984 ResourceUpdateQueue queue; | 1984 ResourceUpdateQueue queue; |
1985 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1985 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1986 m_layerTreeHost->commitComplete(); | 1986 m_layerTreeHost->commitComplete(); |
1987 | 1987 |
1988 for (int i = 0; i < numSurfaces-1; ++i) { | 1988 for (int i = 0; i < numSurfaces-1; ++i) { |
1989 gfx::Rect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); | 1989 gfx::Rect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); |
1990 | 1990 |
1991 EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().b
ounds()); | 1991 EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().b
ounds()); |
1992 EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size()); | 1992 EXPECT_EQ(1u, Region::Iterator(layers[i]->occludedScreenSpace()).siz
e()); |
1993 } | 1993 } |
1994 | 1994 |
1995 // Kill the layerTreeHost immediately. | 1995 // Kill the layerTreeHost immediately. |
1996 m_layerTreeHost->setRootLayer(0); | 1996 m_layerTreeHost->setRootLayer(0); |
1997 m_layerTreeHost.reset(); | 1997 m_layerTreeHost.reset(); |
1998 | 1998 |
1999 endTest(); | 1999 endTest(); |
2000 } | 2000 } |
2001 | 2001 |
2002 virtual void afterTest() OVERRIDE | 2002 virtual void afterTest() OVERRIDE |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3264 int m_numCommitsDeferred; | 3264 int m_numCommitsDeferred; |
3265 int m_numCompleteCommits; | 3265 int m_numCompleteCommits; |
3266 }; | 3266 }; |
3267 | 3267 |
3268 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) | 3268 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) |
3269 { | 3269 { |
3270 runTest(true); | 3270 runTest(true); |
3271 } | 3271 } |
3272 | 3272 |
3273 } // namespace | 3273 } // namespace |
OLD | NEW |