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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 420523002: cc: Don't rasterize large layers at maximum scale before scale animations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 ASSERT_TRUE(fake_output_surface->InitializeAndSetContext3d( 1856 ASSERT_TRUE(fake_output_surface->InitializeAndSetContext3d(
1857 TestContextProvider::Create())); 1857 TestContextProvider::Create()));
1858 1858
1859 // These will crash PictureLayerImpl if this is not true. 1859 // These will crash PictureLayerImpl if this is not true.
1860 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); 1860 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties());
1861 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); 1861 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties());
1862 host_impl_.active_tree()->UpdateDrawProperties(); 1862 host_impl_.active_tree()->UpdateDrawProperties();
1863 } 1863 }
1864 1864
1865 TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) { 1865 TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) {
1866 gfx::Size tile_size(host_impl_.settings().default_tile_size); 1866 gfx::Size layer_bounds(100, 100);
1867 SetupDefaultTrees(tile_size); 1867 gfx::Size viewport_size(1000, 1000);
1868 SetupDefaultTrees(layer_bounds);
1869 host_impl_.SetViewportSize(viewport_size);
1868 1870
1869 float contents_scale = 1.f; 1871 float contents_scale = 1.f;
1870 float device_scale = 1.3f; 1872 float device_scale = 1.3f;
1871 float page_scale = 1.4f; 1873 float page_scale = 1.4f;
1872 float maximum_animation_scale = 1.f; 1874 float maximum_animation_scale = 1.f;
1873 bool animating_transform = false; 1875 bool animating_transform = false;
1874 1876
1875 SetContentsScaleOnBothLayers(contents_scale, 1877 SetContentsScaleOnBothLayers(contents_scale,
1876 device_scale, 1878 device_scale,
1877 page_scale, 1879 page_scale,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 // Once we stop animating, a new high-res tiling should be created. 1943 // Once we stop animating, a new high-res tiling should be created.
1942 animating_transform = false; 1944 animating_transform = false;
1943 contents_scale = 4.f; 1945 contents_scale = 4.f;
1944 1946
1945 SetContentsScaleOnBothLayers(contents_scale, 1947 SetContentsScaleOnBothLayers(contents_scale,
1946 device_scale, 1948 device_scale,
1947 page_scale, 1949 page_scale,
1948 maximum_animation_scale, 1950 maximum_animation_scale,
1949 animating_transform); 1951 animating_transform);
1950 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); 1952 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
1953
1954 // When animating with a maxmium animation scale factor that is so large
1955 // that the layer grows larger than the viewport at this scale, a new
1956 // high-res tiling should get created at the animation's initial scale, not
1957 // at its maximum scale.
1958 animating_transform = true;
1959 contents_scale = 2.f;
1960 maximum_animation_scale = 11.f;
1961
1962 SetContentsScaleOnBothLayers(contents_scale,
1963 device_scale,
1964 page_scale,
1965 maximum_animation_scale,
1966 animating_transform);
1967 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
1968
1969 // Once we stop animating, a new high-res tiling should be created.
1970 animating_transform = false;
1971 contents_scale = 11.f;
1972
1973 SetContentsScaleOnBothLayers(contents_scale,
1974 device_scale,
1975 page_scale,
1976 maximum_animation_scale,
1977 animating_transform);
1978 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f);
1979
1980 // When animating with a maxmium animation scale factor that is so large
1981 // that the layer grows larger than the viewport at this scale, and where
1982 // the intial source scale is < 1, a new high-res tiling should get created
1983 // at source scale 1.
1984 animating_transform = true;
1985 contents_scale = 0.1f;
1986 maximum_animation_scale = 11.f;
1987
1988 SetContentsScaleOnBothLayers(contents_scale,
1989 device_scale,
1990 page_scale,
1991 maximum_animation_scale,
1992 animating_transform);
1993 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale);
1994
1995 // Once we stop animating, a new high-res tiling should be created.
1996 animating_transform = false;
1997 contents_scale = 11.f;
1998
1999 SetContentsScaleOnBothLayers(contents_scale,
2000 device_scale,
2001 page_scale,
2002 maximum_animation_scale,
2003 animating_transform);
2004 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f);
1951 } 2005 }
1952 2006
1953 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { 2007 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) {
1954 gfx::Size tile_size(100, 100); 2008 gfx::Size tile_size(100, 100);
1955 gfx::Size layer_bounds(1000, 1000); 2009 gfx::Size layer_bounds(1000, 1000);
1956 2010
1957 scoped_refptr<FakePicturePileImpl> pending_pile = 2011 scoped_refptr<FakePicturePileImpl> pending_pile =
1958 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2012 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1959 2013
1960 SetupPendingTree(pending_pile); 2014 SetupPendingTree(pending_pile);
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
3515 3569
3516 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 3570 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
3517 3571
3518 VerifyEvictionConsidersOcclusion(pending_layer_, 3572 VerifyEvictionConsidersOcclusion(pending_layer_,
3519 total_expected_occluded_tile_count); 3573 total_expected_occluded_tile_count);
3520 VerifyEvictionConsidersOcclusion(active_layer_, 3574 VerifyEvictionConsidersOcclusion(active_layer_,
3521 total_expected_occluded_tile_count); 3575 total_expected_occluded_tile_count);
3522 } 3576 }
3523 } // namespace 3577 } // namespace
3524 } // namespace cc 3578 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698