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

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

Issue 22144008: cc: Make 1/4th default low res scale. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase#2 Created 7 years, 2 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 | « no previous file | cc/trees/layer_tree_settings.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 <utility> 7 #include <utility>
8 8
9 #include "cc/debug/test_web_graphics_context_3d.h" 9 #include "cc/debug/test_web_graphics_context_3d.h"
10 #include "cc/layers/append_quads_data.h" 10 #include "cc/layers/append_quads_data.h"
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 735
736 // Stop animating, low res gets created. 736 // Stop animating, low res gets created.
737 animating_transform = false; 737 animating_transform = false;
738 SetContentsScaleOnBothLayers( 738 SetContentsScaleOnBothLayers(
739 contents_scale, device_scale, page_scale, animating_transform); 739 contents_scale, device_scale, page_scale, animating_transform);
740 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 740 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
741 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); 741 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
742 EXPECT_BOTH_EQ(num_tilings(), 2u); 742 EXPECT_BOTH_EQ(num_tilings(), 2u);
743 743
744 // Page scale animation, new high res, but not new low res because animating. 744 // Page scale animation, new high res, but not new low res because animating.
745 contents_scale = 4.f; 745 contents_scale = 2.f;
746 page_scale = 4.f; 746 page_scale = 2.f;
747 animating_transform = true; 747 animating_transform = true;
748 SetContentsScaleOnBothLayers( 748 SetContentsScaleOnBothLayers(
749 contents_scale, device_scale, page_scale, animating_transform); 749 contents_scale, device_scale, page_scale, animating_transform);
750 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); 750 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
751 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor); 751 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
752 EXPECT_BOTH_EQ(num_tilings(), 3u); 752 EXPECT_BOTH_EQ(num_tilings(), 3u);
753 753
754 // Stop animating, new low res gets created for final page scale. 754 // Stop animating, new low res gets created for final page scale.
755 animating_transform = false; 755 animating_transform = false;
756 SetContentsScaleOnBothLayers( 756 SetContentsScaleOnBothLayers(
757 contents_scale, device_scale, page_scale, animating_transform); 757 contents_scale, device_scale, page_scale, animating_transform);
758 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); 758 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
759 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 4.f * low_res_factor); 759 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), 2.f * low_res_factor);
760 EXPECT_BOTH_EQ(num_tilings(), 4u); 760 EXPECT_BOTH_EQ(num_tilings(), 4u);
761 } 761 }
762 762
763 TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { 763 TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
764 gfx::Size tile_size(host_impl_.settings().default_tile_size); 764 gfx::Size tile_size(host_impl_.settings().default_tile_size);
765 SetupDefaultTrees(tile_size); 765 SetupDefaultTrees(tile_size);
766 766
767 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 767 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
768 float device_scale = 1.f; 768 float device_scale = 1.f;
769 float page_scale = 1.f; 769 float page_scale = 1.f;
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 TestContextProvider::Create(), NULL)); 1159 TestContextProvider::Create(), NULL));
1160 1160
1161 // These will crash PictureLayerImpl if this is not true. 1161 // These will crash PictureLayerImpl if this is not true.
1162 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); 1162 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties());
1163 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); 1163 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties());
1164 host_impl_.active_tree()->UpdateDrawProperties(); 1164 host_impl_.active_tree()->UpdateDrawProperties();
1165 } 1165 }
1166 1166
1167 } // namespace 1167 } // namespace
1168 } // namespace cc 1168 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698