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(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), false); | 1682 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), false); |
1683 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1683 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1684 | 1684 |
1685 m_layerTreeHost->setRootLayer(rootLayer); | 1685 m_layerTreeHost->setRootLayer(rootLayer); |
1686 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1686 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1687 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1687 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1688 ResourceUpdateQueue queue; | 1688 ResourceUpdateQueue queue; |
1689 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1689 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1690 m_layerTreeHost->commitComplete(); | 1690 m_layerTreeHost->commitComplete(); |
1691 | 1691 |
1692 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1692 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt
ring()); |
1693 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1693 EXPECT_EQ(gfx::Rect(30, 40, 170, 160).ToString(), child->occludedScreenS
pace().ToString()); |
1694 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1694 EXPECT_EQ(gfx::Rect(30, 40, 170, 160).ToString(), rootLayer->occludedScr
eenSpace().ToString()); |
1695 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); | |
1696 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), rootLayer->occludedScreenSpa
ce().bounds()); | |
1697 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1698 | 1695 |
1699 // If the child layer is opaque, then it adds to the occlusion seen by t
he rootLayer. | 1696 // If the child layer is opaque, then it adds to the occlusion seen by t
he rootLayer. |
1700 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1697 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1701 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1698 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1702 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1699 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1703 | 1700 |
1704 m_layerTreeHost->setRootLayer(rootLayer); | 1701 m_layerTreeHost->setRootLayer(rootLayer); |
1705 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1702 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1706 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1703 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1707 m_layerTreeHost->commitComplete(); | 1704 m_layerTreeHost->commitComplete(); |
1708 | 1705 |
1709 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1706 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt
ring()); |
1710 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1707 EXPECT_EQ(gfx::Rect(30, 40, 170, 160).ToString(), child->occludedScreenS
pace().ToString()); |
1711 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1708 EXPECT_EQ(gfx::Rect(30, 30, 170, 170).ToString(), rootLayer->occludedScr
eenSpace().ToString()); |
1712 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); | |
1713 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), rootLayer->occludedScreenSpa
ce().bounds()); | |
1714 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1715 | 1709 |
1716 // Add a second child to the root layer and the regions should merge | 1710 // Add a second child to the root layer and the regions should merge |
1717 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1711 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1718 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(70, 20), gfx::Size(500, 500), true); | 1712 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(70, 20), gfx::Size(500, 500), true); |
1719 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1713 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1720 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1714 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1721 | 1715 |
1722 m_layerTreeHost->setRootLayer(rootLayer); | 1716 m_layerTreeHost->setRootLayer(rootLayer); |
1723 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1717 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1724 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1718 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1725 m_layerTreeHost->commitComplete(); | 1719 m_layerTreeHost->commitComplete(); |
1726 | 1720 |
1727 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1721 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt
ring()); |
1728 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1722 EXPECT_EQ(gfx::Rect(30, 40, 170, 160).ToString(), child->occludedScreenS
pace().ToString()); |
1729 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1723 EXPECT_EQ(gfx::Rect(30, 30, 170, 170).ToString(), child2->occludedScreen
Space().ToString()); |
1730 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); | 1724 EXPECT_EQ(UnionRegions(gfx::Rect(30, 30, 170, 170), gfx::Rect(70, 20, 13
0, 180)).ToString(), rootLayer->occludedScreenSpace().ToString()); |
1731 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace(
).bounds()); | |
1732 EXPECT_EQ(1u, Region::Iterator(child2->occludedScreenSpace()).size()); | |
1733 EXPECT_RECT_EQ(gfx::Rect(30, 20, 170, 180), rootLayer->occludedScreenSpa
ce().bounds()); | |
1734 EXPECT_EQ(2u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1735 | 1725 |
1736 // Move the second child to be sure. | 1726 // Move the second child to be sure. |
1737 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1727 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1738 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1728 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1739 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1729 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1740 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1730 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1741 | 1731 |
1742 m_layerTreeHost->setRootLayer(rootLayer); | 1732 m_layerTreeHost->setRootLayer(rootLayer); |
1743 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1733 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1744 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1734 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1745 m_layerTreeHost->commitComplete(); | 1735 m_layerTreeHost->commitComplete(); |
1746 | 1736 |
1747 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1737 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt
ring()); |
1748 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1738 EXPECT_EQ(gfx::Rect(30, 40, 170, 160).ToString(), child->occludedScreenS
pace().ToString()); |
1749 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1739 EXPECT_EQ(gfx::Rect(30, 30, 170, 170).ToString(), child2->occludedScreen
Space().ToString()); |
1750 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); | 1740 EXPECT_EQ(UnionRegions(gfx::Rect(10, 70, 190, 130), gfx::Rect(30, 30, 17
0, 170)).ToString(), rootLayer->occludedScreenSpace().ToString()); |
1751 EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace(
).bounds()); | |
1752 EXPECT_EQ(1u, Region::Iterator(child2->occludedScreenSpace()).size()); | |
1753 EXPECT_RECT_EQ(gfx::Rect(10, 30, 190, 170), rootLayer->occludedScreenSpa
ce().bounds()); | |
1754 EXPECT_EQ(2u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1755 | 1741 |
1756 // If the child layer has a mask on it, then it shouldn't contribute to
occlusion on stuff below it | 1742 // If the child layer has a mask on it, then it shouldn't contribute to
occlusion on stuff below it |
1757 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1743 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1758 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1744 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1759 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1745 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1760 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1746 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1761 | 1747 |
1762 child->setMaskLayer(mask.get()); | 1748 child->setMaskLayer(mask.get()); |
1763 | 1749 |
1764 m_layerTreeHost->setRootLayer(rootLayer); | 1750 m_layerTreeHost->setRootLayer(rootLayer); |
1765 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1751 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1766 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1752 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1767 m_layerTreeHost->commitComplete(); | 1753 m_layerTreeHost->commitComplete(); |
1768 | 1754 |
1769 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1755 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt
ring()); |
1770 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1756 EXPECT_EQ(gfx::Rect(30, 40, 170, 160).ToString(), child->occludedScreenS
pace().ToString()); |
1771 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1757 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString
()); |
1772 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); | 1758 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), rootLayer->occludedScr
eenSpace().ToString()); |
1773 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | |
1774 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); | |
1775 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | |
1776 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1777 | 1759 |
1778 // 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 | 1760 // 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 |
1779 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1761 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::Po
intF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1780 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1762 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1781 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1763 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1782 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1764 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1783 | 1765 |
1784 child->setMaskLayer(mask.get()); | 1766 child->setMaskLayer(mask.get()); |
1785 | 1767 |
1786 m_layerTreeHost->setRootLayer(rootLayer); | 1768 m_layerTreeHost->setRootLayer(rootLayer); |
1787 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1769 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1788 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1770 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1789 m_layerTreeHost->commitComplete(); | 1771 m_layerTreeHost->commitComplete(); |
1790 | 1772 |
1791 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1773 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString
()); |
1792 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); | 1774 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), grandChild->occludedSc
reenSpace().ToString()); |
1793 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); | 1775 EXPECT_EQ(UnionRegions(gfx::Rect(30, 40, 170, 160), gfx::Rect(10, 70, 19
0, 130)).ToString(), child->occludedScreenSpace().ToString()); |
1794 EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1776 EXPECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace())
; |
1795 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); | |
1796 EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size()); | |
1797 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | |
1798 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1799 | 1777 |
1800 // If the child layer has a non-opaque drawOpacity, then it shouldn't co
ntribute to occlusion on stuff below it | 1778 // If the child layer has a non-opaque drawOpacity, then it shouldn't co
ntribute to occlusion on stuff below it |
1801 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1779 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1802 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1780 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1803 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1781 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1804 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1782 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1805 | 1783 |
1806 child->setMaskLayer(0); | 1784 child->setMaskLayer(0); |
1807 child->setOpacity(0.5); | 1785 child->setOpacity(0.5); |
1808 | 1786 |
1809 m_layerTreeHost->setRootLayer(rootLayer); | 1787 m_layerTreeHost->setRootLayer(rootLayer); |
1810 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1788 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1811 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1789 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1812 m_layerTreeHost->commitComplete(); | 1790 m_layerTreeHost->commitComplete(); |
1813 | 1791 |
1814 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1792 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt
ring()); |
1815 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1793 EXPECT_EQ(gfx::Rect(30, 40, 170, 160).ToString(), child->occludedScreenS
pace().ToString()); |
1816 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | 1794 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString
()); |
1817 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); | 1795 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), rootLayer->occludedScr
eenSpace().ToString()); |
1818 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | |
1819 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); | |
1820 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | |
1821 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1822 | 1796 |
1823 // 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 | 1797 // 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 |
1824 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1798 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1825 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1799 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1826 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1800 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1827 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); |
1828 | 1802 |
1829 child->setMaskLayer(0); | 1803 child->setMaskLayer(0); |
1830 child->setOpacity(0.5); | 1804 child->setOpacity(0.5); |
1831 | 1805 |
1832 m_layerTreeHost->setRootLayer(rootLayer); | 1806 m_layerTreeHost->setRootLayer(rootLayer); |
1833 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1807 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1834 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1808 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1835 m_layerTreeHost->commitComplete(); | 1809 m_layerTreeHost->commitComplete(); |
1836 | 1810 |
1837 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1811 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString
()); |
1838 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); | 1812 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), grandChild->occludedSc
reenSpace().ToString()); |
1839 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); | 1813 EXPECT_EQ(UnionRegions(gfx::Rect(30, 40, 170, 160), gfx::Rect(10, 70, 19
0, 130)).ToString(), child->occludedScreenSpace().ToString()); |
1840 EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1814 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), rootLayer->occludedScr
eenSpace().ToString()); |
1841 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); | |
1842 EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size()); | |
1843 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | |
1844 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1845 | 1815 |
1846 // Kill the layerTreeHost immediately. | 1816 // Kill the layerTreeHost immediately. |
1847 m_layerTreeHost->setRootLayer(0); | 1817 m_layerTreeHost->setRootLayer(0); |
1848 m_layerTreeHost.reset(); | 1818 m_layerTreeHost.reset(); |
1849 | 1819 |
1850 endTest(); | 1820 endTest(); |
1851 } | 1821 } |
1852 | 1822 |
1853 virtual void afterTest() OVERRIDE | 1823 virtual void afterTest() OVERRIDE |
1854 { | 1824 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 child->setFilters(filters); | 1860 child->setFilters(filters); |
1891 } | 1861 } |
1892 | 1862 |
1893 m_layerTreeHost->setRootLayer(rootLayer); | 1863 m_layerTreeHost->setRootLayer(rootLayer); |
1894 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1864 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1895 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1865 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1896 ResourceUpdateQueue queue; | 1866 ResourceUpdateQueue queue; |
1897 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1867 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1898 m_layerTreeHost->commitComplete(); | 1868 m_layerTreeHost->commitComplete(); |
1899 | 1869 |
1900 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1870 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString
()); |
1901 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); | 1871 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), grandChild->occludedSc
reenSpace().ToString()); |
1902 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSp
ace().bounds()); | 1872 EXPECT_EQ(UnionRegions(gfx::Rect(30, 40, 170, 30), gfx::Rect(10, 70, 190
, 130)).ToString(), child->occludedScreenSpace().ToString()); |
1903 EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1873 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), rootLayer->occludedScr
eenSpace().ToString()); |
1904 EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace()
.bounds()); | |
1905 EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size()); | |
1906 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | |
1907 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1908 | 1874 |
1909 // 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, | 1875 // 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, |
1910 // and should not contribute to the rootLayer | 1876 // and should not contribute to the rootLayer |
1911 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); | 1877 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1912 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1878 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1913 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); | 1879 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true); |
1914 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); | 1880 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true); |
1915 | 1881 |
1916 { | 1882 { |
1917 WebFilterOperations filters; | 1883 WebFilterOperations filters; |
1918 filters.append(WebFilterOperation::createBlurFilter(10)); | 1884 filters.append(WebFilterOperation::createBlurFilter(10)); |
1919 child->setFilters(filters); | 1885 child->setFilters(filters); |
1920 } | 1886 } |
1921 | 1887 |
1922 m_layerTreeHost->setRootLayer(rootLayer); | 1888 m_layerTreeHost->setRootLayer(rootLayer); |
1923 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1889 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1924 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1890 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1925 m_layerTreeHost->commitComplete(); | 1891 m_layerTreeHost->commitComplete(); |
1926 | 1892 |
1927 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds()); | 1893 EXPECT_EQ(gfx::Rect().ToString(), child2->occludedScreenSpace().ToString
()); |
1928 EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size()); | 1894 EXPECT_EQ(gfx::Rect().ToString(), grandChild->occludedScreenSpace().ToSt
ring()); |
1929 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds()); | 1895 EXPECT_EQ(gfx::Rect(30, 40, 170, 160).ToString(), child->occludedScreenS
pace().ToString()); |
1930 EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size()
); | 1896 EXPECT_EQ(gfx::Rect(10, 70, 190, 130).ToString(), rootLayer->occludedScr
eenSpace().ToString()); |
1931 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace()
.bounds()); | |
1932 EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size()); | |
1933 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa
ce().bounds()); | |
1934 EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size())
; | |
1935 | 1897 |
1936 // Kill the layerTreeHost immediately. | 1898 // Kill the layerTreeHost immediately. |
1937 m_layerTreeHost->setRootLayer(0); | 1899 m_layerTreeHost->setRootLayer(0); |
1938 m_layerTreeHost.reset(); | 1900 m_layerTreeHost.reset(); |
1939 | 1901 |
1940 LayerTreeHost::setNeedsFilterContext(false); | 1902 LayerTreeHost::setNeedsFilterContext(false); |
1941 endTest(); | 1903 endTest(); |
1942 } | 1904 } |
1943 | 1905 |
1944 virtual void afterTest() OVERRIDE | 1906 virtual void afterTest() OVERRIDE |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 | 1943 |
1982 m_layerTreeHost->setRootLayer(layers[0].get()); | 1944 m_layerTreeHost->setRootLayer(layers[0].get()); |
1983 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds(
)); | 1945 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds(
)); |
1984 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1946 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1985 ResourceUpdateQueue queue; | 1947 ResourceUpdateQueue queue; |
1986 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1948 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; |
1987 m_layerTreeHost->commitComplete(); | 1949 m_layerTreeHost->commitComplete(); |
1988 | 1950 |
1989 for (int i = 0; i < numSurfaces-1; ++i) { | 1951 for (int i = 0; i < numSurfaces-1; ++i) { |
1990 gfx::Rect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); | 1952 gfx::Rect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); |
1991 | 1953 EXPECT_EQ(expectedOcclusion.ToString(), layers[i]->occludedScreenSpa
ce().ToString()); |
1992 EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().b
ounds()); | |
1993 EXPECT_EQ(1u, Region::Iterator(layers[i]->occludedScreenSpace()).siz
e()); | |
1994 } | 1954 } |
1995 | 1955 |
1996 // Kill the layerTreeHost immediately. | 1956 // Kill the layerTreeHost immediately. |
1997 m_layerTreeHost->setRootLayer(0); | 1957 m_layerTreeHost->setRootLayer(0); |
1998 m_layerTreeHost.reset(); | 1958 m_layerTreeHost.reset(); |
1999 | 1959 |
2000 endTest(); | 1960 endTest(); |
2001 } | 1961 } |
2002 | 1962 |
2003 virtual void afterTest() OVERRIDE | 1963 virtual void afterTest() OVERRIDE |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3265 int m_numCommitsDeferred; | 3225 int m_numCommitsDeferred; |
3266 int m_numCompleteCommits; | 3226 int m_numCompleteCommits; |
3267 }; | 3227 }; |
3268 | 3228 |
3269 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) | 3229 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) |
3270 { | 3230 { |
3271 runTest(true); | 3231 runTest(true); |
3272 } | 3232 } |
3273 | 3233 |
3274 } // anonymous namespace | 3234 } // anonymous namespace |
OLD | NEW |