Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 340743002: cc: Removing base::TimeTicks argument to DrawLayers as it isn't used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing onto master. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 layer->SetDrawsContent(true); 290 layer->SetDrawsContent(true);
291 layer->SetBounds(size); 291 layer->SetBounds(size);
292 layer->SetContentBounds(size); 292 layer->SetContentBounds(size);
293 clip_layer->SetBounds(gfx::Size(size.width() / 2, size.height() / 2)); 293 clip_layer->SetBounds(gfx::Size(size.width() / 2, size.height() / 2));
294 return layer.Pass(); 294 return layer.Pass();
295 } 295 }
296 296
297 void DrawFrame() { 297 void DrawFrame() {
298 LayerTreeHostImpl::FrameData frame; 298 LayerTreeHostImpl::FrameData frame;
299 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 299 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
300 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 300 host_impl_->DrawLayers(&frame);
301 host_impl_->DidDrawAllLayers(frame); 301 host_impl_->DidDrawAllLayers(frame);
302 } 302 }
303 303
304 void pinch_zoom_pan_viewport_forces_commit_redraw(float device_scale_factor); 304 void pinch_zoom_pan_viewport_forces_commit_redraw(float device_scale_factor);
305 void pinch_zoom_pan_viewport_test(float device_scale_factor); 305 void pinch_zoom_pan_viewport_test(float device_scale_factor);
306 void pinch_zoom_pan_viewport_and_scroll_test(float device_scale_factor); 306 void pinch_zoom_pan_viewport_and_scroll_test(float device_scale_factor);
307 void pinch_zoom_pan_viewport_and_scroll_boundary_test( 307 void pinch_zoom_pan_viewport_and_scroll_boundary_test(
308 float device_scale_factor); 308 float device_scale_factor);
309 309
310 void CheckNotifyCalledIfCanDrawChanged(bool always_draw) { 310 void CheckNotifyCalledIfCanDrawChanged(bool always_draw) {
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>( 1703 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(
1704 host_impl_->active_tree()->root_layer()); 1704 host_impl_->active_tree()->root_layer());
1705 1705
1706 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); 1706 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
1707 DidDrawCheckLayer* layer = 1707 DidDrawCheckLayer* layer =
1708 static_cast<DidDrawCheckLayer*>(root->children()[0]); 1708 static_cast<DidDrawCheckLayer*>(root->children()[0]);
1709 1709
1710 { 1710 {
1711 LayerTreeHostImpl::FrameData frame; 1711 LayerTreeHostImpl::FrameData frame;
1712 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1712 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1713 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1713 host_impl_->DrawLayers(&frame);
1714 host_impl_->DidDrawAllLayers(frame); 1714 host_impl_->DidDrawAllLayers(frame);
1715 1715
1716 EXPECT_TRUE(layer->will_draw_called()); 1716 EXPECT_TRUE(layer->will_draw_called());
1717 EXPECT_TRUE(layer->append_quads_called()); 1717 EXPECT_TRUE(layer->append_quads_called());
1718 EXPECT_TRUE(layer->did_draw_called()); 1718 EXPECT_TRUE(layer->did_draw_called());
1719 } 1719 }
1720 1720
1721 host_impl_->SetViewportDamage(gfx::Rect(10, 10)); 1721 host_impl_->SetViewportDamage(gfx::Rect(10, 10));
1722 1722
1723 { 1723 {
1724 LayerTreeHostImpl::FrameData frame; 1724 LayerTreeHostImpl::FrameData frame;
1725 1725
1726 layer->set_will_draw_returns_false(); 1726 layer->set_will_draw_returns_false();
1727 layer->ClearDidDrawCheck(); 1727 layer->ClearDidDrawCheck();
1728 1728
1729 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1729 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1730 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1730 host_impl_->DrawLayers(&frame);
1731 host_impl_->DidDrawAllLayers(frame); 1731 host_impl_->DidDrawAllLayers(frame);
1732 1732
1733 EXPECT_TRUE(layer->will_draw_called()); 1733 EXPECT_TRUE(layer->will_draw_called());
1734 EXPECT_FALSE(layer->append_quads_called()); 1734 EXPECT_FALSE(layer->append_quads_called());
1735 EXPECT_FALSE(layer->did_draw_called()); 1735 EXPECT_FALSE(layer->did_draw_called());
1736 } 1736 }
1737 } 1737 }
1738 1738
1739 TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) { 1739 TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) {
1740 // The root layer is always drawn, so run this test on a child layer that 1740 // The root layer is always drawn, so run this test on a child layer that
(...skipping 11 matching lines...) Expand all
1752 layer->SetPosition(gfx::PointF(100.f, 100.f)); 1752 layer->SetPosition(gfx::PointF(100.f, 100.f));
1753 layer->SetBounds(gfx::Size(10, 10)); 1753 layer->SetBounds(gfx::Size(10, 10));
1754 layer->SetContentBounds(gfx::Size(10, 10)); 1754 layer->SetContentBounds(gfx::Size(10, 10));
1755 1755
1756 LayerTreeHostImpl::FrameData frame; 1756 LayerTreeHostImpl::FrameData frame;
1757 1757
1758 EXPECT_FALSE(layer->will_draw_called()); 1758 EXPECT_FALSE(layer->will_draw_called());
1759 EXPECT_FALSE(layer->did_draw_called()); 1759 EXPECT_FALSE(layer->did_draw_called());
1760 1760
1761 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1761 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1762 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1762 host_impl_->DrawLayers(&frame);
1763 host_impl_->DidDrawAllLayers(frame); 1763 host_impl_->DidDrawAllLayers(frame);
1764 1764
1765 EXPECT_FALSE(layer->will_draw_called()); 1765 EXPECT_FALSE(layer->will_draw_called());
1766 EXPECT_FALSE(layer->did_draw_called()); 1766 EXPECT_FALSE(layer->did_draw_called());
1767 1767
1768 EXPECT_TRUE(layer->visible_content_rect().IsEmpty()); 1768 EXPECT_TRUE(layer->visible_content_rect().IsEmpty());
1769 1769
1770 // Ensure visible_content_rect for layer is not empty 1770 // Ensure visible_content_rect for layer is not empty
1771 layer->SetPosition(gfx::PointF()); 1771 layer->SetPosition(gfx::PointF());
1772 1772
1773 EXPECT_FALSE(layer->will_draw_called()); 1773 EXPECT_FALSE(layer->will_draw_called());
1774 EXPECT_FALSE(layer->did_draw_called()); 1774 EXPECT_FALSE(layer->did_draw_called());
1775 1775
1776 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1776 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1777 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1777 host_impl_->DrawLayers(&frame);
1778 host_impl_->DidDrawAllLayers(frame); 1778 host_impl_->DidDrawAllLayers(frame);
1779 1779
1780 EXPECT_TRUE(layer->will_draw_called()); 1780 EXPECT_TRUE(layer->will_draw_called());
1781 EXPECT_TRUE(layer->did_draw_called()); 1781 EXPECT_TRUE(layer->did_draw_called());
1782 1782
1783 EXPECT_FALSE(layer->visible_content_rect().IsEmpty()); 1783 EXPECT_FALSE(layer->visible_content_rect().IsEmpty());
1784 } 1784 }
1785 1785
1786 TEST_F(LayerTreeHostImplTest, WillDrawNotCalledOnOccludedLayer) { 1786 TEST_F(LayerTreeHostImplTest, WillDrawNotCalledOnOccludedLayer) {
1787 gfx::Size big_size(1000, 1000); 1787 gfx::Size big_size(1000, 1000);
(...skipping 18 matching lines...) Expand all
1806 top_layer->SetContentsOpaque(true); 1806 top_layer->SetContentsOpaque(true);
1807 1807
1808 LayerTreeHostImpl::FrameData frame; 1808 LayerTreeHostImpl::FrameData frame;
1809 1809
1810 EXPECT_FALSE(occluded_layer->will_draw_called()); 1810 EXPECT_FALSE(occluded_layer->will_draw_called());
1811 EXPECT_FALSE(occluded_layer->did_draw_called()); 1811 EXPECT_FALSE(occluded_layer->did_draw_called());
1812 EXPECT_FALSE(top_layer->will_draw_called()); 1812 EXPECT_FALSE(top_layer->will_draw_called());
1813 EXPECT_FALSE(top_layer->did_draw_called()); 1813 EXPECT_FALSE(top_layer->did_draw_called());
1814 1814
1815 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1815 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1816 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1816 host_impl_->DrawLayers(&frame);
1817 host_impl_->DidDrawAllLayers(frame); 1817 host_impl_->DidDrawAllLayers(frame);
1818 1818
1819 EXPECT_FALSE(occluded_layer->will_draw_called()); 1819 EXPECT_FALSE(occluded_layer->will_draw_called());
1820 EXPECT_FALSE(occluded_layer->did_draw_called()); 1820 EXPECT_FALSE(occluded_layer->did_draw_called());
1821 EXPECT_TRUE(top_layer->will_draw_called()); 1821 EXPECT_TRUE(top_layer->will_draw_called());
1822 EXPECT_TRUE(top_layer->did_draw_called()); 1822 EXPECT_TRUE(top_layer->did_draw_called());
1823 } 1823 }
1824 1824
1825 TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) { 1825 TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) {
1826 host_impl_->active_tree()->SetRootLayer( 1826 host_impl_->active_tree()->SetRootLayer(
(...skipping 11 matching lines...) Expand all
1838 1838
1839 layer1->SetOpacity(0.3f); 1839 layer1->SetOpacity(0.3f);
1840 layer1->SetShouldFlattenTransform(true); 1840 layer1->SetShouldFlattenTransform(true);
1841 1841
1842 EXPECT_FALSE(root->did_draw_called()); 1842 EXPECT_FALSE(root->did_draw_called());
1843 EXPECT_FALSE(layer1->did_draw_called()); 1843 EXPECT_FALSE(layer1->did_draw_called());
1844 EXPECT_FALSE(layer2->did_draw_called()); 1844 EXPECT_FALSE(layer2->did_draw_called());
1845 1845
1846 LayerTreeHostImpl::FrameData frame; 1846 LayerTreeHostImpl::FrameData frame;
1847 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1847 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1848 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1848 host_impl_->DrawLayers(&frame);
1849 host_impl_->DidDrawAllLayers(frame); 1849 host_impl_->DidDrawAllLayers(frame);
1850 1850
1851 EXPECT_TRUE(root->did_draw_called()); 1851 EXPECT_TRUE(root->did_draw_called());
1852 EXPECT_TRUE(layer1->did_draw_called()); 1852 EXPECT_TRUE(layer1->did_draw_called());
1853 EXPECT_TRUE(layer2->did_draw_called()); 1853 EXPECT_TRUE(layer2->did_draw_called());
1854 1854
1855 EXPECT_NE(root->render_surface(), layer1->render_surface()); 1855 EXPECT_NE(root->render_surface(), layer1->render_surface());
1856 EXPECT_TRUE(!!layer1->render_surface()); 1856 EXPECT_TRUE(!!layer1->render_surface());
1857 } 1857 }
1858 1858
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 1914 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
1915 2, 1915 2,
1916 tile_missing, 1916 tile_missing,
1917 had_incomplete_tile, 1917 had_incomplete_tile,
1918 is_animating, 1918 is_animating,
1919 host_impl_->resource_provider())); 1919 host_impl_->resource_provider()));
1920 1920
1921 LayerTreeHostImpl::FrameData frame; 1921 LayerTreeHostImpl::FrameData frame;
1922 1922
1923 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1923 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1924 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1924 host_impl_->DrawLayers(&frame);
1925 host_impl_->DidDrawAllLayers(frame); 1925 host_impl_->DidDrawAllLayers(frame);
1926 } 1926 }
1927 1927
1928 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) { 1928 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) {
1929 host_impl_->active_tree()->SetRootLayer( 1929 host_impl_->active_tree()->SetRootLayer(
1930 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); 1930 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1));
1931 DidDrawCheckLayer* root = 1931 DidDrawCheckLayer* root =
1932 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 1932 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
1933 bool tile_missing = false; 1933 bool tile_missing = false;
1934 bool had_incomplete_tile = false; 1934 bool had_incomplete_tile = false;
1935 bool is_animating = true; 1935 bool is_animating = true;
1936 root->AddChild( 1936 root->AddChild(
1937 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 1937 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
1938 2, 1938 2,
1939 tile_missing, 1939 tile_missing,
1940 had_incomplete_tile, 1940 had_incomplete_tile,
1941 is_animating, 1941 is_animating,
1942 host_impl_->resource_provider())); 1942 host_impl_->resource_provider()));
1943 1943
1944 LayerTreeHostImpl::FrameData frame; 1944 LayerTreeHostImpl::FrameData frame;
1945 1945
1946 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1946 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1947 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1947 host_impl_->DrawLayers(&frame);
1948 host_impl_->DidDrawAllLayers(frame); 1948 host_impl_->DidDrawAllLayers(frame);
1949 } 1949 }
1950 1950
1951 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) { 1951 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) {
1952 host_impl_->active_tree()->SetRootLayer( 1952 host_impl_->active_tree()->SetRootLayer(
1953 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); 1953 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
1954 DidDrawCheckLayer* root = 1954 DidDrawCheckLayer* root =
1955 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 1955 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
1956 1956
1957 bool tile_missing = true; 1957 bool tile_missing = true;
1958 bool had_incomplete_tile = false; 1958 bool had_incomplete_tile = false;
1959 bool is_animating = false; 1959 bool is_animating = false;
1960 root->AddChild( 1960 root->AddChild(
1961 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 1961 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
1962 4, 1962 4,
1963 tile_missing, 1963 tile_missing,
1964 had_incomplete_tile, 1964 had_incomplete_tile,
1965 is_animating, 1965 is_animating,
1966 host_impl_->resource_provider())); 1966 host_impl_->resource_provider()));
1967 LayerTreeHostImpl::FrameData frame; 1967 LayerTreeHostImpl::FrameData frame;
1968 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1968 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1969 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1969 host_impl_->DrawLayers(&frame);
1970 host_impl_->DidDrawAllLayers(frame); 1970 host_impl_->DidDrawAllLayers(frame);
1971 } 1971 }
1972 1972
1973 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) { 1973 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) {
1974 host_impl_->active_tree()->SetRootLayer( 1974 host_impl_->active_tree()->SetRootLayer(
1975 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); 1975 DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
1976 DidDrawCheckLayer* root = 1976 DidDrawCheckLayer* root =
1977 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 1977 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
1978 1978
1979 bool tile_missing = false; 1979 bool tile_missing = false;
1980 bool had_incomplete_tile = true; 1980 bool had_incomplete_tile = true;
1981 bool is_animating = false; 1981 bool is_animating = false;
1982 root->AddChild( 1982 root->AddChild(
1983 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 1983 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
1984 4, 1984 4,
1985 tile_missing, 1985 tile_missing,
1986 had_incomplete_tile, 1986 had_incomplete_tile,
1987 is_animating, 1987 is_animating,
1988 host_impl_->resource_provider())); 1988 host_impl_->resource_provider()));
1989 LayerTreeHostImpl::FrameData frame; 1989 LayerTreeHostImpl::FrameData frame;
1990 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 1990 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
1991 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 1991 host_impl_->DrawLayers(&frame);
1992 host_impl_->DidDrawAllLayers(frame); 1992 host_impl_->DidDrawAllLayers(frame);
1993 } 1993 }
1994 1994
1995 TEST_F(LayerTreeHostImplTest, 1995 TEST_F(LayerTreeHostImplTest,
1996 PrepareToDrawFailsWithAnimationAndMissingTilesUsesCheckerboard) { 1996 PrepareToDrawFailsWithAnimationAndMissingTilesUsesCheckerboard) {
1997 host_impl_->active_tree()->SetRootLayer( 1997 host_impl_->active_tree()->SetRootLayer(
1998 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); 1998 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5));
1999 DidDrawCheckLayer* root = 1999 DidDrawCheckLayer* root =
2000 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 2000 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2001 bool tile_missing = true; 2001 bool tile_missing = true;
2002 bool had_incomplete_tile = false; 2002 bool had_incomplete_tile = false;
2003 bool is_animating = true; 2003 bool is_animating = true;
2004 root->AddChild( 2004 root->AddChild(
2005 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 2005 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2006 6, 2006 6,
2007 tile_missing, 2007 tile_missing,
2008 had_incomplete_tile, 2008 had_incomplete_tile,
2009 is_animating, 2009 is_animating,
2010 host_impl_->resource_provider())); 2010 host_impl_->resource_provider()));
2011 LayerTreeHostImpl::FrameData frame; 2011 LayerTreeHostImpl::FrameData frame;
2012 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS, 2012 EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS,
2013 host_impl_->PrepareToDraw(&frame)); 2013 host_impl_->PrepareToDraw(&frame));
2014 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2014 host_impl_->DrawLayers(&frame);
2015 host_impl_->DidDrawAllLayers(frame); 2015 host_impl_->DidDrawAllLayers(frame);
2016 } 2016 }
2017 2017
2018 TEST_F(LayerTreeHostImplTest, 2018 TEST_F(LayerTreeHostImplTest,
2019 PrepareToDrawSucceedsWithAnimationAndIncompleteTiles) { 2019 PrepareToDrawSucceedsWithAnimationAndIncompleteTiles) {
2020 host_impl_->active_tree()->SetRootLayer( 2020 host_impl_->active_tree()->SetRootLayer(
2021 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5)); 2021 DidDrawCheckLayer::Create(host_impl_->active_tree(), 5));
2022 DidDrawCheckLayer* root = 2022 DidDrawCheckLayer* root =
2023 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 2023 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2024 bool tile_missing = false; 2024 bool tile_missing = false;
2025 bool had_incomplete_tile = true; 2025 bool had_incomplete_tile = true;
2026 bool is_animating = true; 2026 bool is_animating = true;
2027 root->AddChild( 2027 root->AddChild(
2028 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 2028 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2029 6, 2029 6,
2030 tile_missing, 2030 tile_missing,
2031 had_incomplete_tile, 2031 had_incomplete_tile,
2032 is_animating, 2032 is_animating,
2033 host_impl_->resource_provider())); 2033 host_impl_->resource_provider()));
2034 LayerTreeHostImpl::FrameData frame; 2034 LayerTreeHostImpl::FrameData frame;
2035 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 2035 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2036 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2036 host_impl_->DrawLayers(&frame);
2037 host_impl_->DidDrawAllLayers(frame); 2037 host_impl_->DidDrawAllLayers(frame);
2038 } 2038 }
2039 2039
2040 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) { 2040 TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) {
2041 host_impl_->active_tree()->SetRootLayer( 2041 host_impl_->active_tree()->SetRootLayer(
2042 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); 2042 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
2043 DidDrawCheckLayer* root = 2043 DidDrawCheckLayer* root =
2044 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 2044 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2045 bool tile_missing = false; 2045 bool tile_missing = false;
2046 bool had_incomplete_tile = false; 2046 bool had_incomplete_tile = false;
2047 bool is_animating = false; 2047 bool is_animating = false;
2048 root->AddChild( 2048 root->AddChild(
2049 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 2049 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2050 8, 2050 8,
2051 tile_missing, 2051 tile_missing,
2052 had_incomplete_tile, 2052 had_incomplete_tile,
2053 is_animating, 2053 is_animating,
2054 host_impl_->resource_provider())); 2054 host_impl_->resource_provider()));
2055 host_impl_->active_tree()->SetRequiresHighResToDraw(); 2055 host_impl_->active_tree()->SetRequiresHighResToDraw();
2056 LayerTreeHostImpl::FrameData frame; 2056 LayerTreeHostImpl::FrameData frame;
2057 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 2057 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2058 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2058 host_impl_->DrawLayers(&frame);
2059 host_impl_->DidDrawAllLayers(frame); 2059 host_impl_->DidDrawAllLayers(frame);
2060 } 2060 }
2061 2061
2062 TEST_F(LayerTreeHostImplTest, 2062 TEST_F(LayerTreeHostImplTest,
2063 PrepareToDrawFailsWhenHighResRequiredAndIncompleteTiles) { 2063 PrepareToDrawFailsWhenHighResRequiredAndIncompleteTiles) {
2064 host_impl_->active_tree()->SetRootLayer( 2064 host_impl_->active_tree()->SetRootLayer(
2065 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); 2065 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
2066 DidDrawCheckLayer* root = 2066 DidDrawCheckLayer* root =
2067 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 2067 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2068 bool tile_missing = false; 2068 bool tile_missing = false;
2069 bool had_incomplete_tile = true; 2069 bool had_incomplete_tile = true;
2070 bool is_animating = false; 2070 bool is_animating = false;
2071 root->AddChild( 2071 root->AddChild(
2072 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 2072 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2073 8, 2073 8,
2074 tile_missing, 2074 tile_missing,
2075 had_incomplete_tile, 2075 had_incomplete_tile,
2076 is_animating, 2076 is_animating,
2077 host_impl_->resource_provider())); 2077 host_impl_->resource_provider()));
2078 host_impl_->active_tree()->SetRequiresHighResToDraw(); 2078 host_impl_->active_tree()->SetRequiresHighResToDraw();
2079 LayerTreeHostImpl::FrameData frame; 2079 LayerTreeHostImpl::FrameData frame;
2080 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, 2080 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT,
2081 host_impl_->PrepareToDraw(&frame)); 2081 host_impl_->PrepareToDraw(&frame));
2082 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2082 host_impl_->DrawLayers(&frame);
2083 host_impl_->DidDrawAllLayers(frame); 2083 host_impl_->DidDrawAllLayers(frame);
2084 } 2084 }
2085 2085
2086 TEST_F(LayerTreeHostImplTest, 2086 TEST_F(LayerTreeHostImplTest,
2087 PrepareToDrawSucceedsWhenHighResRequiredAndMissingTile) { 2087 PrepareToDrawSucceedsWhenHighResRequiredAndMissingTile) {
2088 host_impl_->active_tree()->SetRootLayer( 2088 host_impl_->active_tree()->SetRootLayer(
2089 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); 2089 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
2090 DidDrawCheckLayer* root = 2090 DidDrawCheckLayer* root =
2091 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); 2091 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
2092 bool tile_missing = true; 2092 bool tile_missing = true;
2093 bool had_incomplete_tile = false; 2093 bool had_incomplete_tile = false;
2094 bool is_animating = false; 2094 bool is_animating = false;
2095 root->AddChild( 2095 root->AddChild(
2096 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), 2096 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(),
2097 8, 2097 8,
2098 tile_missing, 2098 tile_missing,
2099 had_incomplete_tile, 2099 had_incomplete_tile,
2100 is_animating, 2100 is_animating,
2101 host_impl_->resource_provider())); 2101 host_impl_->resource_provider()));
2102 host_impl_->active_tree()->SetRequiresHighResToDraw(); 2102 host_impl_->active_tree()->SetRequiresHighResToDraw();
2103 LayerTreeHostImpl::FrameData frame; 2103 LayerTreeHostImpl::FrameData frame;
2104 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 2104 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2105 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2105 host_impl_->DrawLayers(&frame);
2106 host_impl_->DidDrawAllLayers(frame); 2106 host_impl_->DidDrawAllLayers(frame);
2107 } 2107 }
2108 2108
2109 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { 2109 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) {
2110 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); 2110 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
2111 root->SetScrollClipLayer(Layer::INVALID_ID); 2111 root->SetScrollClipLayer(Layer::INVALID_ID);
2112 host_impl_->active_tree()->SetRootLayer(root.Pass()); 2112 host_impl_->active_tree()->SetRootLayer(root.Pass());
2113 DrawFrame(); 2113 DrawFrame();
2114 2114
2115 // Scroll event is ignored because layer is not scrollable. 2115 // Scroll event is ignored because layer is not scrollable.
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 EXPECT_EQ(1.f, scroll->contents_scale_y()); 2544 EXPECT_EQ(1.f, scroll->contents_scale_y());
2545 EXPECT_EQ(1.f, child->contents_scale_x()); 2545 EXPECT_EQ(1.f, child->contents_scale_x());
2546 EXPECT_EQ(1.f, child->contents_scale_y()); 2546 EXPECT_EQ(1.f, child->contents_scale_y());
2547 EXPECT_EQ(1.f, grand_child->contents_scale_x()); 2547 EXPECT_EQ(1.f, grand_child->contents_scale_x());
2548 EXPECT_EQ(1.f, grand_child->contents_scale_y()); 2548 EXPECT_EQ(1.f, grand_child->contents_scale_y());
2549 2549
2550 // Make sure all the layers are drawn with the page scale delta applied, i.e., 2550 // Make sure all the layers are drawn with the page scale delta applied, i.e.,
2551 // the page scale delta on the root layer is applied hierarchically. 2551 // the page scale delta on the root layer is applied hierarchically.
2552 LayerTreeHostImpl::FrameData frame; 2552 LayerTreeHostImpl::FrameData frame;
2553 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 2553 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
2554 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 2554 host_impl_->DrawLayers(&frame);
2555 host_impl_->DidDrawAllLayers(frame); 2555 host_impl_->DidDrawAllLayers(frame);
2556 2556
2557 EXPECT_EQ(1.f, root->draw_transform().matrix().getDouble(0, 0)); 2557 EXPECT_EQ(1.f, root->draw_transform().matrix().getDouble(0, 0));
2558 EXPECT_EQ(1.f, root->draw_transform().matrix().getDouble(1, 1)); 2558 EXPECT_EQ(1.f, root->draw_transform().matrix().getDouble(1, 1));
2559 EXPECT_EQ(new_page_scale, scroll->draw_transform().matrix().getDouble(0, 0)); 2559 EXPECT_EQ(new_page_scale, scroll->draw_transform().matrix().getDouble(0, 0));
2560 EXPECT_EQ(new_page_scale, scroll->draw_transform().matrix().getDouble(1, 1)); 2560 EXPECT_EQ(new_page_scale, scroll->draw_transform().matrix().getDouble(1, 1));
2561 EXPECT_EQ(new_page_scale, child->draw_transform().matrix().getDouble(0, 0)); 2561 EXPECT_EQ(new_page_scale, child->draw_transform().matrix().getDouble(0, 0));
2562 EXPECT_EQ(new_page_scale, child->draw_transform().matrix().getDouble(1, 1)); 2562 EXPECT_EQ(new_page_scale, child->draw_transform().matrix().getDouble(1, 1));
2563 EXPECT_EQ(new_page_scale, 2563 EXPECT_EQ(new_page_scale,
2564 grand_child->draw_transform().matrix().getDouble(0, 0)); 2564 grand_child->draw_transform().matrix().getDouble(0, 0));
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
3575 static_cast<BlendStateCheckLayer*>(root->children()[0]); 3575 static_cast<BlendStateCheckLayer*>(root->children()[0]);
3576 layer1->SetPosition(gfx::PointF(2.f, 2.f)); 3576 layer1->SetPosition(gfx::PointF(2.f, 2.f));
3577 3577
3578 LayerTreeHostImpl::FrameData frame; 3578 LayerTreeHostImpl::FrameData frame;
3579 3579
3580 // Opaque layer, drawn without blending. 3580 // Opaque layer, drawn without blending.
3581 layer1->SetContentsOpaque(true); 3581 layer1->SetContentsOpaque(true);
3582 layer1->SetExpectation(false, false); 3582 layer1->SetExpectation(false, false);
3583 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3583 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3584 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3584 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3585 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3585 host_impl_->DrawLayers(&frame);
3586 EXPECT_TRUE(layer1->quads_appended()); 3586 EXPECT_TRUE(layer1->quads_appended());
3587 host_impl_->DidDrawAllLayers(frame); 3587 host_impl_->DidDrawAllLayers(frame);
3588 3588
3589 // Layer with translucent content and painting, so drawn with blending. 3589 // Layer with translucent content and painting, so drawn with blending.
3590 layer1->SetContentsOpaque(false); 3590 layer1->SetContentsOpaque(false);
3591 layer1->SetExpectation(true, false); 3591 layer1->SetExpectation(true, false);
3592 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3592 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3593 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3593 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3594 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3594 host_impl_->DrawLayers(&frame);
3595 EXPECT_TRUE(layer1->quads_appended()); 3595 EXPECT_TRUE(layer1->quads_appended());
3596 host_impl_->DidDrawAllLayers(frame); 3596 host_impl_->DidDrawAllLayers(frame);
3597 3597
3598 // Layer with translucent opacity, drawn with blending. 3598 // Layer with translucent opacity, drawn with blending.
3599 layer1->SetContentsOpaque(true); 3599 layer1->SetContentsOpaque(true);
3600 layer1->SetOpacity(0.5f); 3600 layer1->SetOpacity(0.5f);
3601 layer1->SetExpectation(true, false); 3601 layer1->SetExpectation(true, false);
3602 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3602 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3603 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3603 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3604 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3604 host_impl_->DrawLayers(&frame);
3605 EXPECT_TRUE(layer1->quads_appended()); 3605 EXPECT_TRUE(layer1->quads_appended());
3606 host_impl_->DidDrawAllLayers(frame); 3606 host_impl_->DidDrawAllLayers(frame);
3607 3607
3608 // Layer with translucent opacity and painting, drawn with blending. 3608 // Layer with translucent opacity and painting, drawn with blending.
3609 layer1->SetContentsOpaque(true); 3609 layer1->SetContentsOpaque(true);
3610 layer1->SetOpacity(0.5f); 3610 layer1->SetOpacity(0.5f);
3611 layer1->SetExpectation(true, false); 3611 layer1->SetExpectation(true, false);
3612 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3612 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3613 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3613 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3614 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3614 host_impl_->DrawLayers(&frame);
3615 EXPECT_TRUE(layer1->quads_appended()); 3615 EXPECT_TRUE(layer1->quads_appended());
3616 host_impl_->DidDrawAllLayers(frame); 3616 host_impl_->DidDrawAllLayers(frame);
3617 3617
3618 layer1->AddChild( 3618 layer1->AddChild(
3619 BlendStateCheckLayer::Create(host_impl_->active_tree(), 3619 BlendStateCheckLayer::Create(host_impl_->active_tree(),
3620 3, 3620 3,
3621 host_impl_->resource_provider())); 3621 host_impl_->resource_provider()));
3622 BlendStateCheckLayer* layer2 = 3622 BlendStateCheckLayer* layer2 =
3623 static_cast<BlendStateCheckLayer*>(layer1->children()[0]); 3623 static_cast<BlendStateCheckLayer*>(layer1->children()[0]);
3624 layer2->SetPosition(gfx::PointF(4.f, 4.f)); 3624 layer2->SetPosition(gfx::PointF(4.f, 4.f));
3625 3625
3626 // 2 opaque layers, drawn without blending. 3626 // 2 opaque layers, drawn without blending.
3627 layer1->SetContentsOpaque(true); 3627 layer1->SetContentsOpaque(true);
3628 layer1->SetOpacity(1.f); 3628 layer1->SetOpacity(1.f);
3629 layer1->SetExpectation(false, false); 3629 layer1->SetExpectation(false, false);
3630 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3630 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3631 layer2->SetContentsOpaque(true); 3631 layer2->SetContentsOpaque(true);
3632 layer2->SetOpacity(1.f); 3632 layer2->SetOpacity(1.f);
3633 layer2->SetExpectation(false, false); 3633 layer2->SetExpectation(false, false);
3634 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3634 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3635 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3635 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3636 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3636 host_impl_->DrawLayers(&frame);
3637 EXPECT_TRUE(layer1->quads_appended()); 3637 EXPECT_TRUE(layer1->quads_appended());
3638 EXPECT_TRUE(layer2->quads_appended()); 3638 EXPECT_TRUE(layer2->quads_appended());
3639 host_impl_->DidDrawAllLayers(frame); 3639 host_impl_->DidDrawAllLayers(frame);
3640 3640
3641 // Parent layer with translucent content, drawn with blending. 3641 // Parent layer with translucent content, drawn with blending.
3642 // Child layer with opaque content, drawn without blending. 3642 // Child layer with opaque content, drawn without blending.
3643 layer1->SetContentsOpaque(false); 3643 layer1->SetContentsOpaque(false);
3644 layer1->SetExpectation(true, false); 3644 layer1->SetExpectation(true, false);
3645 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3645 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3646 layer2->SetExpectation(false, false); 3646 layer2->SetExpectation(false, false);
3647 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3647 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3648 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3648 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3649 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3649 host_impl_->DrawLayers(&frame);
3650 EXPECT_TRUE(layer1->quads_appended()); 3650 EXPECT_TRUE(layer1->quads_appended());
3651 EXPECT_TRUE(layer2->quads_appended()); 3651 EXPECT_TRUE(layer2->quads_appended());
3652 host_impl_->DidDrawAllLayers(frame); 3652 host_impl_->DidDrawAllLayers(frame);
3653 3653
3654 // Parent layer with translucent content but opaque painting, drawn without 3654 // Parent layer with translucent content but opaque painting, drawn without
3655 // blending. 3655 // blending.
3656 // Child layer with opaque content, drawn without blending. 3656 // Child layer with opaque content, drawn without blending.
3657 layer1->SetContentsOpaque(true); 3657 layer1->SetContentsOpaque(true);
3658 layer1->SetExpectation(false, false); 3658 layer1->SetExpectation(false, false);
3659 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3659 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3660 layer2->SetExpectation(false, false); 3660 layer2->SetExpectation(false, false);
3661 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3661 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3662 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3662 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3663 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3663 host_impl_->DrawLayers(&frame);
3664 EXPECT_TRUE(layer1->quads_appended()); 3664 EXPECT_TRUE(layer1->quads_appended());
3665 EXPECT_TRUE(layer2->quads_appended()); 3665 EXPECT_TRUE(layer2->quads_appended());
3666 host_impl_->DidDrawAllLayers(frame); 3666 host_impl_->DidDrawAllLayers(frame);
3667 3667
3668 // Parent layer with translucent opacity and opaque content. Since it has a 3668 // Parent layer with translucent opacity and opaque content. Since it has a
3669 // drawing child, it's drawn to a render surface which carries the opacity, 3669 // drawing child, it's drawn to a render surface which carries the opacity,
3670 // so it's itself drawn without blending. 3670 // so it's itself drawn without blending.
3671 // Child layer with opaque content, drawn without blending (parent surface 3671 // Child layer with opaque content, drawn without blending (parent surface
3672 // carries the inherited opacity). 3672 // carries the inherited opacity).
3673 layer1->SetContentsOpaque(true); 3673 layer1->SetContentsOpaque(true);
3674 layer1->SetOpacity(0.5f); 3674 layer1->SetOpacity(0.5f);
3675 layer1->SetExpectation(false, true); 3675 layer1->SetExpectation(false, true);
3676 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3676 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3677 layer2->SetExpectation(false, false); 3677 layer2->SetExpectation(false, false);
3678 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3678 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3679 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3679 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3680 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3680 host_impl_->DrawLayers(&frame);
3681 EXPECT_TRUE(layer1->quads_appended()); 3681 EXPECT_TRUE(layer1->quads_appended());
3682 EXPECT_TRUE(layer2->quads_appended()); 3682 EXPECT_TRUE(layer2->quads_appended());
3683 host_impl_->DidDrawAllLayers(frame); 3683 host_impl_->DidDrawAllLayers(frame);
3684 3684
3685 // Draw again, but with child non-opaque, to make sure 3685 // Draw again, but with child non-opaque, to make sure
3686 // layer1 not culled. 3686 // layer1 not culled.
3687 layer1->SetContentsOpaque(true); 3687 layer1->SetContentsOpaque(true);
3688 layer1->SetOpacity(1.f); 3688 layer1->SetOpacity(1.f);
3689 layer1->SetExpectation(false, false); 3689 layer1->SetExpectation(false, false);
3690 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3690 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3691 layer2->SetContentsOpaque(true); 3691 layer2->SetContentsOpaque(true);
3692 layer2->SetOpacity(0.5f); 3692 layer2->SetOpacity(0.5f);
3693 layer2->SetExpectation(true, false); 3693 layer2->SetExpectation(true, false);
3694 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3694 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3695 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3695 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3696 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3696 host_impl_->DrawLayers(&frame);
3697 EXPECT_TRUE(layer1->quads_appended()); 3697 EXPECT_TRUE(layer1->quads_appended());
3698 EXPECT_TRUE(layer2->quads_appended()); 3698 EXPECT_TRUE(layer2->quads_appended());
3699 host_impl_->DidDrawAllLayers(frame); 3699 host_impl_->DidDrawAllLayers(frame);
3700 3700
3701 // A second way of making the child non-opaque. 3701 // A second way of making the child non-opaque.
3702 layer1->SetContentsOpaque(true); 3702 layer1->SetContentsOpaque(true);
3703 layer1->SetOpacity(1.f); 3703 layer1->SetOpacity(1.f);
3704 layer1->SetExpectation(false, false); 3704 layer1->SetExpectation(false, false);
3705 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3705 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3706 layer2->SetContentsOpaque(false); 3706 layer2->SetContentsOpaque(false);
3707 layer2->SetOpacity(1.f); 3707 layer2->SetOpacity(1.f);
3708 layer2->SetExpectation(true, false); 3708 layer2->SetExpectation(true, false);
3709 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3709 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3710 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3710 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3711 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3711 host_impl_->DrawLayers(&frame);
3712 EXPECT_TRUE(layer1->quads_appended()); 3712 EXPECT_TRUE(layer1->quads_appended());
3713 EXPECT_TRUE(layer2->quads_appended()); 3713 EXPECT_TRUE(layer2->quads_appended());
3714 host_impl_->DidDrawAllLayers(frame); 3714 host_impl_->DidDrawAllLayers(frame);
3715 3715
3716 // And when the layer says its not opaque but is painted opaque, it is not 3716 // And when the layer says its not opaque but is painted opaque, it is not
3717 // blended. 3717 // blended.
3718 layer1->SetContentsOpaque(true); 3718 layer1->SetContentsOpaque(true);
3719 layer1->SetOpacity(1.f); 3719 layer1->SetOpacity(1.f);
3720 layer1->SetExpectation(false, false); 3720 layer1->SetExpectation(false, false);
3721 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3721 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3722 layer2->SetContentsOpaque(true); 3722 layer2->SetContentsOpaque(true);
3723 layer2->SetOpacity(1.f); 3723 layer2->SetOpacity(1.f);
3724 layer2->SetExpectation(false, false); 3724 layer2->SetExpectation(false, false);
3725 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3725 layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3726 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3726 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3727 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3727 host_impl_->DrawLayers(&frame);
3728 EXPECT_TRUE(layer1->quads_appended()); 3728 EXPECT_TRUE(layer1->quads_appended());
3729 EXPECT_TRUE(layer2->quads_appended()); 3729 EXPECT_TRUE(layer2->quads_appended());
3730 host_impl_->DidDrawAllLayers(frame); 3730 host_impl_->DidDrawAllLayers(frame);
3731 3731
3732 // Layer with partially opaque contents, drawn with blending. 3732 // Layer with partially opaque contents, drawn with blending.
3733 layer1->SetContentsOpaque(false); 3733 layer1->SetContentsOpaque(false);
3734 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); 3734 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
3735 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 5)); 3735 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 5));
3736 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); 3736 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
3737 layer1->SetExpectation(true, false); 3737 layer1->SetExpectation(true, false);
3738 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3738 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3739 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3739 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3740 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3740 host_impl_->DrawLayers(&frame);
3741 EXPECT_TRUE(layer1->quads_appended()); 3741 EXPECT_TRUE(layer1->quads_appended());
3742 host_impl_->DidDrawAllLayers(frame); 3742 host_impl_->DidDrawAllLayers(frame);
3743 3743
3744 // Layer with partially opaque contents partially culled, drawn with blending. 3744 // Layer with partially opaque contents partially culled, drawn with blending.
3745 layer1->SetContentsOpaque(false); 3745 layer1->SetContentsOpaque(false);
3746 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); 3746 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
3747 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 2)); 3747 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 2));
3748 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); 3748 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
3749 layer1->SetExpectation(true, false); 3749 layer1->SetExpectation(true, false);
3750 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3750 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3751 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3751 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3752 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3752 host_impl_->DrawLayers(&frame);
3753 EXPECT_TRUE(layer1->quads_appended()); 3753 EXPECT_TRUE(layer1->quads_appended());
3754 host_impl_->DidDrawAllLayers(frame); 3754 host_impl_->DidDrawAllLayers(frame);
3755 3755
3756 // Layer with partially opaque contents culled, drawn with blending. 3756 // Layer with partially opaque contents culled, drawn with blending.
3757 layer1->SetContentsOpaque(false); 3757 layer1->SetContentsOpaque(false);
3758 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); 3758 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
3759 layer1->SetQuadVisibleRect(gfx::Rect(7, 5, 3, 5)); 3759 layer1->SetQuadVisibleRect(gfx::Rect(7, 5, 3, 5));
3760 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); 3760 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
3761 layer1->SetExpectation(true, false); 3761 layer1->SetExpectation(true, false);
3762 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3762 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3763 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3763 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3764 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3764 host_impl_->DrawLayers(&frame);
3765 EXPECT_TRUE(layer1->quads_appended()); 3765 EXPECT_TRUE(layer1->quads_appended());
3766 host_impl_->DidDrawAllLayers(frame); 3766 host_impl_->DidDrawAllLayers(frame);
3767 3767
3768 // Layer with partially opaque contents and translucent contents culled, drawn 3768 // Layer with partially opaque contents and translucent contents culled, drawn
3769 // without blending. 3769 // without blending.
3770 layer1->SetContentsOpaque(false); 3770 layer1->SetContentsOpaque(false);
3771 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); 3771 layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
3772 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 2, 5)); 3772 layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 2, 5));
3773 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); 3773 layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
3774 layer1->SetExpectation(false, false); 3774 layer1->SetExpectation(false, false);
3775 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); 3775 layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
3776 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 3776 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3777 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 3777 host_impl_->DrawLayers(&frame);
3778 EXPECT_TRUE(layer1->quads_appended()); 3778 EXPECT_TRUE(layer1->quads_appended());
3779 host_impl_->DidDrawAllLayers(frame); 3779 host_impl_->DidDrawAllLayers(frame);
3780 } 3780 }
3781 3781
3782 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest { 3782 class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
3783 protected: 3783 protected:
3784 LayerTreeHostImplViewportCoveredTest() : 3784 LayerTreeHostImplViewportCoveredTest() :
3785 gutter_quad_material_(DrawQuad::SOLID_COLOR), 3785 gutter_quad_material_(DrawQuad::SOLID_COLOR),
3786 child_(NULL), 3786 child_(NULL),
3787 did_activate_pending_tree_(false) {} 3787 did_activate_pending_tree_(false) {}
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
4090 root->SetContentBounds(gfx::Size(10, 10)); 4090 root->SetContentBounds(gfx::Size(10, 10));
4091 root->SetDrawsContent(true); 4091 root->SetDrawsContent(true);
4092 host_impl_->active_tree()->SetRootLayer(root.Pass()); 4092 host_impl_->active_tree()->SetRootLayer(root.Pass());
4093 EXPECT_FALSE(provider->TestContext3d()->reshape_called()); 4093 EXPECT_FALSE(provider->TestContext3d()->reshape_called());
4094 provider->TestContext3d()->clear_reshape_called(); 4094 provider->TestContext3d()->clear_reshape_called();
4095 4095
4096 LayerTreeHostImpl::FrameData frame; 4096 LayerTreeHostImpl::FrameData frame;
4097 host_impl_->SetViewportSize(gfx::Size(10, 10)); 4097 host_impl_->SetViewportSize(gfx::Size(10, 10));
4098 host_impl_->SetDeviceScaleFactor(1.f); 4098 host_impl_->SetDeviceScaleFactor(1.f);
4099 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4099 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4100 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4100 host_impl_->DrawLayers(&frame);
4101 EXPECT_TRUE(provider->TestContext3d()->reshape_called()); 4101 EXPECT_TRUE(provider->TestContext3d()->reshape_called());
4102 EXPECT_EQ(provider->TestContext3d()->width(), 10); 4102 EXPECT_EQ(provider->TestContext3d()->width(), 10);
4103 EXPECT_EQ(provider->TestContext3d()->height(), 10); 4103 EXPECT_EQ(provider->TestContext3d()->height(), 10);
4104 EXPECT_EQ(provider->TestContext3d()->scale_factor(), 1.f); 4104 EXPECT_EQ(provider->TestContext3d()->scale_factor(), 1.f);
4105 host_impl_->DidDrawAllLayers(frame); 4105 host_impl_->DidDrawAllLayers(frame);
4106 provider->TestContext3d()->clear_reshape_called(); 4106 provider->TestContext3d()->clear_reshape_called();
4107 4107
4108 host_impl_->SetViewportSize(gfx::Size(20, 30)); 4108 host_impl_->SetViewportSize(gfx::Size(20, 30));
4109 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4109 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4110 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4110 host_impl_->DrawLayers(&frame);
4111 EXPECT_TRUE(provider->TestContext3d()->reshape_called()); 4111 EXPECT_TRUE(provider->TestContext3d()->reshape_called());
4112 EXPECT_EQ(provider->TestContext3d()->width(), 20); 4112 EXPECT_EQ(provider->TestContext3d()->width(), 20);
4113 EXPECT_EQ(provider->TestContext3d()->height(), 30); 4113 EXPECT_EQ(provider->TestContext3d()->height(), 30);
4114 EXPECT_EQ(provider->TestContext3d()->scale_factor(), 1.f); 4114 EXPECT_EQ(provider->TestContext3d()->scale_factor(), 1.f);
4115 host_impl_->DidDrawAllLayers(frame); 4115 host_impl_->DidDrawAllLayers(frame);
4116 provider->TestContext3d()->clear_reshape_called(); 4116 provider->TestContext3d()->clear_reshape_called();
4117 4117
4118 host_impl_->SetDeviceScaleFactor(2.f); 4118 host_impl_->SetDeviceScaleFactor(2.f);
4119 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4119 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4120 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4120 host_impl_->DrawLayers(&frame);
4121 EXPECT_TRUE(provider->TestContext3d()->reshape_called()); 4121 EXPECT_TRUE(provider->TestContext3d()->reshape_called());
4122 EXPECT_EQ(provider->TestContext3d()->width(), 20); 4122 EXPECT_EQ(provider->TestContext3d()->width(), 20);
4123 EXPECT_EQ(provider->TestContext3d()->height(), 30); 4123 EXPECT_EQ(provider->TestContext3d()->height(), 30);
4124 EXPECT_EQ(provider->TestContext3d()->scale_factor(), 2.f); 4124 EXPECT_EQ(provider->TestContext3d()->scale_factor(), 2.f);
4125 host_impl_->DidDrawAllLayers(frame); 4125 host_impl_->DidDrawAllLayers(frame);
4126 provider->TestContext3d()->clear_reshape_called(); 4126 provider->TestContext3d()->clear_reshape_called();
4127 } 4127 }
4128 4128
4129 // Make sure damage tracking propagates all the way to the graphics context, 4129 // Make sure damage tracking propagates all the way to the graphics context,
4130 // where it should request to swap only the sub-buffer that is damaged. 4130 // where it should request to swap only the sub-buffer that is damaged.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4164 root->SetBounds(gfx::Size(500, 500)); 4164 root->SetBounds(gfx::Size(500, 500));
4165 root->SetContentBounds(gfx::Size(500, 500)); 4165 root->SetContentBounds(gfx::Size(500, 500));
4166 root->SetDrawsContent(true); 4166 root->SetDrawsContent(true);
4167 root->AddChild(child.Pass()); 4167 root->AddChild(child.Pass());
4168 layer_tree_host_impl->active_tree()->SetRootLayer(root.Pass()); 4168 layer_tree_host_impl->active_tree()->SetRootLayer(root.Pass());
4169 4169
4170 LayerTreeHostImpl::FrameData frame; 4170 LayerTreeHostImpl::FrameData frame;
4171 4171
4172 // First frame, the entire screen should get swapped. 4172 // First frame, the entire screen should get swapped.
4173 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); 4173 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame));
4174 layer_tree_host_impl->DrawLayers(&frame, gfx::FrameTime::Now()); 4174 layer_tree_host_impl->DrawLayers(&frame);
4175 layer_tree_host_impl->DidDrawAllLayers(frame); 4175 layer_tree_host_impl->DidDrawAllLayers(frame);
4176 layer_tree_host_impl->SwapBuffers(frame); 4176 layer_tree_host_impl->SwapBuffers(frame);
4177 EXPECT_EQ(TestContextSupport::SWAP, 4177 EXPECT_EQ(TestContextSupport::SWAP,
4178 context_provider->support()->last_swap_type()); 4178 context_provider->support()->last_swap_type());
4179 4179
4180 // Second frame, only the damaged area should get swapped. Damage should be 4180 // Second frame, only the damaged area should get swapped. Damage should be
4181 // the union of old and new child rects. 4181 // the union of old and new child rects.
4182 // expected damage rect: gfx::Rect(26, 28); 4182 // expected damage rect: gfx::Rect(26, 28);
4183 // expected swap rect: vertically flipped, with origin at bottom left corner. 4183 // expected swap rect: vertically flipped, with origin at bottom left corner.
4184 layer_tree_host_impl->active_tree()->root_layer()->children()[0]->SetPosition( 4184 layer_tree_host_impl->active_tree()->root_layer()->children()[0]->SetPosition(
4185 gfx::PointF()); 4185 gfx::PointF());
4186 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); 4186 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame));
4187 layer_tree_host_impl->DrawLayers(&frame, gfx::FrameTime::Now()); 4187 layer_tree_host_impl->DrawLayers(&frame);
4188 host_impl_->DidDrawAllLayers(frame); 4188 host_impl_->DidDrawAllLayers(frame);
4189 layer_tree_host_impl->SwapBuffers(frame); 4189 layer_tree_host_impl->SwapBuffers(frame);
4190 4190
4191 // Make sure that partial swap is constrained to the viewport dimensions 4191 // Make sure that partial swap is constrained to the viewport dimensions
4192 // expected damage rect: gfx::Rect(500, 500); 4192 // expected damage rect: gfx::Rect(500, 500);
4193 // expected swap rect: flipped damage rect, but also clamped to viewport 4193 // expected swap rect: flipped damage rect, but also clamped to viewport
4194 EXPECT_EQ(TestContextSupport::PARTIAL_SWAP, 4194 EXPECT_EQ(TestContextSupport::PARTIAL_SWAP,
4195 context_provider->support()->last_swap_type()); 4195 context_provider->support()->last_swap_type());
4196 gfx::Rect expected_swap_rect(0, 500-28, 26, 28); 4196 gfx::Rect expected_swap_rect(0, 500-28, 26, 28);
4197 EXPECT_EQ(expected_swap_rect.ToString(), 4197 EXPECT_EQ(expected_swap_rect.ToString(),
4198 context_provider->support()-> 4198 context_provider->support()->
4199 last_partial_swap_rect().ToString()); 4199 last_partial_swap_rect().ToString());
4200 4200
4201 layer_tree_host_impl->SetViewportSize(gfx::Size(10, 10)); 4201 layer_tree_host_impl->SetViewportSize(gfx::Size(10, 10));
4202 // This will damage everything. 4202 // This will damage everything.
4203 layer_tree_host_impl->active_tree()->root_layer()->SetBackgroundColor( 4203 layer_tree_host_impl->active_tree()->root_layer()->SetBackgroundColor(
4204 SK_ColorBLACK); 4204 SK_ColorBLACK);
4205 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); 4205 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame));
4206 layer_tree_host_impl->DrawLayers(&frame, gfx::FrameTime::Now()); 4206 layer_tree_host_impl->DrawLayers(&frame);
4207 host_impl_->DidDrawAllLayers(frame); 4207 host_impl_->DidDrawAllLayers(frame);
4208 layer_tree_host_impl->SwapBuffers(frame); 4208 layer_tree_host_impl->SwapBuffers(frame);
4209 4209
4210 EXPECT_EQ(TestContextSupport::SWAP, 4210 EXPECT_EQ(TestContextSupport::SWAP,
4211 context_provider->support()->last_swap_type()); 4211 context_provider->support()->last_swap_type());
4212 } 4212 }
4213 4213
4214 TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { 4214 TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) {
4215 scoped_ptr<LayerImpl> root = 4215 scoped_ptr<LayerImpl> root =
4216 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); 4216 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
4362 settings.partial_swap_enabled = false; 4362 settings.partial_swap_enabled = false;
4363 CreateHostImpl(settings, output_surface.Pass()); 4363 CreateHostImpl(settings, output_surface.Pass());
4364 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1)); 4364 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
4365 4365
4366 // Without partial swap, and no clipping, no scissor is set. 4366 // Without partial swap, and no clipping, no scissor is set.
4367 harness.MustDrawSolidQuad(); 4367 harness.MustDrawSolidQuad();
4368 harness.MustSetNoScissor(); 4368 harness.MustSetNoScissor();
4369 { 4369 {
4370 LayerTreeHostImpl::FrameData frame; 4370 LayerTreeHostImpl::FrameData frame;
4371 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4371 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4372 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4372 host_impl_->DrawLayers(&frame);
4373 host_impl_->DidDrawAllLayers(frame); 4373 host_impl_->DidDrawAllLayers(frame);
4374 } 4374 }
4375 Mock::VerifyAndClearExpectations(&mock_context); 4375 Mock::VerifyAndClearExpectations(&mock_context);
4376 4376
4377 // Without partial swap, but a layer does clip its subtree, one scissor is 4377 // Without partial swap, but a layer does clip its subtree, one scissor is
4378 // set. 4378 // set.
4379 host_impl_->active_tree()->root_layer()->SetMasksToBounds(true); 4379 host_impl_->active_tree()->root_layer()->SetMasksToBounds(true);
4380 harness.MustDrawSolidQuad(); 4380 harness.MustDrawSolidQuad();
4381 harness.MustSetScissor(0, 0, 10, 10); 4381 harness.MustSetScissor(0, 0, 10, 10);
4382 { 4382 {
4383 LayerTreeHostImpl::FrameData frame; 4383 LayerTreeHostImpl::FrameData frame;
4384 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4384 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4385 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4385 host_impl_->DrawLayers(&frame);
4386 host_impl_->DidDrawAllLayers(frame); 4386 host_impl_->DidDrawAllLayers(frame);
4387 } 4387 }
4388 Mock::VerifyAndClearExpectations(&mock_context); 4388 Mock::VerifyAndClearExpectations(&mock_context);
4389 } 4389 }
4390 4390
4391 TEST_F(LayerTreeHostImplTest, PartialSwap) { 4391 TEST_F(LayerTreeHostImplTest, PartialSwap) {
4392 scoped_ptr<MockContext> context_owned(new MockContext); 4392 scoped_ptr<MockContext> context_owned(new MockContext);
4393 MockContext* mock_context = context_owned.get(); 4393 MockContext* mock_context = context_owned.get();
4394 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 4394 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
4395 context_owned.PassAs<TestWebGraphicsContext3D>())); 4395 context_owned.PassAs<TestWebGraphicsContext3D>()));
4396 MockContextHarness harness(mock_context); 4396 MockContextHarness harness(mock_context);
4397 4397
4398 LayerTreeSettings settings = DefaultSettings(); 4398 LayerTreeSettings settings = DefaultSettings();
4399 settings.partial_swap_enabled = true; 4399 settings.partial_swap_enabled = true;
4400 CreateHostImpl(settings, output_surface.Pass()); 4400 CreateHostImpl(settings, output_surface.Pass());
4401 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1)); 4401 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
4402 4402
4403 // The first frame is not a partially-swapped one. 4403 // The first frame is not a partially-swapped one.
4404 harness.MustSetScissor(0, 0, 10, 10); 4404 harness.MustSetScissor(0, 0, 10, 10);
4405 harness.MustDrawSolidQuad(); 4405 harness.MustDrawSolidQuad();
4406 { 4406 {
4407 LayerTreeHostImpl::FrameData frame; 4407 LayerTreeHostImpl::FrameData frame;
4408 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4408 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4409 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4409 host_impl_->DrawLayers(&frame);
4410 host_impl_->DidDrawAllLayers(frame); 4410 host_impl_->DidDrawAllLayers(frame);
4411 } 4411 }
4412 Mock::VerifyAndClearExpectations(&mock_context); 4412 Mock::VerifyAndClearExpectations(&mock_context);
4413 4413
4414 // Damage a portion of the frame. 4414 // Damage a portion of the frame.
4415 host_impl_->active_tree()->root_layer()->SetUpdateRect( 4415 host_impl_->active_tree()->root_layer()->SetUpdateRect(
4416 gfx::Rect(0, 0, 2, 3)); 4416 gfx::Rect(0, 0, 2, 3));
4417 4417
4418 // The second frame will be partially-swapped (the y coordinates are flipped). 4418 // The second frame will be partially-swapped (the y coordinates are flipped).
4419 harness.MustSetScissor(0, 7, 2, 3); 4419 harness.MustSetScissor(0, 7, 2, 3);
4420 harness.MustDrawSolidQuad(); 4420 harness.MustDrawSolidQuad();
4421 { 4421 {
4422 LayerTreeHostImpl::FrameData frame; 4422 LayerTreeHostImpl::FrameData frame;
4423 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4423 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4424 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4424 host_impl_->DrawLayers(&frame);
4425 host_impl_->DidDrawAllLayers(frame); 4425 host_impl_->DidDrawAllLayers(frame);
4426 } 4426 }
4427 Mock::VerifyAndClearExpectations(&mock_context); 4427 Mock::VerifyAndClearExpectations(&mock_context);
4428 } 4428 }
4429 4429
4430 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( 4430 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
4431 bool partial_swap, 4431 bool partial_swap,
4432 LayerTreeHostImplClient* client, 4432 LayerTreeHostImplClient* client,
4433 Proxy* proxy, 4433 Proxy* proxy,
4434 SharedBitmapManager* manager, 4434 SharedBitmapManager* manager,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
4519 4519
4520 // Verify all quads have been computed 4520 // Verify all quads have been computed
4521 ASSERT_EQ(2U, frame.render_passes.size()); 4521 ASSERT_EQ(2U, frame.render_passes.size());
4522 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); 4522 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
4523 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); 4523 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
4524 EXPECT_EQ(DrawQuad::SOLID_COLOR, 4524 EXPECT_EQ(DrawQuad::SOLID_COLOR,
4525 frame.render_passes[0]->quad_list[0]->material); 4525 frame.render_passes[0]->quad_list[0]->material);
4526 EXPECT_EQ(DrawQuad::RENDER_PASS, 4526 EXPECT_EQ(DrawQuad::RENDER_PASS,
4527 frame.render_passes[1]->quad_list[0]->material); 4527 frame.render_passes[1]->quad_list[0]->material);
4528 4528
4529 my_host_impl->DrawLayers(&frame, gfx::FrameTime::Now()); 4529 my_host_impl->DrawLayers(&frame);
4530 my_host_impl->DidDrawAllLayers(frame); 4530 my_host_impl->DidDrawAllLayers(frame);
4531 } 4531 }
4532 } 4532 }
4533 4533
4534 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { 4534 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) {
4535 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 4535 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
4536 new TestSharedBitmapManager()); 4536 new TestSharedBitmapManager());
4537 scoped_ptr<LayerTreeHostImpl> my_host_impl = 4537 scoped_ptr<LayerTreeHostImpl> my_host_impl =
4538 SetupLayersForOpacity(false, 4538 SetupLayersForOpacity(false,
4539 this, 4539 this,
4540 &proxy_, 4540 &proxy_,
4541 shared_bitmap_manager.get(), 4541 shared_bitmap_manager.get(),
4542 &stats_instrumentation_); 4542 &stats_instrumentation_);
4543 { 4543 {
4544 LayerTreeHostImpl::FrameData frame; 4544 LayerTreeHostImpl::FrameData frame;
4545 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); 4545 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
4546 4546
4547 // Verify all quads have been computed 4547 // Verify all quads have been computed
4548 ASSERT_EQ(2U, frame.render_passes.size()); 4548 ASSERT_EQ(2U, frame.render_passes.size());
4549 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); 4549 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
4550 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); 4550 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
4551 EXPECT_EQ(DrawQuad::SOLID_COLOR, 4551 EXPECT_EQ(DrawQuad::SOLID_COLOR,
4552 frame.render_passes[0]->quad_list[0]->material); 4552 frame.render_passes[0]->quad_list[0]->material);
4553 EXPECT_EQ(DrawQuad::RENDER_PASS, 4553 EXPECT_EQ(DrawQuad::RENDER_PASS,
4554 frame.render_passes[1]->quad_list[0]->material); 4554 frame.render_passes[1]->quad_list[0]->material);
4555 4555
4556 my_host_impl->DrawLayers(&frame, gfx::FrameTime::Now()); 4556 my_host_impl->DrawLayers(&frame);
4557 my_host_impl->DidDrawAllLayers(frame); 4557 my_host_impl->DidDrawAllLayers(frame);
4558 } 4558 }
4559 } 4559 }
4560 4560
4561 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { 4561 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
4562 scoped_ptr<TestWebGraphicsContext3D> context = 4562 scoped_ptr<TestWebGraphicsContext3D> context =
4563 TestWebGraphicsContext3D::Create(); 4563 TestWebGraphicsContext3D::Create();
4564 TestWebGraphicsContext3D* context3d = context.get(); 4564 TestWebGraphicsContext3D* context3d = context.get();
4565 scoped_ptr<OutputSurface> output_surface( 4565 scoped_ptr<OutputSurface> output_surface(
4566 FakeOutputSurface::Create3d(context.Pass())); 4566 FakeOutputSurface::Create3d(context.Pass()));
(...skipping 22 matching lines...) Expand all
4589 io_surface_layer->SetDrawsContent(true); 4589 io_surface_layer->SetDrawsContent(true);
4590 io_surface_layer->SetIOSurfaceProperties(1, gfx::Size(10, 10)); 4590 io_surface_layer->SetIOSurfaceProperties(1, gfx::Size(10, 10));
4591 root_layer->AddChild(io_surface_layer.PassAs<LayerImpl>()); 4591 root_layer->AddChild(io_surface_layer.PassAs<LayerImpl>());
4592 4592
4593 host_impl_->active_tree()->SetRootLayer(root_layer.Pass()); 4593 host_impl_->active_tree()->SetRootLayer(root_layer.Pass());
4594 4594
4595 EXPECT_EQ(0u, context3d->NumTextures()); 4595 EXPECT_EQ(0u, context3d->NumTextures());
4596 4596
4597 LayerTreeHostImpl::FrameData frame; 4597 LayerTreeHostImpl::FrameData frame;
4598 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4598 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4599 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4599 host_impl_->DrawLayers(&frame);
4600 host_impl_->DidDrawAllLayers(frame); 4600 host_impl_->DidDrawAllLayers(frame);
4601 host_impl_->SwapBuffers(frame); 4601 host_impl_->SwapBuffers(frame);
4602 4602
4603 EXPECT_GT(context3d->NumTextures(), 0u); 4603 EXPECT_GT(context3d->NumTextures(), 0u);
4604 4604
4605 // Kill the layer tree. 4605 // Kill the layer tree.
4606 host_impl_->active_tree()->SetRootLayer( 4606 host_impl_->active_tree()->SetRootLayer(
4607 LayerImpl::Create(host_impl_->active_tree(), 100)); 4607 LayerImpl::Create(host_impl_->active_tree(), 100));
4608 // There should be no textures left in use after. 4608 // There should be no textures left in use after.
4609 EXPECT_EQ(0u, context3d->NumTextures()); 4609 EXPECT_EQ(0u, context3d->NumTextures());
(...skipping 24 matching lines...) Expand all
4634 host_impl_->active_tree()->set_background_color(SK_ColorWHITE); 4634 host_impl_->active_tree()->set_background_color(SK_ColorWHITE);
4635 4635
4636 // Verify one quad is drawn when transparent background set is not set. 4636 // Verify one quad is drawn when transparent background set is not set.
4637 host_impl_->active_tree()->set_has_transparent_background(false); 4637 host_impl_->active_tree()->set_has_transparent_background(false);
4638 EXPECT_CALL(*mock_context, useProgram(_)) 4638 EXPECT_CALL(*mock_context, useProgram(_))
4639 .Times(1); 4639 .Times(1);
4640 EXPECT_CALL(*mock_context, drawElements(_, _, _, _)) 4640 EXPECT_CALL(*mock_context, drawElements(_, _, _, _))
4641 .Times(1); 4641 .Times(1);
4642 LayerTreeHostImpl::FrameData frame; 4642 LayerTreeHostImpl::FrameData frame;
4643 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4643 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4644 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4644 host_impl_->DrawLayers(&frame);
4645 host_impl_->DidDrawAllLayers(frame); 4645 host_impl_->DidDrawAllLayers(frame);
4646 Mock::VerifyAndClearExpectations(&mock_context); 4646 Mock::VerifyAndClearExpectations(&mock_context);
4647 4647
4648 // Verify no quads are drawn when transparent background is set. 4648 // Verify no quads are drawn when transparent background is set.
4649 host_impl_->active_tree()->set_has_transparent_background(true); 4649 host_impl_->active_tree()->set_has_transparent_background(true);
4650 host_impl_->SetFullRootLayerDamage(); 4650 host_impl_->SetFullRootLayerDamage();
4651 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4651 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4652 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4652 host_impl_->DrawLayers(&frame);
4653 host_impl_->DidDrawAllLayers(frame); 4653 host_impl_->DidDrawAllLayers(frame);
4654 Mock::VerifyAndClearExpectations(&mock_context); 4654 Mock::VerifyAndClearExpectations(&mock_context);
4655 } 4655 }
4656 4656
4657 TEST_F(LayerTreeHostImplTest, ReleaseContentsTextureShouldTriggerCommit) { 4657 TEST_F(LayerTreeHostImplTest, ReleaseContentsTextureShouldTriggerCommit) {
4658 set_reduce_memory_result(false); 4658 set_reduce_memory_result(false);
4659 4659
4660 // If changing the memory limit wouldn't result in changing what was 4660 // If changing the memory limit wouldn't result in changing what was
4661 // committed, then no commit should be requested. 4661 // committed, then no commit should be requested.
4662 set_reduce_memory_result(false); 4662 set_reduce_memory_result(false);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
4725 gfx::RectF expected_child_visible_rect(child->content_bounds()); 4725 gfx::RectF expected_child_visible_rect(child->content_bounds());
4726 EXPECT_RECT_EQ(expected_child_visible_rect, 4726 EXPECT_RECT_EQ(expected_child_visible_rect,
4727 root_render_pass->quad_list[0]->visible_rect); 4727 root_render_pass->quad_list[0]->visible_rect);
4728 4728
4729 LayerImpl* root = host_impl_->active_tree()->root_layer(); 4729 LayerImpl* root = host_impl_->active_tree()->root_layer();
4730 gfx::RectF expected_root_visible_rect(root->content_bounds()); 4730 gfx::RectF expected_root_visible_rect(root->content_bounds());
4731 EXPECT_RECT_EQ(expected_root_visible_rect, 4731 EXPECT_RECT_EQ(expected_root_visible_rect,
4732 root_render_pass->quad_list[1]->visible_rect); 4732 root_render_pass->quad_list[1]->visible_rect);
4733 } 4733 }
4734 4734
4735 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4735 host_impl_->DrawLayers(&frame);
4736 host_impl_->DidDrawAllLayers(frame); 4736 host_impl_->DidDrawAllLayers(frame);
4737 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); 4737 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame));
4738 } 4738 }
4739 }; 4739 };
4740 4740
4741 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { 4741 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) {
4742 scoped_ptr<SolidColorLayerImpl> root = 4742 scoped_ptr<SolidColorLayerImpl> root =
4743 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); 4743 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
4744 root->SetPosition(gfx::PointF()); 4744 root->SetPosition(gfx::PointF());
4745 root->SetBounds(gfx::Size(10, 10)); 4745 root->SetBounds(gfx::Size(10, 10));
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4864 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); 4864 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
4865 ASSERT_EQ(DrawQuad::RENDER_PASS, 4865 ASSERT_EQ(DrawQuad::RENDER_PASS,
4866 frame.render_passes[0]->quad_list[0]->material); 4866 frame.render_passes[0]->quad_list[0]->material);
4867 const RenderPassDrawQuad* render_pass_quad = 4867 const RenderPassDrawQuad* render_pass_quad =
4868 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); 4868 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
4869 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), 4869 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
4870 render_pass_quad->rect.ToString()); 4870 render_pass_quad->rect.ToString());
4871 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 4871 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
4872 render_pass_quad->mask_uv_rect.ToString()); 4872 render_pass_quad->mask_uv_rect.ToString());
4873 4873
4874 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4874 host_impl_->DrawLayers(&frame);
4875 host_impl_->DidDrawAllLayers(frame); 4875 host_impl_->DidDrawAllLayers(frame);
4876 } 4876 }
4877 4877
4878 4878
4879 // Applying a DSF should change the render surface size, but won't affect 4879 // Applying a DSF should change the render surface size, but won't affect
4880 // which part of the mask is used. 4880 // which part of the mask is used.
4881 device_scale_factor = 2.f; 4881 device_scale_factor = 2.f;
4882 gfx::Size device_viewport = 4882 gfx::Size device_viewport =
4883 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor)); 4883 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor));
4884 host_impl_->SetViewportSize(device_viewport); 4884 host_impl_->SetViewportSize(device_viewport);
4885 host_impl_->SetDeviceScaleFactor(device_scale_factor); 4885 host_impl_->SetDeviceScaleFactor(device_scale_factor);
4886 host_impl_->active_tree()->set_needs_update_draw_properties(); 4886 host_impl_->active_tree()->set_needs_update_draw_properties();
4887 { 4887 {
4888 LayerTreeHostImpl::FrameData frame; 4888 LayerTreeHostImpl::FrameData frame;
4889 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4889 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4890 4890
4891 ASSERT_EQ(1u, frame.render_passes.size()); 4891 ASSERT_EQ(1u, frame.render_passes.size());
4892 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); 4892 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
4893 ASSERT_EQ(DrawQuad::RENDER_PASS, 4893 ASSERT_EQ(DrawQuad::RENDER_PASS,
4894 frame.render_passes[0]->quad_list[0]->material); 4894 frame.render_passes[0]->quad_list[0]->material);
4895 const RenderPassDrawQuad* render_pass_quad = 4895 const RenderPassDrawQuad* render_pass_quad =
4896 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); 4896 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
4897 EXPECT_EQ(gfx::Rect(0, 0, 200, 200).ToString(), 4897 EXPECT_EQ(gfx::Rect(0, 0, 200, 200).ToString(),
4898 render_pass_quad->rect.ToString()); 4898 render_pass_quad->rect.ToString());
4899 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 4899 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
4900 render_pass_quad->mask_uv_rect.ToString()); 4900 render_pass_quad->mask_uv_rect.ToString());
4901 4901
4902 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4902 host_impl_->DrawLayers(&frame);
4903 host_impl_->DidDrawAllLayers(frame); 4903 host_impl_->DidDrawAllLayers(frame);
4904 } 4904 }
4905 4905
4906 4906
4907 // Applying an equivalent content scale on the content layer and the mask 4907 // Applying an equivalent content scale on the content layer and the mask
4908 // should still result in the same part of the mask being used. 4908 // should still result in the same part of the mask being used.
4909 gfx::Size content_bounds = 4909 gfx::Size content_bounds =
4910 gfx::ToRoundedSize(gfx::ScaleSize(scaling_layer_size, 4910 gfx::ToRoundedSize(gfx::ScaleSize(scaling_layer_size,
4911 device_scale_factor)); 4911 device_scale_factor));
4912 content_layer->SetContentBounds(content_bounds); 4912 content_layer->SetContentBounds(content_bounds);
4913 content_layer->SetContentsScale(device_scale_factor, device_scale_factor); 4913 content_layer->SetContentsScale(device_scale_factor, device_scale_factor);
4914 mask_layer->SetContentBounds(content_bounds); 4914 mask_layer->SetContentBounds(content_bounds);
4915 mask_layer->SetContentsScale(device_scale_factor, device_scale_factor); 4915 mask_layer->SetContentsScale(device_scale_factor, device_scale_factor);
4916 host_impl_->active_tree()->set_needs_update_draw_properties(); 4916 host_impl_->active_tree()->set_needs_update_draw_properties();
4917 { 4917 {
4918 LayerTreeHostImpl::FrameData frame; 4918 LayerTreeHostImpl::FrameData frame;
4919 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 4919 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
4920 4920
4921 ASSERT_EQ(1u, frame.render_passes.size()); 4921 ASSERT_EQ(1u, frame.render_passes.size());
4922 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); 4922 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
4923 ASSERT_EQ(DrawQuad::RENDER_PASS, 4923 ASSERT_EQ(DrawQuad::RENDER_PASS,
4924 frame.render_passes[0]->quad_list[0]->material); 4924 frame.render_passes[0]->quad_list[0]->material);
4925 const RenderPassDrawQuad* render_pass_quad = 4925 const RenderPassDrawQuad* render_pass_quad =
4926 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); 4926 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
4927 EXPECT_EQ(gfx::Rect(0, 0, 200, 200).ToString(), 4927 EXPECT_EQ(gfx::Rect(0, 0, 200, 200).ToString(),
4928 render_pass_quad->rect.ToString()); 4928 render_pass_quad->rect.ToString());
4929 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 4929 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
4930 render_pass_quad->mask_uv_rect.ToString()); 4930 render_pass_quad->mask_uv_rect.ToString());
4931 4931
4932 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4932 host_impl_->DrawLayers(&frame);
4933 host_impl_->DidDrawAllLayers(frame); 4933 host_impl_->DidDrawAllLayers(frame);
4934 } 4934 }
4935 } 4935 }
4936 4936
4937 TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) { 4937 TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) {
4938 // The mask layer has bounds 100x100 but is attached to a layer with bounds 4938 // The mask layer has bounds 100x100 but is attached to a layer with bounds
4939 // 50x50. 4939 // 50x50.
4940 4940
4941 scoped_ptr<LayerImpl> scoped_root = 4941 scoped_ptr<LayerImpl> scoped_root =
4942 LayerImpl::Create(host_impl_->active_tree(), 1); 4942 LayerImpl::Create(host_impl_->active_tree(), 1);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4982 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); 4982 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
4983 ASSERT_EQ(DrawQuad::RENDER_PASS, 4983 ASSERT_EQ(DrawQuad::RENDER_PASS,
4984 frame.render_passes[0]->quad_list[0]->material); 4984 frame.render_passes[0]->quad_list[0]->material);
4985 const RenderPassDrawQuad* render_pass_quad = 4985 const RenderPassDrawQuad* render_pass_quad =
4986 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); 4986 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
4987 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), 4987 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(),
4988 render_pass_quad->rect.ToString()); 4988 render_pass_quad->rect.ToString());
4989 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 4989 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
4990 render_pass_quad->mask_uv_rect.ToString()); 4990 render_pass_quad->mask_uv_rect.ToString());
4991 4991
4992 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 4992 host_impl_->DrawLayers(&frame);
4993 host_impl_->DidDrawAllLayers(frame); 4993 host_impl_->DidDrawAllLayers(frame);
4994 } 4994 }
4995 4995
4996 // Applying a DSF should change the render surface size, but won't affect 4996 // Applying a DSF should change the render surface size, but won't affect
4997 // which part of the mask is used. 4997 // which part of the mask is used.
4998 device_scale_factor = 2.f; 4998 device_scale_factor = 2.f;
4999 gfx::Size device_viewport = 4999 gfx::Size device_viewport =
5000 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor)); 5000 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor));
5001 host_impl_->SetViewportSize(device_viewport); 5001 host_impl_->SetViewportSize(device_viewport);
5002 host_impl_->SetDeviceScaleFactor(device_scale_factor); 5002 host_impl_->SetDeviceScaleFactor(device_scale_factor);
5003 host_impl_->active_tree()->set_needs_update_draw_properties(); 5003 host_impl_->active_tree()->set_needs_update_draw_properties();
5004 { 5004 {
5005 LayerTreeHostImpl::FrameData frame; 5005 LayerTreeHostImpl::FrameData frame;
5006 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5006 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5007 5007
5008 ASSERT_EQ(1u, frame.render_passes.size()); 5008 ASSERT_EQ(1u, frame.render_passes.size());
5009 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); 5009 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
5010 ASSERT_EQ(DrawQuad::RENDER_PASS, 5010 ASSERT_EQ(DrawQuad::RENDER_PASS,
5011 frame.render_passes[0]->quad_list[0]->material); 5011 frame.render_passes[0]->quad_list[0]->material);
5012 const RenderPassDrawQuad* render_pass_quad = 5012 const RenderPassDrawQuad* render_pass_quad =
5013 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); 5013 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
5014 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), 5014 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
5015 render_pass_quad->rect.ToString()); 5015 render_pass_quad->rect.ToString());
5016 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 5016 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
5017 render_pass_quad->mask_uv_rect.ToString()); 5017 render_pass_quad->mask_uv_rect.ToString());
5018 5018
5019 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5019 host_impl_->DrawLayers(&frame);
5020 host_impl_->DidDrawAllLayers(frame); 5020 host_impl_->DidDrawAllLayers(frame);
5021 } 5021 }
5022 5022
5023 // Applying an equivalent content scale on the content layer and the mask 5023 // Applying an equivalent content scale on the content layer and the mask
5024 // should still result in the same part of the mask being used. 5024 // should still result in the same part of the mask being used.
5025 gfx::Size layer_size_large = 5025 gfx::Size layer_size_large =
5026 gfx::ToRoundedSize(gfx::ScaleSize(layer_size, device_scale_factor)); 5026 gfx::ToRoundedSize(gfx::ScaleSize(layer_size, device_scale_factor));
5027 content_layer->SetContentBounds(layer_size_large); 5027 content_layer->SetContentBounds(layer_size_large);
5028 content_layer->SetContentsScale(device_scale_factor, device_scale_factor); 5028 content_layer->SetContentsScale(device_scale_factor, device_scale_factor);
5029 gfx::Size mask_size_large = 5029 gfx::Size mask_size_large =
5030 gfx::ToRoundedSize(gfx::ScaleSize(mask_size, device_scale_factor)); 5030 gfx::ToRoundedSize(gfx::ScaleSize(mask_size, device_scale_factor));
5031 mask_layer->SetContentBounds(mask_size_large); 5031 mask_layer->SetContentBounds(mask_size_large);
5032 mask_layer->SetContentsScale(device_scale_factor, device_scale_factor); 5032 mask_layer->SetContentsScale(device_scale_factor, device_scale_factor);
5033 host_impl_->active_tree()->set_needs_update_draw_properties(); 5033 host_impl_->active_tree()->set_needs_update_draw_properties();
5034 { 5034 {
5035 LayerTreeHostImpl::FrameData frame; 5035 LayerTreeHostImpl::FrameData frame;
5036 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5036 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5037 5037
5038 ASSERT_EQ(1u, frame.render_passes.size()); 5038 ASSERT_EQ(1u, frame.render_passes.size());
5039 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); 5039 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
5040 ASSERT_EQ(DrawQuad::RENDER_PASS, 5040 ASSERT_EQ(DrawQuad::RENDER_PASS,
5041 frame.render_passes[0]->quad_list[0]->material); 5041 frame.render_passes[0]->quad_list[0]->material);
5042 const RenderPassDrawQuad* render_pass_quad = 5042 const RenderPassDrawQuad* render_pass_quad =
5043 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); 5043 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
5044 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), 5044 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
5045 render_pass_quad->rect.ToString()); 5045 render_pass_quad->rect.ToString());
5046 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 5046 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
5047 render_pass_quad->mask_uv_rect.ToString()); 5047 render_pass_quad->mask_uv_rect.ToString());
5048 5048
5049 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5049 host_impl_->DrawLayers(&frame);
5050 host_impl_->DidDrawAllLayers(frame); 5050 host_impl_->DidDrawAllLayers(frame);
5051 } 5051 }
5052 5052
5053 // Applying a different contents scale to the mask layer means it will have 5053 // Applying a different contents scale to the mask layer means it will have
5054 // a larger texture, but it should use the same tex coords to cover the 5054 // a larger texture, but it should use the same tex coords to cover the
5055 // layer it masks. 5055 // layer it masks.
5056 mask_layer->SetContentBounds(mask_size); 5056 mask_layer->SetContentBounds(mask_size);
5057 mask_layer->SetContentsScale(1.f, 1.f); 5057 mask_layer->SetContentsScale(1.f, 1.f);
5058 host_impl_->active_tree()->set_needs_update_draw_properties(); 5058 host_impl_->active_tree()->set_needs_update_draw_properties();
5059 { 5059 {
5060 LayerTreeHostImpl::FrameData frame; 5060 LayerTreeHostImpl::FrameData frame;
5061 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5061 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5062 5062
5063 ASSERT_EQ(1u, frame.render_passes.size()); 5063 ASSERT_EQ(1u, frame.render_passes.size());
5064 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size()); 5064 ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
5065 ASSERT_EQ(DrawQuad::RENDER_PASS, 5065 ASSERT_EQ(DrawQuad::RENDER_PASS,
5066 frame.render_passes[0]->quad_list[0]->material); 5066 frame.render_passes[0]->quad_list[0]->material);
5067 const RenderPassDrawQuad* render_pass_quad = 5067 const RenderPassDrawQuad* render_pass_quad =
5068 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]); 5068 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
5069 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), 5069 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
5070 render_pass_quad->rect.ToString()); 5070 render_pass_quad->rect.ToString());
5071 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 5071 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
5072 render_pass_quad->mask_uv_rect.ToString()); 5072 render_pass_quad->mask_uv_rect.ToString());
5073 5073
5074 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5074 host_impl_->DrawLayers(&frame);
5075 host_impl_->DidDrawAllLayers(frame); 5075 host_impl_->DidDrawAllLayers(frame);
5076 } 5076 }
5077 } 5077 }
5078 5078
5079 TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) { 5079 TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) {
5080 // The replica's mask layer has bounds 100x100 but the replica is of a 5080 // The replica's mask layer has bounds 100x100 but the replica is of a
5081 // layer with bounds 50x50. 5081 // layer with bounds 50x50.
5082 5082
5083 scoped_ptr<LayerImpl> scoped_root = 5083 scoped_ptr<LayerImpl> scoped_root =
5084 LayerImpl::Create(host_impl_->active_tree(), 1); 5084 LayerImpl::Create(host_impl_->active_tree(), 1);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
5130 ASSERT_EQ(DrawQuad::RENDER_PASS, 5130 ASSERT_EQ(DrawQuad::RENDER_PASS,
5131 frame.render_passes[0]->quad_list[1]->material); 5131 frame.render_passes[0]->quad_list[1]->material);
5132 const RenderPassDrawQuad* replica_quad = 5132 const RenderPassDrawQuad* replica_quad =
5133 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]); 5133 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]);
5134 EXPECT_TRUE(replica_quad->is_replica); 5134 EXPECT_TRUE(replica_quad->is_replica);
5135 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), 5135 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(),
5136 replica_quad->rect.ToString()); 5136 replica_quad->rect.ToString());
5137 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 5137 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
5138 replica_quad->mask_uv_rect.ToString()); 5138 replica_quad->mask_uv_rect.ToString());
5139 5139
5140 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5140 host_impl_->DrawLayers(&frame);
5141 host_impl_->DidDrawAllLayers(frame); 5141 host_impl_->DidDrawAllLayers(frame);
5142 } 5142 }
5143 5143
5144 // Applying a DSF should change the render surface size, but won't affect 5144 // Applying a DSF should change the render surface size, but won't affect
5145 // which part of the mask is used. 5145 // which part of the mask is used.
5146 device_scale_factor = 2.f; 5146 device_scale_factor = 2.f;
5147 gfx::Size device_viewport = 5147 gfx::Size device_viewport =
5148 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor)); 5148 gfx::ToFlooredSize(gfx::ScaleSize(root_size, device_scale_factor));
5149 host_impl_->SetViewportSize(device_viewport); 5149 host_impl_->SetViewportSize(device_viewport);
5150 host_impl_->SetDeviceScaleFactor(device_scale_factor); 5150 host_impl_->SetDeviceScaleFactor(device_scale_factor);
5151 host_impl_->active_tree()->set_needs_update_draw_properties(); 5151 host_impl_->active_tree()->set_needs_update_draw_properties();
5152 { 5152 {
5153 LayerTreeHostImpl::FrameData frame; 5153 LayerTreeHostImpl::FrameData frame;
5154 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5154 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5155 5155
5156 ASSERT_EQ(1u, frame.render_passes.size()); 5156 ASSERT_EQ(1u, frame.render_passes.size());
5157 ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size()); 5157 ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size());
5158 ASSERT_EQ(DrawQuad::RENDER_PASS, 5158 ASSERT_EQ(DrawQuad::RENDER_PASS,
5159 frame.render_passes[0]->quad_list[1]->material); 5159 frame.render_passes[0]->quad_list[1]->material);
5160 const RenderPassDrawQuad* replica_quad = 5160 const RenderPassDrawQuad* replica_quad =
5161 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]); 5161 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]);
5162 EXPECT_TRUE(replica_quad->is_replica); 5162 EXPECT_TRUE(replica_quad->is_replica);
5163 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), 5163 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
5164 replica_quad->rect.ToString()); 5164 replica_quad->rect.ToString());
5165 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 5165 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
5166 replica_quad->mask_uv_rect.ToString()); 5166 replica_quad->mask_uv_rect.ToString());
5167 5167
5168 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5168 host_impl_->DrawLayers(&frame);
5169 host_impl_->DidDrawAllLayers(frame); 5169 host_impl_->DidDrawAllLayers(frame);
5170 } 5170 }
5171 5171
5172 // Applying an equivalent content scale on the content layer and the mask 5172 // Applying an equivalent content scale on the content layer and the mask
5173 // should still result in the same part of the mask being used. 5173 // should still result in the same part of the mask being used.
5174 gfx::Size layer_size_large = 5174 gfx::Size layer_size_large =
5175 gfx::ToRoundedSize(gfx::ScaleSize(layer_size, device_scale_factor)); 5175 gfx::ToRoundedSize(gfx::ScaleSize(layer_size, device_scale_factor));
5176 content_layer->SetContentBounds(layer_size_large); 5176 content_layer->SetContentBounds(layer_size_large);
5177 content_layer->SetContentsScale(device_scale_factor, device_scale_factor); 5177 content_layer->SetContentsScale(device_scale_factor, device_scale_factor);
5178 gfx::Size mask_size_large = 5178 gfx::Size mask_size_large =
(...skipping 10 matching lines...) Expand all
5189 ASSERT_EQ(DrawQuad::RENDER_PASS, 5189 ASSERT_EQ(DrawQuad::RENDER_PASS,
5190 frame.render_passes[0]->quad_list[1]->material); 5190 frame.render_passes[0]->quad_list[1]->material);
5191 const RenderPassDrawQuad* replica_quad = 5191 const RenderPassDrawQuad* replica_quad =
5192 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]); 5192 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]);
5193 EXPECT_TRUE(replica_quad->is_replica); 5193 EXPECT_TRUE(replica_quad->is_replica);
5194 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), 5194 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
5195 replica_quad->rect.ToString()); 5195 replica_quad->rect.ToString());
5196 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 5196 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
5197 replica_quad->mask_uv_rect.ToString()); 5197 replica_quad->mask_uv_rect.ToString());
5198 5198
5199 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5199 host_impl_->DrawLayers(&frame);
5200 host_impl_->DidDrawAllLayers(frame); 5200 host_impl_->DidDrawAllLayers(frame);
5201 } 5201 }
5202 5202
5203 // Applying a different contents scale to the mask layer means it will have 5203 // Applying a different contents scale to the mask layer means it will have
5204 // a larger texture, but it should use the same tex coords to cover the 5204 // a larger texture, but it should use the same tex coords to cover the
5205 // layer it masks. 5205 // layer it masks.
5206 mask_layer->SetContentBounds(mask_size); 5206 mask_layer->SetContentBounds(mask_size);
5207 mask_layer->SetContentsScale(1.f, 1.f); 5207 mask_layer->SetContentsScale(1.f, 1.f);
5208 host_impl_->active_tree()->set_needs_update_draw_properties(); 5208 host_impl_->active_tree()->set_needs_update_draw_properties();
5209 { 5209 {
5210 LayerTreeHostImpl::FrameData frame; 5210 LayerTreeHostImpl::FrameData frame;
5211 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5211 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5212 5212
5213 ASSERT_EQ(1u, frame.render_passes.size()); 5213 ASSERT_EQ(1u, frame.render_passes.size());
5214 ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size()); 5214 ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size());
5215 ASSERT_EQ(DrawQuad::RENDER_PASS, 5215 ASSERT_EQ(DrawQuad::RENDER_PASS,
5216 frame.render_passes[0]->quad_list[1]->material); 5216 frame.render_passes[0]->quad_list[1]->material);
5217 const RenderPassDrawQuad* replica_quad = 5217 const RenderPassDrawQuad* replica_quad =
5218 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]); 5218 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]);
5219 EXPECT_TRUE(replica_quad->is_replica); 5219 EXPECT_TRUE(replica_quad->is_replica);
5220 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), 5220 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
5221 replica_quad->rect.ToString()); 5221 replica_quad->rect.ToString());
5222 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 5222 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
5223 replica_quad->mask_uv_rect.ToString()); 5223 replica_quad->mask_uv_rect.ToString());
5224 5224
5225 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5225 host_impl_->DrawLayers(&frame);
5226 host_impl_->DidDrawAllLayers(frame); 5226 host_impl_->DidDrawAllLayers(frame);
5227 } 5227 }
5228 } 5228 }
5229 5229
5230 TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerForSurfaceWithUnclippedChild) { 5230 TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerForSurfaceWithUnclippedChild) {
5231 // The replica is of a layer with bounds 50x50, but it has a child that causes 5231 // The replica is of a layer with bounds 50x50, but it has a child that causes
5232 // the surface bounds to be larger. 5232 // the surface bounds to be larger.
5233 5233
5234 scoped_ptr<LayerImpl> scoped_root = 5234 scoped_ptr<LayerImpl> scoped_root =
5235 LayerImpl::Create(host_impl_->active_tree(), 1); 5235 LayerImpl::Create(host_impl_->active_tree(), 1);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
5302 ASSERT_EQ(DrawQuad::RENDER_PASS, 5302 ASSERT_EQ(DrawQuad::RENDER_PASS,
5303 frame.render_passes[0]->quad_list[1]->material); 5303 frame.render_passes[0]->quad_list[1]->material);
5304 const RenderPassDrawQuad* replica_quad = 5304 const RenderPassDrawQuad* replica_quad =
5305 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]); 5305 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]);
5306 EXPECT_TRUE(replica_quad->is_replica); 5306 EXPECT_TRUE(replica_quad->is_replica);
5307 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(), 5307 EXPECT_EQ(gfx::Rect(0, 0, 100, 50).ToString(),
5308 replica_quad->rect.ToString()); 5308 replica_quad->rect.ToString());
5309 EXPECT_EQ(gfx::RectF(0.f, 0.f, 2.f, 1.f).ToString(), 5309 EXPECT_EQ(gfx::RectF(0.f, 0.f, 2.f, 1.f).ToString(),
5310 replica_quad->mask_uv_rect.ToString()); 5310 replica_quad->mask_uv_rect.ToString());
5311 5311
5312 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5312 host_impl_->DrawLayers(&frame);
5313 host_impl_->DidDrawAllLayers(frame); 5313 host_impl_->DidDrawAllLayers(frame);
5314 } 5314 }
5315 5315
5316 // Move the child to (-50, 0) instead. Now the mask should be moved to still 5316 // Move the child to (-50, 0) instead. Now the mask should be moved to still
5317 // cover the layer being replicated. 5317 // cover the layer being replicated.
5318 content_child_layer->SetPosition(gfx::Point(-50, 0)); 5318 content_child_layer->SetPosition(gfx::Point(-50, 0));
5319 { 5319 {
5320 LayerTreeHostImpl::FrameData frame; 5320 LayerTreeHostImpl::FrameData frame;
5321 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5321 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5322 5322
(...skipping 13 matching lines...) Expand all
5336 ASSERT_EQ(DrawQuad::RENDER_PASS, 5336 ASSERT_EQ(DrawQuad::RENDER_PASS,
5337 frame.render_passes[0]->quad_list[1]->material); 5337 frame.render_passes[0]->quad_list[1]->material);
5338 const RenderPassDrawQuad* replica_quad = 5338 const RenderPassDrawQuad* replica_quad =
5339 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]); 5339 RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[1]);
5340 EXPECT_TRUE(replica_quad->is_replica); 5340 EXPECT_TRUE(replica_quad->is_replica);
5341 EXPECT_EQ(gfx::Rect(-50, 0, 100, 50).ToString(), 5341 EXPECT_EQ(gfx::Rect(-50, 0, 100, 50).ToString(),
5342 replica_quad->rect.ToString()); 5342 replica_quad->rect.ToString());
5343 EXPECT_EQ(gfx::RectF(-1.f, 0.f, 2.f, 1.f).ToString(), 5343 EXPECT_EQ(gfx::RectF(-1.f, 0.f, 2.f, 1.f).ToString(),
5344 replica_quad->mask_uv_rect.ToString()); 5344 replica_quad->mask_uv_rect.ToString());
5345 5345
5346 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5346 host_impl_->DrawLayers(&frame);
5347 host_impl_->DidDrawAllLayers(frame); 5347 host_impl_->DidDrawAllLayers(frame);
5348 } 5348 }
5349 } 5349 }
5350 5350
5351 TEST_F(LayerTreeHostImplTest, MaskLayerForSurfaceWithClippedLayer) { 5351 TEST_F(LayerTreeHostImplTest, MaskLayerForSurfaceWithClippedLayer) {
5352 // The masked layer has bounds 50x50, but it has a child that causes 5352 // The masked layer has bounds 50x50, but it has a child that causes
5353 // the surface bounds to be larger. It also has a parent that clips the 5353 // the surface bounds to be larger. It also has a parent that clips the
5354 // masked layer and its surface. 5354 // masked layer and its surface.
5355 5355
5356 scoped_ptr<LayerImpl> scoped_root = 5356 scoped_ptr<LayerImpl> scoped_root =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
5427 render_pass_quad->rect.ToString()); 5427 render_pass_quad->rect.ToString());
5428 5428
5429 // The masked layer is 50x50, but the surface size is 10x20. So the texture 5429 // The masked layer is 50x50, but the surface size is 10x20. So the texture
5430 // coords in the mask are scaled by 10/50 and 20/50. 5430 // coords in the mask are scaled by 10/50 and 20/50.
5431 // The surface is clipped to (20,10) so the mask texture coords are offset 5431 // The surface is clipped to (20,10) so the mask texture coords are offset
5432 // by 20/50 and 10/50 5432 // by 20/50 and 10/50
5433 EXPECT_EQ(gfx::ScaleRect(gfx::RectF(20.f, 10.f, 10.f, 20.f), 5433 EXPECT_EQ(gfx::ScaleRect(gfx::RectF(20.f, 10.f, 10.f, 20.f),
5434 1.f / 50.f).ToString(), 5434 1.f / 50.f).ToString(),
5435 render_pass_quad->mask_uv_rect.ToString()); 5435 render_pass_quad->mask_uv_rect.ToString());
5436 5436
5437 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5437 host_impl_->DrawLayers(&frame);
5438 host_impl_->DidDrawAllLayers(frame); 5438 host_impl_->DidDrawAllLayers(frame);
5439 } 5439 }
5440 } 5440 }
5441 5441
5442 class GLRendererWithSetupQuadForAntialiasing : public GLRenderer { 5442 class GLRendererWithSetupQuadForAntialiasing : public GLRenderer {
5443 public: 5443 public:
5444 using GLRenderer::SetupQuadForAntialiasing; 5444 using GLRenderer::SetupQuadForAntialiasing;
5445 }; 5445 };
5446 5446
5447 TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { 5447 TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
5499 ASSERT_LE(1u, frame.render_passes[0]->quad_list.size()); 5499 ASSERT_LE(1u, frame.render_passes[0]->quad_list.size());
5500 const DrawQuad* quad = frame.render_passes[0]->quad_list[0]; 5500 const DrawQuad* quad = frame.render_passes[0]->quad_list[0];
5501 5501
5502 float edge[24]; 5502 float edge[24];
5503 gfx::QuadF device_layer_quad; 5503 gfx::QuadF device_layer_quad;
5504 bool antialiased = 5504 bool antialiased =
5505 GLRendererWithSetupQuadForAntialiasing::SetupQuadForAntialiasing( 5505 GLRendererWithSetupQuadForAntialiasing::SetupQuadForAntialiasing(
5506 quad->quadTransform(), quad, &device_layer_quad, edge); 5506 quad->quadTransform(), quad, &device_layer_quad, edge);
5507 EXPECT_FALSE(antialiased); 5507 EXPECT_FALSE(antialiased);
5508 5508
5509 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5509 host_impl_->DrawLayers(&frame);
5510 host_impl_->DidDrawAllLayers(frame); 5510 host_impl_->DidDrawAllLayers(frame);
5511 } 5511 }
5512 5512
5513 5513
5514 class CompositorFrameMetadataTest : public LayerTreeHostImplTest { 5514 class CompositorFrameMetadataTest : public LayerTreeHostImplTest {
5515 public: 5515 public:
5516 CompositorFrameMetadataTest() 5516 CompositorFrameMetadataTest()
5517 : swap_buffers_complete_(0) {} 5517 : swap_buffers_complete_(0) {}
5518 5518
5519 virtual void DidSwapBuffersCompleteOnImplThread() OVERRIDE { 5519 virtual void DidSwapBuffersCompleteOnImplThread() OVERRIDE {
5520 swap_buffers_complete_++; 5520 swap_buffers_complete_++;
5521 } 5521 }
5522 5522
5523 int swap_buffers_complete_; 5523 int swap_buffers_complete_;
5524 }; 5524 };
5525 5525
5526 TEST_F(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) { 5526 TEST_F(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) {
5527 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1)); 5527 SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
5528 { 5528 {
5529 LayerTreeHostImpl::FrameData frame; 5529 LayerTreeHostImpl::FrameData frame;
5530 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5530 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5531 host_impl_->DrawLayers(&frame, base::TimeTicks()); 5531 host_impl_->DrawLayers(&frame);
5532 host_impl_->DidDrawAllLayers(frame); 5532 host_impl_->DidDrawAllLayers(frame);
5533 } 5533 }
5534 CompositorFrameAck ack; 5534 CompositorFrameAck ack;
5535 host_impl_->ReclaimResources(&ack); 5535 host_impl_->ReclaimResources(&ack);
5536 host_impl_->DidSwapBuffersComplete(); 5536 host_impl_->DidSwapBuffersComplete();
5537 EXPECT_EQ(swap_buffers_complete_, 1); 5537 EXPECT_EQ(swap_buffers_complete_, 1);
5538 } 5538 }
5539 5539
5540 class CountingSoftwareDevice : public SoftwareOutputDevice { 5540 class CountingSoftwareDevice : public SoftwareOutputDevice {
5541 public: 5541 public:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
5607 scoped_ptr<VideoLayerImpl> video_layer = 5607 scoped_ptr<VideoLayerImpl> video_layer =
5608 VideoLayerImpl::Create(host_impl_->active_tree(), 2, &provider); 5608 VideoLayerImpl::Create(host_impl_->active_tree(), 2, &provider);
5609 video_layer->SetBounds(gfx::Size(10, 10)); 5609 video_layer->SetBounds(gfx::Size(10, 10));
5610 video_layer->SetContentBounds(gfx::Size(10, 10)); 5610 video_layer->SetContentBounds(gfx::Size(10, 10));
5611 video_layer->SetDrawsContent(true); 5611 video_layer->SetDrawsContent(true);
5612 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); 5612 root_layer->AddChild(video_layer.PassAs<LayerImpl>());
5613 SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); 5613 SetupRootLayerImpl(root_layer.PassAs<LayerImpl>());
5614 5614
5615 LayerTreeHostImpl::FrameData frame; 5615 LayerTreeHostImpl::FrameData frame;
5616 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5616 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5617 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5617 host_impl_->DrawLayers(&frame);
5618 host_impl_->DidDrawAllLayers(frame); 5618 host_impl_->DidDrawAllLayers(frame);
5619 5619
5620 EXPECT_EQ(1u, frame.will_draw_layers.size()); 5620 EXPECT_EQ(1u, frame.will_draw_layers.size());
5621 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]); 5621 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]);
5622 } 5622 }
5623 5623
5624 class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest { 5624 class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest {
5625 protected: 5625 protected:
5626 virtual void SetUp() OVERRIDE { 5626 virtual void SetUp() OVERRIDE {
5627 LayerTreeHostImplTest::SetUp(); 5627 LayerTreeHostImplTest::SetUp();
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
5913 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); 5913 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
5914 5914
5915 ScopedPtrVector<CopyOutputRequest> requests; 5915 ScopedPtrVector<CopyOutputRequest> requests;
5916 requests.push_back(CopyOutputRequest::CreateRequest( 5916 requests.push_back(CopyOutputRequest::CreateRequest(
5917 base::Bind(&ShutdownReleasesContext_Callback))); 5917 base::Bind(&ShutdownReleasesContext_Callback)));
5918 5918
5919 host_impl_->active_tree()->root_layer()->PassCopyRequests(&requests); 5919 host_impl_->active_tree()->root_layer()->PassCopyRequests(&requests);
5920 5920
5921 LayerTreeHostImpl::FrameData frame; 5921 LayerTreeHostImpl::FrameData frame;
5922 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 5922 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
5923 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 5923 host_impl_->DrawLayers(&frame);
5924 host_impl_->DidDrawAllLayers(frame); 5924 host_impl_->DidDrawAllLayers(frame);
5925 5925
5926 // The CopyOutputResult's callback has a ref on the ContextProvider and a 5926 // The CopyOutputResult's callback has a ref on the ContextProvider and a
5927 // texture in a texture mailbox. 5927 // texture in a texture mailbox.
5928 EXPECT_FALSE(context_provider->HasOneRef()); 5928 EXPECT_FALSE(context_provider->HasOneRef());
5929 EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures()); 5929 EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures());
5930 5930
5931 host_impl_.reset(); 5931 host_impl_.reset();
5932 5932
5933 // The CopyOutputResult's callback was cancelled, the CopyOutputResult 5933 // The CopyOutputResult's callback was cancelled, the CopyOutputResult
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
6273 latency_info.AddLatencyNumber( 6273 latency_info.AddLatencyNumber(
6274 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0); 6274 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0);
6275 scoped_ptr<SwapPromise> swap_promise( 6275 scoped_ptr<SwapPromise> swap_promise(
6276 new LatencyInfoSwapPromise(latency_info)); 6276 new LatencyInfoSwapPromise(latency_info));
6277 host_impl_->active_tree()->QueueSwapPromise(swap_promise.Pass()); 6277 host_impl_->active_tree()->QueueSwapPromise(swap_promise.Pass());
6278 host_impl_->SetNeedsRedraw(); 6278 host_impl_->SetNeedsRedraw();
6279 6279
6280 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); 6280 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
6281 LayerTreeHostImpl::FrameData frame; 6281 LayerTreeHostImpl::FrameData frame;
6282 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 6282 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
6283 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 6283 host_impl_->DrawLayers(&frame);
6284 host_impl_->DidDrawAllLayers(frame); 6284 host_impl_->DidDrawAllLayers(frame);
6285 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); 6285 EXPECT_TRUE(host_impl_->SwapBuffers(frame));
6286 6286
6287 const std::vector<ui::LatencyInfo>& metadata_latency_after = 6287 const std::vector<ui::LatencyInfo>& metadata_latency_after =
6288 fake_output_surface->last_sent_frame().metadata.latency_info; 6288 fake_output_surface->last_sent_frame().metadata.latency_info;
6289 EXPECT_EQ(1u, metadata_latency_after.size()); 6289 EXPECT_EQ(1u, metadata_latency_after.size());
6290 EXPECT_TRUE(metadata_latency_after[0].FindLatency( 6290 EXPECT_TRUE(metadata_latency_after[0].FindLatency(
6291 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); 6291 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL));
6292 } 6292 }
6293 6293
(...skipping 26 matching lines...) Expand all
6320 anchor.layer_rect = selection_rect; 6320 anchor.layer_rect = selection_rect;
6321 focus = anchor; 6321 focus = anchor;
6322 host_impl_->active_tree()->RegisterSelection(anchor, focus); 6322 host_impl_->active_tree()->RegisterSelection(anchor, focus);
6323 6323
6324 // Trigger a draw-swap sequence. 6324 // Trigger a draw-swap sequence.
6325 host_impl_->SetNeedsRedraw(); 6325 host_impl_->SetNeedsRedraw();
6326 6326
6327 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); 6327 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
6328 LayerTreeHostImpl::FrameData frame; 6328 LayerTreeHostImpl::FrameData frame;
6329 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 6329 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
6330 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); 6330 host_impl_->DrawLayers(&frame);
6331 host_impl_->DidDrawAllLayers(frame); 6331 host_impl_->DidDrawAllLayers(frame);
6332 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); 6332 EXPECT_TRUE(host_impl_->SwapBuffers(frame));
6333 6333
6334 // Ensure the selection bounds have propagated to the frame metadata. 6334 // Ensure the selection bounds have propagated to the frame metadata.
6335 const ViewportSelectionBound& selection_anchor_after = 6335 const ViewportSelectionBound& selection_anchor_after =
6336 fake_output_surface->last_sent_frame().metadata.selection_anchor; 6336 fake_output_surface->last_sent_frame().metadata.selection_anchor;
6337 const ViewportSelectionBound& selection_focus_after = 6337 const ViewportSelectionBound& selection_focus_after =
6338 fake_output_surface->last_sent_frame().metadata.selection_focus; 6338 fake_output_surface->last_sent_frame().metadata.selection_focus;
6339 EXPECT_EQ(anchor.type, selection_anchor_after.type); 6339 EXPECT_EQ(anchor.type, selection_anchor_after.type);
6340 EXPECT_EQ(focus.type, selection_focus_after.type); 6340 EXPECT_EQ(focus.type, selection_focus_after.type);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
6650 external_viewport, 6650 external_viewport,
6651 external_clip, 6651 external_clip,
6652 valid_for_tile_management); 6652 valid_for_tile_management);
6653 DrawFrame(); 6653 DrawFrame();
6654 EXPECT_TRANSFORMATION_MATRIX_EQ( 6654 EXPECT_TRANSFORMATION_MATRIX_EQ(
6655 external_transform, layer->draw_properties().target_space_transform); 6655 external_transform, layer->draw_properties().target_space_transform);
6656 } 6656 }
6657 6657
6658 } // namespace 6658 } // namespace
6659 } // namespace cc 6659 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698