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 "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
8 | 8 |
9 #include "CCGeometryTestUtils.h" | 9 #include "CCGeometryTestUtils.h" |
10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 | 1666 |
1667 // The child layer is rotated and the grandChild is opaque, but clipped
to the child and rootLayer | 1667 // The child layer is rotated and the grandChild is opaque, but clipped
to the child and rootLayer |
1668 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1668 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1669 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); | 1669 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); |
1670 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1670 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1671 | 1671 |
1672 m_layerTreeHost->setRootLayer(rootLayer); | 1672 m_layerTreeHost->setRootLayer(rootLayer); |
1673 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1673 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1674 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1674 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1675 CCTextureUpdateQueue queue; | 1675 CCTextureUpdateQueue queue; |
1676 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1676 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1677 m_layerTreeHost->commitComplete(); | 1677 m_layerTreeHost->commitComplete(); |
1678 | 1678 |
1679 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); | 1679 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); |
1680 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1680 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); |
1681 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); | 1681 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); |
1682 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1682 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); |
1683 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace
().bounds()); | 1683 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace
().bounds()); |
1684 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1684 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); |
1685 | 1685 |
1686 // If the child layer is opaque, then it adds to the occlusion seen by t
he rootLayer. | 1686 // If the child layer is opaque, then it adds to the occlusion seen by t
he rootLayer. |
1687 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo
int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1687 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo
int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1688 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); | 1688 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); |
1689 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1689 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1690 | 1690 |
1691 m_layerTreeHost->setRootLayer(rootLayer); | 1691 m_layerTreeHost->setRootLayer(rootLayer); |
1692 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1692 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1693 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1693 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1694 m_layerTreeHost->commitComplete(); | 1694 m_layerTreeHost->commitComplete(); |
1695 | 1695 |
1696 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); | 1696 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); |
1697 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1697 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); |
1698 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); | 1698 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); |
1699 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1699 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); |
1700 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace
().bounds()); | 1700 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace
().bounds()); |
1701 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1701 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); |
1702 | 1702 |
1703 // Add a second child to the root layer and the regions should merge | 1703 // Add a second child to the root layer and the regions should merge |
1704 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1704 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1705 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true); | 1705 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true); |
1706 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); | 1706 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); |
1707 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1707 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1708 | 1708 |
1709 m_layerTreeHost->setRootLayer(rootLayer); | 1709 m_layerTreeHost->setRootLayer(rootLayer); |
1710 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1710 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1711 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1711 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1712 m_layerTreeHost->commitComplete(); | 1712 m_layerTreeHost->commitComplete(); |
1713 | 1713 |
1714 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); | 1714 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); |
1715 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1715 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); |
1716 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); | 1716 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); |
1717 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1717 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); |
1718 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().
bounds()); | 1718 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().
bounds()); |
1719 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); | 1719 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); |
1720 EXPECT_RECT_EQ(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace
().bounds()); | 1720 EXPECT_RECT_EQ(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace
().bounds()); |
1721 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); | 1721 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); |
1722 | 1722 |
1723 // Move the second child to be sure. | 1723 // Move the second child to be sure. |
1724 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1724 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1725 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); | 1725 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); |
1726 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); | 1726 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); |
1727 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1727 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1728 | 1728 |
1729 m_layerTreeHost->setRootLayer(rootLayer); | 1729 m_layerTreeHost->setRootLayer(rootLayer); |
1730 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1730 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1731 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1731 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1732 m_layerTreeHost->commitComplete(); | 1732 m_layerTreeHost->commitComplete(); |
1733 | 1733 |
1734 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); | 1734 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); |
1735 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1735 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); |
1736 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); | 1736 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); |
1737 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1737 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); |
1738 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().
bounds()); | 1738 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().
bounds()); |
1739 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); | 1739 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); |
1740 EXPECT_RECT_EQ(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace
().bounds()); | 1740 EXPECT_RECT_EQ(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace
().bounds()); |
1741 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); | 1741 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); |
1742 | 1742 |
1743 // If the child layer has a mask on it, then it shouldn't contribute to
occlusion on stuff below it | 1743 // If the child layer has a mask on it, then it shouldn't contribute to
occlusion on stuff below it |
1744 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo
int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1744 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo
int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1745 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); | 1745 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); |
1746 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); | 1746 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); |
1747 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1747 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1748 | 1748 |
1749 child->setMaskLayer(mask.get()); | 1749 child->setMaskLayer(mask.get()); |
1750 | 1750 |
1751 m_layerTreeHost->setRootLayer(rootLayer); | 1751 m_layerTreeHost->setRootLayer(rootLayer); |
1752 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1752 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1753 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1753 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1754 m_layerTreeHost->commitComplete(); | 1754 m_layerTreeHost->commitComplete(); |
1755 | 1755 |
1756 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); | 1756 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); |
1757 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1757 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); |
1758 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); | 1758 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); |
1759 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1759 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); |
1760 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); | 1760 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); |
1761 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1761 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); |
1762 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); | 1762 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); |
1763 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1763 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); |
1764 | 1764 |
1765 // 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 | 1765 // 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 |
1766 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo
int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1766 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo
int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1767 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); | 1767 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor
m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); |
1768 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1768 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1769 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); | 1769 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr
ix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); |
1770 | 1770 |
1771 child->setMaskLayer(mask.get()); | 1771 child->setMaskLayer(mask.get()); |
1772 | 1772 |
1773 m_layerTreeHost->setRootLayer(rootLayer); | 1773 m_layerTreeHost->setRootLayer(rootLayer); |
1774 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1774 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1775 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1775 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1776 m_layerTreeHost->commitComplete(); | 1776 m_layerTreeHost->commitComplete(); |
1777 | 1777 |
1778 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); | 1778 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); |
1779 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1779 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); |
1780 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac
e().bounds()); | 1780 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac
e().bounds()); |
1781 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); | 1781 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); |
1782 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b
ounds()); | 1782 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b
ounds()); |
1783 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); | 1783 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); |
1784 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); | 1784 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); |
1785 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1785 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); |
1786 | 1786 |
1787 // If the child layer has a non-opaque drawOpacity, then it shouldn't co
ntribute to occlusion on stuff below it | 1787 // If the child layer has a non-opaque drawOpacity, then it shouldn't co
ntribute to occlusion on stuff below it |
1788 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1788 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1789 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); | 1789 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); |
1790 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); | 1790 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); |
1791 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1791 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1792 | 1792 |
1793 child->setMaskLayer(0); | 1793 child->setMaskLayer(0); |
1794 child->setOpacity(0.5); | 1794 child->setOpacity(0.5); |
1795 | 1795 |
1796 m_layerTreeHost->setRootLayer(rootLayer); | 1796 m_layerTreeHost->setRootLayer(rootLayer); |
1797 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1797 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1798 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1798 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1799 m_layerTreeHost->commitComplete(); | 1799 m_layerTreeHost->commitComplete(); |
1800 | 1800 |
1801 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); | 1801 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); |
1802 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1802 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); |
1803 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); | 1803 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); |
1804 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1804 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); |
1805 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); | 1805 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); |
1806 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1806 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); |
1807 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); | 1807 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); |
1808 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1808 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); |
1809 | 1809 |
1810 // 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 | 1810 // 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 |
1811 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1811 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1812 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); | 1812 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); |
1813 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1813 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1814 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); | 1814 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); |
1815 | 1815 |
1816 child->setMaskLayer(0); | 1816 child->setMaskLayer(0); |
1817 child->setOpacity(0.5); | 1817 child->setOpacity(0.5); |
1818 | 1818 |
1819 m_layerTreeHost->setRootLayer(rootLayer); | 1819 m_layerTreeHost->setRootLayer(rootLayer); |
1820 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1820 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1821 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1821 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1822 m_layerTreeHost->commitComplete(); | 1822 m_layerTreeHost->commitComplete(); |
1823 | 1823 |
1824 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); | 1824 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); |
1825 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1825 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); |
1826 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac
e().bounds()); | 1826 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac
e().bounds()); |
1827 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); | 1827 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); |
1828 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b
ounds()); | 1828 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b
ounds()); |
1829 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); | 1829 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); |
1830 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); | 1830 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); |
1831 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1831 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 { | 1874 { |
1875 WebFilterOperations filters; | 1875 WebFilterOperations filters; |
1876 filters.append(WebFilterOperation::createOpacityFilter(0.5)); | 1876 filters.append(WebFilterOperation::createOpacityFilter(0.5)); |
1877 child->setFilters(filters); | 1877 child->setFilters(filters); |
1878 } | 1878 } |
1879 | 1879 |
1880 m_layerTreeHost->setRootLayer(rootLayer); | 1880 m_layerTreeHost->setRootLayer(rootLayer); |
1881 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1881 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1882 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1882 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1883 CCTextureUpdateQueue queue; | 1883 CCTextureUpdateQueue queue; |
1884 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1884 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1885 m_layerTreeHost->commitComplete(); | 1885 m_layerTreeHost->commitComplete(); |
1886 | 1886 |
1887 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); | 1887 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); |
1888 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1888 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); |
1889 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac
e().bounds()); | 1889 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac
e().bounds()); |
1890 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); | 1890 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); |
1891 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b
ounds()); | 1891 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b
ounds()); |
1892 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); | 1892 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); |
1893 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); | 1893 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); |
1894 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1894 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); |
1895 | 1895 |
1896 // 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, | 1896 // 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, |
1897 // and should not contribute to the rootLayer | 1897 // and should not contribute to the rootLayer |
1898 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); | 1898 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); |
1899 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); | 1899 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran
sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); |
1900 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); | 1900 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); |
1901 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); | 1901 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity
Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); |
1902 | 1902 |
1903 { | 1903 { |
1904 WebFilterOperations filters; | 1904 WebFilterOperations filters; |
1905 filters.append(WebFilterOperation::createBlurFilter(10)); | 1905 filters.append(WebFilterOperation::createBlurFilter(10)); |
1906 child->setFilters(filters); | 1906 child->setFilters(filters); |
1907 } | 1907 } |
1908 | 1908 |
1909 m_layerTreeHost->setRootLayer(rootLayer); | 1909 m_layerTreeHost->setRootLayer(rootLayer); |
1910 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); | 1910 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds(
)); |
1911 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1911 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1912 m_layerTreeHost->commitComplete(); | 1912 m_layerTreeHost->commitComplete(); |
1913 | 1913 |
1914 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); | 1914 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); |
1915 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); | 1915 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); |
1916 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); | 1916 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); |
1917 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); | 1917 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); |
1918 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); | 1918 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b
ounds()); |
1919 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); | 1919 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); |
1920 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); | 1920 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace
().bounds()); |
1921 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); | 1921 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 | 1963 |
1964 for (int i = 1; i < numSurfaces; ++i) { | 1964 for (int i = 1; i < numSurfaces; ++i) { |
1965 children.append(TestLayerChromium::create()); | 1965 children.append(TestLayerChromium::create()); |
1966 setTestLayerPropertiesForTesting(children.last().get(), layers[i].ge
t(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), fals
e); | 1966 setTestLayerPropertiesForTesting(children.last().get(), layers[i].ge
t(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), fals
e); |
1967 } | 1967 } |
1968 | 1968 |
1969 m_layerTreeHost->setRootLayer(layers[0].get()); | 1969 m_layerTreeHost->setRootLayer(layers[0].get()); |
1970 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds(
)); | 1970 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds(
)); |
1971 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); | 1971 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); |
1972 CCTextureUpdateQueue queue; | 1972 CCTextureUpdateQueue queue; |
1973 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max())
; | 1973 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max(),
std::numeric_limits<size_t>::max()); |
1974 m_layerTreeHost->commitComplete(); | 1974 m_layerTreeHost->commitComplete(); |
1975 | 1975 |
1976 for (int i = 0; i < numSurfaces-1; ++i) { | 1976 for (int i = 0; i < numSurfaces-1; ++i) { |
1977 IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); | 1977 IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); |
1978 | 1978 |
1979 EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().b
ounds()); | 1979 EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().b
ounds()); |
1980 EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size()); | 1980 EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size()); |
1981 } | 1981 } |
1982 | 1982 |
1983 // Kill the layerTreeHost immediately. | 1983 // Kill the layerTreeHost immediately. |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2988 int m_numCommitComplete; | 2988 int m_numCommitComplete; |
2989 int m_numDrawLayers; | 2989 int m_numDrawLayers; |
2990 }; | 2990 }; |
2991 | 2991 |
2992 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) | 2992 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) |
2993 { | 2993 { |
2994 runTest(true); | 2994 runTest(true); |
2995 } | 2995 } |
2996 | 2996 |
2997 } // namespace | 2997 } // namespace |
OLD | NEW |