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

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

Issue 272283003: Revert 261000 "Re-raster GPU-rasterized layers during scale animations" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 7 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 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 contents_scale = 4.f; 1938 contents_scale = 4.f;
1939 1939
1940 SetContentsScaleOnBothLayers(contents_scale, 1940 SetContentsScaleOnBothLayers(contents_scale,
1941 device_scale, 1941 device_scale,
1942 page_scale, 1942 page_scale,
1943 maximum_animation_scale, 1943 maximum_animation_scale,
1944 animating_transform); 1944 animating_transform);
1945 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); 1945 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
1946 } 1946 }
1947 1947
1948 TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForGpuRasterization) {
1949 gfx::Size tile_size(host_impl_.settings().default_tile_size);
1950 SetupDefaultTrees(tile_size);
1951 host_impl_.pending_tree()->SetUseGpuRasterization(true);
1952 host_impl_.active_tree()->SetUseGpuRasterization(true);
1953 EXPECT_TRUE(pending_layer_->use_gpu_rasterization());
1954 EXPECT_TRUE(active_layer_->use_gpu_rasterization());
1955
1956 float contents_scale = 1.f;
1957 float device_scale = 1.f;
1958 float page_scale = 1.f;
1959 float maximum_animation_scale = 1.f;
1960 bool animating_transform = false;
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(), 1.f);
1968
1969 // Changing contents scale during an animation should cause tiling resolution
1970 // to change, since we're GPU-rasterizing. The maximum animation scale should
1971 // not have any effect.
1972 animating_transform = true;
1973 contents_scale = 2.f;
1974 maximum_animation_scale = 4.f;
1975
1976 SetContentsScaleOnBothLayers(contents_scale,
1977 device_scale,
1978 page_scale,
1979 maximum_animation_scale,
1980 animating_transform);
1981 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
1982
1983 // Since we're re-rasterizing during the animation, scales smaller than 1
1984 // should be respected.
1985 contents_scale = 0.5f;
1986 SetContentsScaleOnBothLayers(contents_scale,
1987 device_scale,
1988 page_scale,
1989 maximum_animation_scale,
1990 animating_transform);
1991 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
1992
1993 // Tiling resolution should also update once we stop animating.
1994 contents_scale = 4.f;
1995 animating_transform = false;
1996 SetContentsScaleOnBothLayers(contents_scale,
1997 device_scale,
1998 page_scale,
1999 maximum_animation_scale,
2000 animating_transform);
2001 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
2002 }
2003
2004 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { 1948 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) {
2005 gfx::Size tile_size(100, 100); 1949 gfx::Size tile_size(100, 100);
2006 gfx::Size layer_bounds(1000, 1000); 1950 gfx::Size layer_bounds(1000, 1000);
2007 1951
2008 scoped_refptr<FakePicturePileImpl> pending_pile = 1952 scoped_refptr<FakePicturePileImpl> pending_pile =
2009 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1953 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
2010 1954
2011 SetupPendingTree(pending_pile); 1955 SetupPendingTree(pending_pile);
2012 1956
2013 ASSERT_TRUE(pending_layer_->CanHaveTilings()); 1957 ASSERT_TRUE(pending_layer_->CanHaveTilings());
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 SetContentsScaleOnBothLayers(contents_scale, 2283 SetContentsScaleOnBothLayers(contents_scale,
2340 device_scale, 2284 device_scale,
2341 page_scale, 2285 page_scale,
2342 maximum_animation_scale, 2286 maximum_animation_scale,
2343 animating_transform); 2287 animating_transform);
2344 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 2288 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
2345 } 2289 }
2346 2290
2347 } // namespace 2291 } // namespace
2348 } // namespace cc 2292 } // 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