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

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

Issue 422233008: Re-raster during scale animations for GPU-rasterized layers without text (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment Created 6 years, 4 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') | cc/resources/picture.h » ('j') | 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 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 contents_scale = 11.f; 2121 contents_scale = 11.f;
2122 2122
2123 SetContentsScaleOnBothLayers(contents_scale, 2123 SetContentsScaleOnBothLayers(contents_scale,
2124 device_scale, 2124 device_scale,
2125 page_scale, 2125 page_scale,
2126 maximum_animation_scale, 2126 maximum_animation_scale,
2127 animating_transform); 2127 animating_transform);
2128 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f); 2128 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f);
2129 } 2129 }
2130 2130
2131 TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForGpuRasterization) {
2132 gfx::Size layer_bounds(100, 100);
2133 gfx::Size viewport_size(1000, 1000);
2134 SetupDefaultTrees(layer_bounds);
2135 host_impl_.SetViewportSize(viewport_size);
2136 host_impl_.SetUseGpuRasterization(true);
2137
2138 float contents_scale = 1.f;
2139 float device_scale = 1.3f;
2140 float page_scale = 1.4f;
2141 float maximum_animation_scale = 1.f;
2142 bool animating_transform = false;
2143
2144 SetContentsScaleOnBothLayers(contents_scale,
2145 device_scale,
2146 page_scale,
2147 maximum_animation_scale,
2148 animating_transform);
2149 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
2150
2151 // Since we're GPU-rasterizing, starting an animation should cause tiling
2152 // resolution to get set to the current contents scale.
2153 animating_transform = true;
2154 contents_scale = 2.f;
2155 maximum_animation_scale = 4.f;
2156
2157 SetContentsScaleOnBothLayers(contents_scale,
2158 device_scale,
2159 page_scale,
2160 maximum_animation_scale,
2161 animating_transform);
2162 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
2163
2164 // Further changes to scale during the animation should cause a new high-res
2165 // tiling to get created.
2166 contents_scale = 3.f;
2167
2168 SetContentsScaleOnBothLayers(contents_scale,
2169 device_scale,
2170 page_scale,
2171 maximum_animation_scale,
2172 animating_transform);
2173 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
2174
2175 // Since we're re-rasterizing during the animation, scales smaller than 1
2176 // should be respected.
2177 contents_scale = 0.25f;
2178
2179 SetContentsScaleOnBothLayers(contents_scale,
2180 device_scale,
2181 page_scale,
2182 maximum_animation_scale,
2183 animating_transform);
2184 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.25f);
2185
2186 // Once we stop animating, a new high-res tiling should be created.
2187 contents_scale = 4.f;
2188 animating_transform = false;
2189
2190 SetContentsScaleOnBothLayers(contents_scale,
2191 device_scale,
2192 page_scale,
2193 maximum_animation_scale,
2194 animating_transform);
2195 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
2196
2197 static_cast<FakePicturePileImpl*>(pending_layer_->pile())->set_has_text(true);
2198 static_cast<FakePicturePileImpl*>(active_layer_->pile())->set_has_text(true);
2199
2200 // Since we're GPU-rasterizing but have text, starting an animation should
2201 // cause tiling resolution to get set to the maximum animation scale.
2202 animating_transform = true;
2203 contents_scale = 2.f;
2204 maximum_animation_scale = 3.f;
2205
2206 SetContentsScaleOnBothLayers(contents_scale,
2207 device_scale,
2208 page_scale,
2209 maximum_animation_scale,
2210 animating_transform);
2211 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
2212
2213 // Further changes to scale during the animation should not cause a new
2214 // high-res tiling to get created.
2215 contents_scale = 4.f;
2216 maximum_animation_scale = 5.f;
2217
2218 SetContentsScaleOnBothLayers(contents_scale,
2219 device_scale,
2220 page_scale,
2221 maximum_animation_scale,
2222 animating_transform);
2223 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
2224
2225 // Once we stop animating, a new high-res tiling should be created.
2226 animating_transform = false;
2227
2228 SetContentsScaleOnBothLayers(contents_scale,
2229 device_scale,
2230 page_scale,
2231 maximum_animation_scale,
2232 animating_transform);
2233 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
2234 }
2235
2131 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { 2236 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) {
2132 gfx::Size tile_size(100, 100); 2237 gfx::Size tile_size(100, 100);
2133 gfx::Size layer_bounds(1000, 1000); 2238 gfx::Size layer_bounds(1000, 1000);
2134 2239
2135 scoped_refptr<FakePicturePileImpl> pending_pile = 2240 scoped_refptr<FakePicturePileImpl> pending_pile =
2136 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2241 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
2137 2242
2138 SetupPendingTree(pending_pile); 2243 SetupPendingTree(pending_pile);
2139 2244
2140 ASSERT_TRUE(pending_layer_->CanHaveTilings()); 2245 ASSERT_TRUE(pending_layer_->CanHaveTilings());
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 3825
3721 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 3826 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
3722 3827
3723 VerifyEvictionConsidersOcclusion(pending_layer_, 3828 VerifyEvictionConsidersOcclusion(pending_layer_,
3724 total_expected_occluded_tile_count); 3829 total_expected_occluded_tile_count);
3725 VerifyEvictionConsidersOcclusion(active_layer_, 3830 VerifyEvictionConsidersOcclusion(active_layer_,
3726 total_expected_occluded_tile_count); 3831 total_expected_occluded_tile_count);
3727 } 3832 }
3728 } // namespace 3833 } // namespace
3729 } // namespace cc 3834 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/picture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698