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

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

Issue 2251583002: Round GPU tiles to multiple of 64 to work around CA scaling issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reland Created 4 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
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 4759 matching lines...) Expand 10 before | Expand all | Expand 10 after
4770 host_impl()->SetHasGpuRasterizationTrigger(true); 4770 host_impl()->SetHasGpuRasterizationTrigger(true);
4771 host_impl()->CommitComplete(); 4771 host_impl()->CommitComplete();
4772 EXPECT_EQ(host_impl()->gpu_rasterization_status(), 4772 EXPECT_EQ(host_impl()->gpu_rasterization_status(),
4773 GpuRasterizationStatus::ON); 4773 GpuRasterizationStatus::ON);
4774 host_impl()->SetViewportSize(gfx::Size(2000, 2000)); 4774 host_impl()->SetViewportSize(gfx::Size(2000, 2000));
4775 4775
4776 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); 4776 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size());
4777 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); 4777 result = layer->CalculateTileSize(gfx::Size(10000, 10000));
4778 EXPECT_EQ(result.width(), 4778 EXPECT_EQ(result.width(),
4779 MathUtil::UncheckedRoundUp( 4779 MathUtil::UncheckedRoundUp(
4780 2000 + 2 * PictureLayerTiling::kBorderTexels, 4)); 4780 2000 + 2 * PictureLayerTiling::kBorderTexels, 64));
4781 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aligned. 4781 EXPECT_EQ(result.height(), 512); // 500 + 2, 64-byte aligned.
4782 4782
4783 // Clamp and round-up, when smaller than viewport. 4783 // Clamp and round-up, when smaller than viewport.
4784 // Tile-height doubles to 50% when width shrinks to <= 50%. 4784 // Tile-height doubles to 50% when width shrinks to <= 50%.
4785 host_impl()->SetViewportSize(gfx::Size(1000, 1000)); 4785 host_impl()->SetViewportSize(gfx::Size(1000, 1000));
4786 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); 4786 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size());
4787 result = layer->CalculateTileSize(gfx::Size(447, 10000)); 4787 result = layer->CalculateTileSize(gfx::Size(447, 10000));
4788 EXPECT_EQ(result.width(), 448); 4788 EXPECT_EQ(result.width(), 448);
4789 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aliged. 4789 EXPECT_EQ(result.height(), 512); // 500 + 2, 64-byte aliged.
4790 4790
4791 // Largest layer is 50% of viewport width (rounded up), and 4791 // Largest layer is 50% of viewport width (rounded up), and
4792 // 50% of viewport in height. 4792 // 50% of viewport in height.
4793 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4793 result = layer->CalculateTileSize(gfx::Size(447, 400));
4794 EXPECT_EQ(result.width(), 448); 4794 EXPECT_EQ(result.width(), 448);
4795 EXPECT_EQ(result.height(), 448); 4795 EXPECT_EQ(result.height(), 448);
4796 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4796 result = layer->CalculateTileSize(gfx::Size(500, 499));
4797 EXPECT_EQ(result.width(), 512); 4797 EXPECT_EQ(result.width(), 512);
4798 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aligned. 4798 EXPECT_EQ(result.height(), 512); // 500 + 2, 64-byte aligned.
4799 } 4799 }
4800 4800
4801 TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) { 4801 TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) {
4802 gfx::Size layer_bounds(1300, 1900); 4802 gfx::Size layer_bounds(1300, 1900);
4803 4803
4804 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; 4804 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor;
4805 SetupDefaultTrees(layer_bounds); 4805 SetupDefaultTrees(layer_bounds);
4806 ResetTilingsAndRasterScales(); 4806 ResetTilingsAndRasterScales();
4807 4807
4808 float page_scale = 2.f; 4808 float page_scale = 2.f;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
5023 EXPECT_FLOAT_EQ(expected_contents_scale, 5023 EXPECT_FLOAT_EQ(expected_contents_scale,
5024 pending_layer_ptr->picture_layer_tiling_set() 5024 pending_layer_ptr->picture_layer_tiling_set()
5025 ->FindTilingWithResolution(HIGH_RESOLUTION) 5025 ->FindTilingWithResolution(HIGH_RESOLUTION)
5026 ->contents_scale()) 5026 ->contents_scale())
5027 << "ideal_contents_scale: " << ideal_contents_scale; 5027 << "ideal_contents_scale: " << ideal_contents_scale;
5028 } 5028 }
5029 } 5029 }
5030 5030
5031 } // namespace 5031 } // namespace
5032 } // namespace cc 5032 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698