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

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

Issue 2681183002: cc: Add flag to disable future mask tiling. (Closed)
Patch Set: Correct my mistake in rebase. Created 3 years, 10 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') | cc/trees/layer_tree_settings.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 starting_animation_scale, animating_transform); 1141 starting_animation_scale, animating_transform);
1142 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); 1142 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
1143 EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(), 1143 EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(),
1144 contents_scale * low_res_factor); 1144 contents_scale * low_res_factor);
1145 EXPECT_FALSE(pending_layer()->LowResTiling()); 1145 EXPECT_FALSE(pending_layer()->LowResTiling());
1146 EXPECT_EQ(active_layer()->num_tilings(), 2u); 1146 EXPECT_EQ(active_layer()->num_tilings(), 2u);
1147 EXPECT_EQ(pending_layer()->num_tilings(), 1u); 1147 EXPECT_EQ(pending_layer()->num_tilings(), 1u);
1148 1148
1149 // Mask layers dont create low res since they always fit on one tile. 1149 // Mask layers dont create low res since they always fit on one tile.
1150 std::unique_ptr<FakePictureLayerImpl> mask = 1150 std::unique_ptr<FakePictureLayerImpl> mask =
1151 FakePictureLayerImpl::CreateMaskWithRasterSource( 1151 FakePictureLayerImpl::CreateSingleTextureMaskWithRasterSource(
1152 host_impl()->pending_tree(), 3, pending_raster_source); 1152 host_impl()->pending_tree(), 3, pending_raster_source);
1153 mask->SetBounds(layer_bounds); 1153 mask->SetBounds(layer_bounds);
1154 mask->SetDrawsContent(true); 1154 mask->SetDrawsContent(true);
1155 pending_layer()->test_properties()->SetMaskLayer(std::move(mask)); 1155 pending_layer()->test_properties()->SetMaskLayer(std::move(mask));
1156 pending_layer()->test_properties()->force_render_surface = true; 1156 pending_layer()->test_properties()->force_render_surface = true;
1157 RebuildPropertyTreesOnPendingTree(); 1157 RebuildPropertyTreesOnPendingTree();
1158 host_impl()->pending_tree()->UpdateDrawProperties(false); 1158 host_impl()->pending_tree()->UpdateDrawProperties(false);
1159 1159
1160 FakePictureLayerImpl* mask_raw = static_cast<FakePictureLayerImpl*>( 1160 FakePictureLayerImpl* mask_raw = static_cast<FakePictureLayerImpl*>(
1161 pending_layer()->test_properties()->mask_layer); 1161 pending_layer()->test_properties()->mask_layer);
(...skipping 12 matching lines...) Expand all
1174 TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { 1174 TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
1175 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1175 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1176 1176
1177 gfx::Size layer_bounds(1000, 1000); 1177 gfx::Size layer_bounds(1000, 1000);
1178 1178
1179 scoped_refptr<FakeRasterSource> valid_raster_source = 1179 scoped_refptr<FakeRasterSource> valid_raster_source =
1180 FakeRasterSource::CreateFilled(layer_bounds); 1180 FakeRasterSource::CreateFilled(layer_bounds);
1181 SetupPendingTree(valid_raster_source); 1181 SetupPendingTree(valid_raster_source);
1182 1182
1183 std::unique_ptr<FakePictureLayerImpl> mask_ptr = 1183 std::unique_ptr<FakePictureLayerImpl> mask_ptr =
1184 FakePictureLayerImpl::CreateMaskWithRasterSource( 1184 FakePictureLayerImpl::CreateSingleTextureMaskWithRasterSource(
1185 host_impl()->pending_tree(), 3, valid_raster_source); 1185 host_impl()->pending_tree(), 3, valid_raster_source);
1186 mask_ptr->SetBounds(layer_bounds); 1186 mask_ptr->SetBounds(layer_bounds);
1187 mask_ptr->SetDrawsContent(true); 1187 mask_ptr->SetDrawsContent(true);
1188 pending_layer()->test_properties()->SetMaskLayer(std::move(mask_ptr)); 1188 pending_layer()->test_properties()->SetMaskLayer(std::move(mask_ptr));
1189 pending_layer()->test_properties()->force_render_surface = true; 1189 pending_layer()->test_properties()->force_render_surface = true;
1190 1190
1191 RebuildPropertyTreesOnPendingTree(); 1191 RebuildPropertyTreesOnPendingTree();
1192 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1192 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1193 bool update_lcd_text = false; 1193 bool update_lcd_text = false;
1194 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); 1194 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 1303
1304 gfx::Size layer_bounds(1000, 1000); 1304 gfx::Size layer_bounds(1000, 1000);
1305 1305
1306 SetInitialDeviceScaleFactor(1.3f); 1306 SetInitialDeviceScaleFactor(1.3f);
1307 1307
1308 scoped_refptr<FakeRasterSource> valid_raster_source = 1308 scoped_refptr<FakeRasterSource> valid_raster_source =
1309 FakeRasterSource::CreateFilled(layer_bounds); 1309 FakeRasterSource::CreateFilled(layer_bounds);
1310 SetupPendingTree(valid_raster_source); 1310 SetupPendingTree(valid_raster_source);
1311 1311
1312 std::unique_ptr<FakePictureLayerImpl> mask_ptr = 1312 std::unique_ptr<FakePictureLayerImpl> mask_ptr =
1313 FakePictureLayerImpl::CreateMaskWithRasterSource( 1313 FakePictureLayerImpl::CreateSingleTextureMaskWithRasterSource(
1314 host_impl()->pending_tree(), 3, valid_raster_source); 1314 host_impl()->pending_tree(), 3, valid_raster_source);
1315 mask_ptr->SetBounds(layer_bounds); 1315 mask_ptr->SetBounds(layer_bounds);
1316 mask_ptr->SetDrawsContent(true); 1316 mask_ptr->SetDrawsContent(true);
1317 pending_layer()->test_properties()->SetMaskLayer(std::move(mask_ptr)); 1317 pending_layer()->test_properties()->SetMaskLayer(std::move(mask_ptr));
1318 pending_layer()->test_properties()->force_render_surface = true; 1318 pending_layer()->test_properties()->force_render_surface = true;
1319 1319
1320 RebuildPropertyTreesOnPendingTree(); 1320 RebuildPropertyTreesOnPendingTree();
1321 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1321 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1322 bool update_lcd_text = false; 1322 bool update_lcd_text = false;
1323 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); 1323 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after
4943 EXPECT_FLOAT_EQ(expected_contents_scale, 4943 EXPECT_FLOAT_EQ(expected_contents_scale,
4944 pending_layer_ptr->picture_layer_tiling_set() 4944 pending_layer_ptr->picture_layer_tiling_set()
4945 ->FindTilingWithResolution(HIGH_RESOLUTION) 4945 ->FindTilingWithResolution(HIGH_RESOLUTION)
4946 ->contents_scale()) 4946 ->contents_scale())
4947 << "ideal_contents_scale: " << ideal_contents_scale; 4947 << "ideal_contents_scale: " << ideal_contents_scale;
4948 } 4948 }
4949 } 4949 }
4950 4950
4951 } // namespace 4951 } // namespace
4952 } // namespace cc 4952 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698