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

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

Issue 2402583005: Split picture layer quads to allow removing more occluded area. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 3 years, 6 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/layers/render_surface_impl_unittest.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 3084 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); 3095 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect());
3096 EXPECT_EQ(impl.quad_list().size(), 0u); 3096 EXPECT_EQ(impl.quad_list().size(), 0u);
3097 } 3097 }
3098 3098
3099 { 3099 {
3100 SCOPED_TRACE("Partial occlusion"); 3100 SCOPED_TRACE("Partial occlusion");
3101 gfx::Rect occluded(150, 0, 200, 1000); 3101 gfx::Rect occluded(150, 0, 200, 1000);
3102 impl.AppendQuadsWithOcclusion(active_layer(), occluded); 3102 impl.AppendQuadsWithOcclusion(active_layer(), occluded);
3103 3103
3104 size_t partially_occluded_count = 0; 3104 size_t partially_occluded_count = 0;
3105 LayerTestCommon::VerifyQuadsAreOccluded( 3105 LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, true,
3106 impl.quad_list(), occluded, &partially_occluded_count); 3106 &partially_occluded_count);
3107 // The layer outputs one quad, which is partially occluded. 3107 // The layer outputs one quad, which is partially occluded.
3108 EXPECT_EQ(100u - 10u, impl.quad_list().size()); 3108 EXPECT_EQ(100u - 10u, impl.quad_list().size());
3109 EXPECT_EQ(10u + 10u, partially_occluded_count); 3109 EXPECT_EQ(10u + 10u, partially_occluded_count);
3110 } 3110 }
3111
3112 {
3113 SCOPED_TRACE("Central occlusion");
3114 gfx::Rect occluded(150, 50, 200, 900);
3115 impl.AppendQuadsWithOcclusion(active_layer(), occluded);
3116
3117 size_t partially_occluded_count = 0;
3118 LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, true,
3119 &partially_occluded_count);
3120 // 8 quads in the middle are removed completely. 10 on the left and 10 on
3121 // the right are occluded, as 1 on the top and 1 on the bottom. The four
3122 // corners of the occluded region are each split into 2 quads.
3123 EXPECT_EQ(100u - 8u + 4u, impl.quad_list().size());
3124 EXPECT_EQ(10u + 10u + 4u + 2u, partially_occluded_count);
3125 }
3111 } 3126 }
3112 3127
3113 TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { 3128 TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) {
3114 gfx::Size tile_size(host_impl()->settings().default_tile_size); 3129 gfx::Size tile_size(host_impl()->settings().default_tile_size);
3115 SetupDefaultTrees(tile_size); 3130 SetupDefaultTrees(tile_size);
3116 3131
3117 ResetTilingsAndRasterScales(); 3132 ResetTilingsAndRasterScales();
3118 3133
3119 float contents_scale = 2.f; 3134 float contents_scale = 2.f;
3120 float device_scale = 1.f; 3135 float device_scale = 1.f;
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
5147 EXPECT_EQ(gfx::AxisTransform2d(2.25f, gfx::Vector2dF(0.75f, 0.25f)), 5162 EXPECT_EQ(gfx::AxisTransform2d(2.25f, gfx::Vector2dF(0.75f, 0.25f)),
5148 tiling->raster_transform()); 5163 tiling->raster_transform());
5149 EXPECT_EQ(4u, tiling->AllTilesForTesting().size()); 5164 EXPECT_EQ(4u, tiling->AllTilesForTesting().size());
5150 for (auto* tile : tiling->AllTilesForTesting()) 5165 for (auto* tile : tiling->AllTilesForTesting())
5151 EXPECT_EQ(tile->raster_transform(), tiling->raster_transform()); 5166 EXPECT_EQ(tile->raster_transform(), tiling->raster_transform());
5152 } 5167 }
5153 } 5168 }
5154 5169
5155 } // namespace 5170 } // namespace
5156 } // namespace cc 5171 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/layers/render_surface_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698