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

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

Issue 270823003: cc: Move gpu rasterization flag from LayerImpl to LayerTreeImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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') | cc/trees/layer_tree_host.cc » ('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 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 } 1665 }
1666 1666
1667 TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) { 1667 TEST_F(PictureLayerImplTest, NoLowResTilingWithGpuRasterization) {
1668 gfx::Size default_tile_size(host_impl_.settings().default_tile_size); 1668 gfx::Size default_tile_size(host_impl_.settings().default_tile_size);
1669 gfx::Size layer_bounds(default_tile_size.width() * 4, 1669 gfx::Size layer_bounds(default_tile_size.width() * 4,
1670 default_tile_size.height() * 4); 1670 default_tile_size.height() * 4);
1671 float result_scale_x, result_scale_y; 1671 float result_scale_x, result_scale_y;
1672 gfx::Size result_bounds; 1672 gfx::Size result_bounds;
1673 1673
1674 SetupDefaultTrees(layer_bounds); 1674 SetupDefaultTrees(layer_bounds);
1675 EXPECT_FALSE(pending_layer_->ShouldUseGpuRasterization()); 1675 EXPECT_FALSE(pending_layer_->use_gpu_rasterization());
1676 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1676 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1677 pending_layer_->CalculateContentsScale(1.f, 1677 pending_layer_->CalculateContentsScale(1.f,
1678 1.f, 1678 1.f,
1679 1.f, 1679 1.f,
1680 1.f, 1680 1.f,
1681 false, 1681 false,
1682 &result_scale_x, 1682 &result_scale_x,
1683 &result_scale_y, 1683 &result_scale_y,
1684 &result_bounds); 1684 &result_bounds);
1685 // Should have a low-res and a high-res tiling. 1685 // Should have a low-res and a high-res tiling.
1686 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings()); 1686 ASSERT_EQ(2u, pending_layer_->tilings()->num_tilings());
1687 1687
1688 pending_layer_->SetUseGpuRasterization(true); 1688 ResetTilingsAndRasterScales();
1689 EXPECT_TRUE(pending_layer_->ShouldUseGpuRasterization()); 1689
1690 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1690 host_impl_.pending_tree()->SetUseGpuRasterization(true);
1691 EXPECT_TRUE(pending_layer_->use_gpu_rasterization());
1691 pending_layer_->CalculateContentsScale(1.f, 1692 pending_layer_->CalculateContentsScale(1.f,
1692 1.f, 1693 1.f,
1693 1.f, 1694 1.f,
1694 1.f, 1695 1.f,
1695 false, 1696 false,
1696 &result_scale_x, 1697 &result_scale_x,
1697 &result_scale_y, 1698 &result_scale_y,
1698 &result_bounds); 1699 &result_bounds);
1699 // Should only have the high-res tiling. 1700 // Should only have the high-res tiling.
1700 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1701 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 device_scale, 1897 device_scale,
1897 page_scale, 1898 page_scale,
1898 maximum_animation_scale, 1899 maximum_animation_scale,
1899 animating_transform); 1900 animating_transform);
1900 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); 1901 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
1901 } 1902 }
1902 1903
1903 TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForGpuRasterization) { 1904 TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForGpuRasterization) {
1904 gfx::Size tile_size(host_impl_.settings().default_tile_size); 1905 gfx::Size tile_size(host_impl_.settings().default_tile_size);
1905 SetupDefaultTrees(tile_size); 1906 SetupDefaultTrees(tile_size);
1906 pending_layer_->SetUseGpuRasterization(true); 1907 host_impl_.pending_tree()->SetUseGpuRasterization(true);
1907 active_layer_->SetUseGpuRasterization(true); 1908 host_impl_.active_tree()->SetUseGpuRasterization(true);
1909 EXPECT_TRUE(pending_layer_->use_gpu_rasterization());
1910 EXPECT_TRUE(active_layer_->use_gpu_rasterization());
1908 1911
1909 float contents_scale = 1.f; 1912 float contents_scale = 1.f;
1910 float device_scale = 1.f; 1913 float device_scale = 1.f;
1911 float page_scale = 1.f; 1914 float page_scale = 1.f;
1912 float maximum_animation_scale = 1.f; 1915 float maximum_animation_scale = 1.f;
1913 bool animating_transform = false; 1916 bool animating_transform = false;
1914 1917
1915 SetContentsScaleOnBothLayers(contents_scale, 1918 SetContentsScaleOnBothLayers(contents_scale,
1916 device_scale, 1919 device_scale,
1917 page_scale, 1920 page_scale,
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 SetContentsScaleOnBothLayers(contents_scale, 2295 SetContentsScaleOnBothLayers(contents_scale,
2293 device_scale, 2296 device_scale,
2294 page_scale, 2297 page_scale,
2295 maximum_animation_scale, 2298 maximum_animation_scale,
2296 animating_transform); 2299 animating_transform);
2297 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 2300 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
2298 } 2301 }
2299 2302
2300 } // namespace 2303 } // namespace
2301 } // namespace cc 2304 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698