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

Side by Side Diff: cc/tiles/picture_layer_tiling_unittest.cc

Issue 1236533004: cc: Change max_tiles_for_interest_rect to be screen pixels padding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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/tiles/picture_layer_tiling_set_unittest.cc ('k') | cc/tiles/tile_manager_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 <limits> 5 #include <limits>
6 #include <set> 6 #include <set>
7 7
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 using PictureLayerTiling::TileAt; 42 using PictureLayerTiling::TileAt;
43 43
44 static scoped_ptr<TestablePictureLayerTiling> Create( 44 static scoped_ptr<TestablePictureLayerTiling> Create(
45 WhichTree tree, 45 WhichTree tree,
46 float contents_scale, 46 float contents_scale,
47 scoped_refptr<RasterSource> raster_source, 47 scoped_refptr<RasterSource> raster_source,
48 PictureLayerTilingClient* client, 48 PictureLayerTilingClient* client,
49 const LayerTreeSettings& settings) { 49 const LayerTreeSettings& settings) {
50 return make_scoped_ptr(new TestablePictureLayerTiling( 50 return make_scoped_ptr(new TestablePictureLayerTiling(
51 tree, contents_scale, raster_source, client, 51 tree, contents_scale, raster_source, client,
52 settings.max_tiles_for_interest_area, 52 settings.tiling_interest_area_padding,
53 settings.skewport_target_time_in_seconds, 53 settings.skewport_target_time_in_seconds,
54 settings.skewport_extrapolation_limit_in_content_pixels)); 54 settings.skewport_extrapolation_limit_in_content_pixels));
55 } 55 }
56 56
57 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } 57 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; }
58 58
59 using PictureLayerTiling::ComputeSkewport; 59 using PictureLayerTiling::ComputeSkewport;
60 using PictureLayerTiling::RemoveTileAt; 60 using PictureLayerTiling::RemoveTileAt;
61 61
62 protected: 62 protected:
63 TestablePictureLayerTiling(WhichTree tree, 63 TestablePictureLayerTiling(WhichTree tree,
64 float contents_scale, 64 float contents_scale,
65 scoped_refptr<RasterSource> raster_source, 65 scoped_refptr<RasterSource> raster_source,
66 PictureLayerTilingClient* client, 66 PictureLayerTilingClient* client,
67 size_t max_tiles_for_interest_area, 67 size_t tiling_interest_area_padding,
68 float skewport_target_time, 68 float skewport_target_time,
69 int skewport_extrapolation_limit) 69 int skewport_extrapolation_limit)
70 : PictureLayerTiling(tree, 70 : PictureLayerTiling(tree,
71 contents_scale, 71 contents_scale,
72 raster_source, 72 raster_source,
73 client, 73 client,
74 max_tiles_for_interest_area, 74 tiling_interest_area_padding,
75 skewport_target_time, 75 skewport_target_time,
76 skewport_extrapolation_limit) {} 76 skewport_extrapolation_limit) {}
77 }; 77 };
78 78
79 class PictureLayerTilingIteratorTest : public testing::Test { 79 class PictureLayerTilingIteratorTest : public testing::Test {
80 public: 80 public:
81 PictureLayerTilingIteratorTest() {} 81 PictureLayerTilingIteratorTest() {}
82 ~PictureLayerTilingIteratorTest() override {} 82 ~PictureLayerTilingIteratorTest() override {}
83 83
84 void Initialize(const gfx::Size& tile_size, 84 void Initialize(const gfx::Size& tile_size,
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 543 }
544 544
545 TEST(PictureLayerTilingTest, SkewportLimits) { 545 TEST(PictureLayerTilingTest, SkewportLimits) {
546 FakePictureLayerTilingClient client; 546 FakePictureLayerTilingClient client;
547 547
548 gfx::Rect viewport(0, 0, 100, 100); 548 gfx::Rect viewport(0, 0, 100, 100);
549 gfx::Size layer_bounds(200, 200); 549 gfx::Size layer_bounds(200, 200);
550 550
551 client.SetTileSize(gfx::Size(100, 100)); 551 client.SetTileSize(gfx::Size(100, 100));
552 LayerTreeSettings settings; 552 LayerTreeSettings settings;
553 settings.max_tiles_for_interest_area = 10000;
554 settings.skewport_extrapolation_limit_in_content_pixels = 75; 553 settings.skewport_extrapolation_limit_in_content_pixels = 75;
555 554
556 scoped_refptr<FakePicturePileImpl> pile = 555 scoped_refptr<FakePicturePileImpl> pile =
557 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); 556 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
558 scoped_ptr<TestablePictureLayerTiling> tiling = 557 scoped_ptr<TestablePictureLayerTiling> tiling =
559 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, pile, &client, 558 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, pile, &client,
560 settings); 559 settings);
561 560
562 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion()); 561 tiling->ComputeTilePriorityRects(viewport, 1.f, 1.0, Occlusion());
563 562
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 } 785 }
787 786
788 TEST(PictureLayerTilingTest, ViewportDistanceWithScale) { 787 TEST(PictureLayerTilingTest, ViewportDistanceWithScale) {
789 FakePictureLayerTilingClient client; 788 FakePictureLayerTilingClient client;
790 789
791 gfx::Rect viewport(0, 0, 100, 100); 790 gfx::Rect viewport(0, 0, 100, 100);
792 gfx::Size layer_bounds(1500, 1500); 791 gfx::Size layer_bounds(1500, 1500);
793 792
794 client.SetTileSize(gfx::Size(10, 10)); 793 client.SetTileSize(gfx::Size(10, 10));
795 LayerTreeSettings settings; 794 LayerTreeSettings settings;
796 settings.max_tiles_for_interest_area = 10000;
797 795
798 // Tiling at 0.25 scale: this should create 47x47 tiles of size 10x10. 796 // Tiling at 0.25 scale: this should create 47x47 tiles of size 10x10.
799 // The reason is that each tile has a one pixel border, so tile at (1, 2) 797 // The reason is that each tile has a one pixel border, so tile at (1, 2)
800 // for instance begins at (8, 16) pixels. So tile at (46, 46) will begin at 798 // for instance begins at (8, 16) pixels. So tile at (46, 46) will begin at
801 // (368, 368) and extend to the end of 1500 * 0.25 = 375 edge of the 799 // (368, 368) and extend to the end of 1500 * 0.25 = 375 edge of the
802 // tiling. 800 // tiling.
803 scoped_refptr<FakePicturePileImpl> pile = 801 scoped_refptr<FakePicturePileImpl> pile =
804 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); 802 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
805 scoped_ptr<TestablePictureLayerTiling> tiling = 803 scoped_ptr<TestablePictureLayerTiling> tiling =
806 TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.25f, pile, &client, 804 TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.25f, pile, &client,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 priority = prioritized_tiles[tiling->TileAt(5, 1)].priority(); 979 priority = prioritized_tiles[tiling->TileAt(5, 1)].priority();
982 EXPECT_FLOAT_EQ(55.f, priority.distance_to_visible); 980 EXPECT_FLOAT_EQ(55.f, priority.distance_to_visible);
983 981
984 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority(); 982 priority = prioritized_tiles[tiling->TileAt(2, 5)].priority();
985 EXPECT_FLOAT_EQ(35.f, priority.distance_to_visible); 983 EXPECT_FLOAT_EQ(35.f, priority.distance_to_visible);
986 984
987 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority(); 985 priority = prioritized_tiles[tiling->TileAt(3, 4)].priority();
988 EXPECT_FLOAT_EQ(30.f, priority.distance_to_visible); 986 EXPECT_FLOAT_EQ(30.f, priority.distance_to_visible);
989 } 987 }
990 988
991 TEST(PictureLayerTilingTest, ExpandRectEqual) {
992 gfx::Rect in(40, 50, 100, 200);
993 gfx::Rect bounds(-1000, -1000, 10000, 10000);
994 int64 target_area = 100 * 200;
995 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
996 in, target_area, bounds, NULL);
997 EXPECT_EQ(in.ToString(), out.ToString());
998 }
999
1000 TEST(PictureLayerTilingTest, ExpandRectSmaller) {
1001 gfx::Rect in(40, 50, 100, 200);
1002 gfx::Rect bounds(-1000, -1000, 10000, 10000);
1003 int64 target_area = 100 * 100;
1004 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1005 in, target_area, bounds, NULL);
1006 EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y());
1007 EXPECT_EQ(out.right() - in.right(), in.x() - out.x());
1008 EXPECT_EQ(out.width() - in.width(), out.height() - in.height());
1009
1010 // |in| represents the visible rect, and |out| represents the eventually rect.
1011 // If the eventually rect doesn't contain the visible rect, we will start
1012 // losing tiles.
1013 EXPECT_TRUE(out.Contains(in));
1014 EXPECT_TRUE(bounds.Contains(out));
1015 }
1016
1017 TEST(PictureLayerTilingTest, ExpandRectUnbounded) {
1018 gfx::Rect in(40, 50, 100, 200);
1019 gfx::Rect bounds(-1000, -1000, 10000, 10000);
1020 int64 target_area = 200 * 200;
1021 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1022 in, target_area, bounds, NULL);
1023 EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y());
1024 EXPECT_EQ(out.right() - in.right(), in.x() - out.x());
1025 EXPECT_EQ(out.width() - in.width(), out.height() - in.height());
1026 EXPECT_NEAR(200 * 200, out.width() * out.height(), 100);
1027 EXPECT_TRUE(bounds.Contains(out));
1028 }
1029
1030 TEST(PictureLayerTilingTest, ExpandRectBoundedSmaller) {
1031 gfx::Rect in(40, 50, 100, 200);
1032 gfx::Rect bounds(50, 60, 40, 30);
1033 int64 target_area = 200 * 200;
1034 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1035 in, target_area, bounds, NULL);
1036 EXPECT_EQ(bounds.ToString(), out.ToString());
1037 }
1038
1039 TEST(PictureLayerTilingTest, ExpandRectBoundedEqual) {
1040 gfx::Rect in(40, 50, 100, 200);
1041 gfx::Rect bounds = in;
1042 int64 target_area = 200 * 200;
1043 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1044 in, target_area, bounds, NULL);
1045 EXPECT_EQ(bounds.ToString(), out.ToString());
1046 }
1047
1048 TEST(PictureLayerTilingTest, ExpandRectBoundedSmallerStretchVertical) {
1049 gfx::Rect in(40, 50, 100, 200);
1050 gfx::Rect bounds(45, 0, 90, 300);
1051 int64 target_area = 200 * 200;
1052 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1053 in, target_area, bounds, NULL);
1054 EXPECT_EQ(bounds.ToString(), out.ToString());
1055 }
1056
1057 TEST(PictureLayerTilingTest, ExpandRectBoundedEqualStretchVertical) {
1058 gfx::Rect in(40, 50, 100, 200);
1059 gfx::Rect bounds(40, 0, 100, 300);
1060 int64 target_area = 200 * 200;
1061 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1062 in, target_area, bounds, NULL);
1063 EXPECT_EQ(bounds.ToString(), out.ToString());
1064 }
1065
1066 TEST(PictureLayerTilingTest, ExpandRectBoundedSmallerStretchHorizontal) {
1067 gfx::Rect in(40, 50, 100, 200);
1068 gfx::Rect bounds(0, 55, 180, 190);
1069 int64 target_area = 200 * 200;
1070 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1071 in, target_area, bounds, NULL);
1072 EXPECT_EQ(bounds.ToString(), out.ToString());
1073 }
1074
1075 TEST(PictureLayerTilingTest, ExpandRectBoundedEqualStretchHorizontal) {
1076 gfx::Rect in(40, 50, 100, 200);
1077 gfx::Rect bounds(0, 50, 180, 200);
1078 int64 target_area = 200 * 200;
1079 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1080 in, target_area, bounds, NULL);
1081 EXPECT_EQ(bounds.ToString(), out.ToString());
1082 }
1083
1084 TEST(PictureLayerTilingTest, ExpandRectBoundedLeft) {
1085 gfx::Rect in(40, 50, 100, 200);
1086 gfx::Rect bounds(20, -1000, 10000, 10000);
1087 int64 target_area = 200 * 200;
1088 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1089 in, target_area, bounds, NULL);
1090 EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y());
1091 EXPECT_EQ(out.bottom() - in.bottom(), out.right() - in.right());
1092 EXPECT_LE(out.width() * out.height(), target_area);
1093 EXPECT_GT(out.width() * out.height(),
1094 target_area - out.width() - out.height() * 2);
1095 EXPECT_TRUE(bounds.Contains(out));
1096 }
1097
1098 TEST(PictureLayerTilingTest, ExpandRectBoundedRight) {
1099 gfx::Rect in(40, 50, 100, 200);
1100 gfx::Rect bounds(-1000, -1000, 1000+120, 10000);
1101 int64 target_area = 200 * 200;
1102 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1103 in, target_area, bounds, NULL);
1104 EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y());
1105 EXPECT_EQ(out.bottom() - in.bottom(), in.x() - out.x());
1106 EXPECT_LE(out.width() * out.height(), target_area);
1107 EXPECT_GT(out.width() * out.height(),
1108 target_area - out.width() - out.height() * 2);
1109 EXPECT_TRUE(bounds.Contains(out));
1110 }
1111
1112 TEST(PictureLayerTilingTest, ExpandRectBoundedTop) {
1113 gfx::Rect in(40, 50, 100, 200);
1114 gfx::Rect bounds(-1000, 30, 10000, 10000);
1115 int64 target_area = 200 * 200;
1116 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1117 in, target_area, bounds, NULL);
1118 EXPECT_EQ(out.right() - in.right(), in.x() - out.x());
1119 EXPECT_EQ(out.right() - in.right(), out.bottom() - in.bottom());
1120 EXPECT_LE(out.width() * out.height(), target_area);
1121 EXPECT_GT(out.width() * out.height(),
1122 target_area - out.width() * 2 - out.height());
1123 EXPECT_TRUE(bounds.Contains(out));
1124 }
1125
1126 TEST(PictureLayerTilingTest, ExpandRectBoundedBottom) {
1127 gfx::Rect in(40, 50, 100, 200);
1128 gfx::Rect bounds(-1000, -1000, 10000, 1000 + 220);
1129 int64 target_area = 200 * 200;
1130 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1131 in, target_area, bounds, NULL);
1132 EXPECT_EQ(out.right() - in.right(), in.x() - out.x());
1133 EXPECT_EQ(out.right() - in.right(), in.y() - out.y());
1134 EXPECT_LE(out.width() * out.height(), target_area);
1135 EXPECT_GT(out.width() * out.height(),
1136 target_area - out.width() * 2 - out.height());
1137 EXPECT_TRUE(bounds.Contains(out));
1138 }
1139
1140 TEST(PictureLayerTilingTest, ExpandRectSquishedHorizontally) {
1141 gfx::Rect in(40, 50, 100, 200);
1142 gfx::Rect bounds(0, -4000, 100+40+20, 100000);
1143 int64 target_area = 400 * 400;
1144 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1145 in, target_area, bounds, NULL);
1146 EXPECT_EQ(20, out.right() - in.right());
1147 EXPECT_EQ(40, in.x() - out.x());
1148 EXPECT_EQ(out.bottom() - in.bottom(), in.y() - out.y());
1149 EXPECT_LE(out.width() * out.height(), target_area);
1150 EXPECT_GT(out.width() * out.height(),
1151 target_area - out.width() * 2);
1152 EXPECT_TRUE(bounds.Contains(out));
1153 }
1154
1155 TEST(PictureLayerTilingTest, ExpandRectSquishedVertically) {
1156 gfx::Rect in(40, 50, 100, 200);
1157 gfx::Rect bounds(-4000, 0, 100000, 200+50+30);
1158 int64 target_area = 400 * 400;
1159 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1160 in, target_area, bounds, NULL);
1161 EXPECT_EQ(30, out.bottom() - in.bottom());
1162 EXPECT_EQ(50, in.y() - out.y());
1163 EXPECT_EQ(out.right() - in.right(), in.x() - out.x());
1164 EXPECT_LE(out.width() * out.height(), target_area);
1165 EXPECT_GT(out.width() * out.height(),
1166 target_area - out.height() * 2);
1167 EXPECT_TRUE(bounds.Contains(out));
1168 }
1169
1170 TEST(PictureLayerTilingTest, ExpandRectOutOfBoundsFarAway) {
1171 gfx::Rect in(400, 500, 100, 200);
1172 gfx::Rect bounds(0, 0, 10, 10);
1173 int64 target_area = 400 * 400;
1174 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1175 in, target_area, bounds, NULL);
1176 EXPECT_TRUE(out.IsEmpty());
1177 }
1178
1179 TEST(PictureLayerTilingTest, ExpandRectOutOfBoundsExpandedFullyCover) {
1180 gfx::Rect in(40, 50, 100, 100);
1181 gfx::Rect bounds(0, 0, 10, 10);
1182 int64 target_area = 400 * 400;
1183 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1184 in, target_area, bounds, NULL);
1185 EXPECT_EQ(bounds.ToString(), out.ToString());
1186 }
1187
1188 TEST(PictureLayerTilingTest, ExpandRectOutOfBoundsExpandedPartlyCover) {
1189 gfx::Rect in(600, 600, 100, 100);
1190 gfx::Rect bounds(0, 0, 500, 500);
1191 int64 target_area = 400 * 400;
1192 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1193 in, target_area, bounds, NULL);
1194 EXPECT_EQ(bounds.right(), out.right());
1195 EXPECT_EQ(bounds.bottom(), out.bottom());
1196 EXPECT_LE(out.width() * out.height(), target_area);
1197 EXPECT_GT(out.width() * out.height(),
1198 target_area - out.width() - out.height());
1199 EXPECT_TRUE(bounds.Contains(out));
1200 }
1201
1202 TEST(PictureLayerTilingTest, EmptyStartingRect) {
1203 // If a layer has a non-invertible transform, then the starting rect
1204 // for the layer would be empty.
1205 gfx::Rect in(40, 40, 0, 0);
1206 gfx::Rect bounds(0, 0, 10, 10);
1207 int64 target_area = 400 * 400;
1208 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
1209 in, target_area, bounds, NULL);
1210 EXPECT_TRUE(out.IsEmpty());
1211 }
1212
1213 static void TileExists(bool exists, Tile* tile, 989 static void TileExists(bool exists, Tile* tile,
1214 const gfx::Rect& geometry_rect) { 990 const gfx::Rect& geometry_rect) {
1215 EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString(); 991 EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString();
1216 } 992 }
1217 993
1218 TEST_F(PictureLayerTilingIteratorTest, TilesExist) { 994 TEST_F(PictureLayerTilingIteratorTest, TilesExist) {
1219 gfx::Size layer_bounds(1099, 801); 995 gfx::Size layer_bounds(1099, 801);
1220 Initialize(gfx::Size(100, 100), 1.f, layer_bounds); 996 Initialize(gfx::Size(100, 100), 1.f, layer_bounds);
1221 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); 997 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds));
1222 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); 998 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 EXPECT_EQ(expected_exists, tile != NULL) 1062 EXPECT_EQ(expected_exists, tile != NULL)
1287 << "Rects intersecting " << rect.ToString() << " should exist. " 1063 << "Rects intersecting " << rect.ToString() << " should exist. "
1288 << "Current tile rect is " << geometry_rect.ToString(); 1064 << "Current tile rect is " << geometry_rect.ToString();
1289 } 1065 }
1290 1066
1291 TEST_F(PictureLayerTilingIteratorTest, 1067 TEST_F(PictureLayerTilingIteratorTest,
1292 TilesExistLargeViewportAndLayerWithSmallVisibleArea) { 1068 TilesExistLargeViewportAndLayerWithSmallVisibleArea) {
1293 gfx::Size layer_bounds(10000, 10000); 1069 gfx::Size layer_bounds(10000, 10000);
1294 client_.SetTileSize(gfx::Size(100, 100)); 1070 client_.SetTileSize(gfx::Size(100, 100));
1295 LayerTreeSettings settings; 1071 LayerTreeSettings settings;
1296 settings.max_tiles_for_interest_area = 1; 1072 settings.tiling_interest_area_padding = 1;
1297 1073
1298 scoped_refptr<FakePicturePileImpl> pile = 1074 scoped_refptr<FakePicturePileImpl> pile =
1299 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); 1075 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
1300 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, 1.f, pile, 1076 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, 1.f, pile,
1301 &client_, settings); 1077 &client_, settings);
1302 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds)); 1078 VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds));
1303 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); 1079 VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false));
1304 1080
1305 gfx::Rect visible_rect(8000, 8000, 50, 50); 1081 gfx::Rect visible_rect(8000, 8000, 50, 50);
1306 1082
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 1519
1744 // Offscreen layer is coming closer to viewport at 1000 pixels per second. 1520 // Offscreen layer is coming closer to viewport at 1000 pixels per second.
1745 current_screen_transform.Translate(1800, 0); 1521 current_screen_transform.Translate(1800, 0);
1746 last_screen_transform.Translate(2800, 0); 1522 last_screen_transform.Translate(2800, 0);
1747 1523
1748 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace( 1524 gfx::Rect viewport_in_layer_space = ViewportInLayerSpace(
1749 current_screen_transform, device_viewport); 1525 current_screen_transform, device_viewport);
1750 1526
1751 client.SetTileSize(gfx::Size(100, 100)); 1527 client.SetTileSize(gfx::Size(100, 100));
1752 LayerTreeSettings settings; 1528 LayerTreeSettings settings;
1753 settings.max_tiles_for_interest_area = 10000;
1754 1529
1755 scoped_refptr<FakePicturePileImpl> pile = 1530 scoped_refptr<FakePicturePileImpl> pile =
1756 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( 1531 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(
1757 current_layer_bounds); 1532 current_layer_bounds);
1758 scoped_ptr<TestablePictureLayerTiling> tiling = 1533 scoped_ptr<TestablePictureLayerTiling> tiling =
1759 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, pile, &client, 1534 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, pile, &client,
1760 settings); 1535 settings);
1761 1536
1762 // previous ("last") frame 1537 // previous ("last") frame
1763 tiling->ComputeTilePriorityRects(viewport_in_layer_space, 1538 tiling->ComputeTilePriorityRects(viewport_in_layer_space,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 // - Viewport moves somewhere far away and active tiling clears tiles. 1648 // - Viewport moves somewhere far away and active tiling clears tiles.
1874 // - Viewport moves back and a new active tiling tile is created. 1649 // - Viewport moves back and a new active tiling tile is created.
1875 // Result: 1650 // Result:
1876 // - Recycle tiling does _not_ have the tile in the same location (thus it 1651 // - Recycle tiling does _not_ have the tile in the same location (thus it
1877 // will be shared next time a pending tiling is created). 1652 // will be shared next time a pending tiling is created).
1878 1653
1879 FakePictureLayerTilingClient active_client; 1654 FakePictureLayerTilingClient active_client;
1880 1655
1881 active_client.SetTileSize(gfx::Size(100, 100)); 1656 active_client.SetTileSize(gfx::Size(100, 100));
1882 LayerTreeSettings settings; 1657 LayerTreeSettings settings;
1883 settings.max_tiles_for_interest_area = 10;
1884 1658
1885 scoped_refptr<FakePicturePileImpl> pile = 1659 scoped_refptr<FakePicturePileImpl> pile =
1886 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( 1660 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(
1887 gfx::Size(10000, 10000)); 1661 gfx::Size(10000, 10000));
1888 scoped_ptr<TestablePictureLayerTiling> active_tiling = 1662 scoped_ptr<TestablePictureLayerTiling> active_tiling =
1889 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, pile, 1663 TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, pile,
1890 &active_client, settings); 1664 &active_client, settings);
1891 // Create all tiles on this tiling. 1665 // Create all tiles on this tiling.
1892 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, 1666 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f,
1893 Occlusion()); 1667 Occlusion());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 &active_client, LayerTreeSettings()); 1715 &active_client, LayerTreeSettings());
1942 // Create all tiles on this tiling. 1716 // Create all tiles on this tiling.
1943 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, 1717 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f,
1944 Occlusion()); 1718 Occlusion());
1945 1719
1946 FakePictureLayerTilingClient recycle_client; 1720 FakePictureLayerTilingClient recycle_client;
1947 recycle_client.SetTileSize(gfx::Size(100, 100)); 1721 recycle_client.SetTileSize(gfx::Size(100, 100));
1948 recycle_client.set_twin_tiling(active_tiling.get()); 1722 recycle_client.set_twin_tiling(active_tiling.get());
1949 1723
1950 LayerTreeSettings settings; 1724 LayerTreeSettings settings;
1951 settings.max_tiles_for_interest_area = 10;
1952 1725
1953 pile = FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( 1726 pile = FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(
1954 gfx::Size(100, 100)); 1727 gfx::Size(100, 100));
1955 scoped_ptr<TestablePictureLayerTiling> recycle_tiling = 1728 scoped_ptr<TestablePictureLayerTiling> recycle_tiling =
1956 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, pile, 1729 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, pile,
1957 &recycle_client, settings); 1730 &recycle_client, settings);
1958 1731
1959 // Create all tiles on the recycle tiling. All tiles should be shared. 1732 // Create all tiles on the recycle tiling. All tiles should be shared.
1960 recycle_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 1733 recycle_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f,
1961 1.0f, Occlusion()); 1734 1.0f, Occlusion());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 tiling_->SetRasterSourceAndResize(pile); 1767 tiling_->SetRasterSourceAndResize(pile);
1995 1768
1996 // Tile size in the tiling should be resized to 250x200. 1769 // Tile size in the tiling should be resized to 250x200.
1997 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); 1770 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width());
1998 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); 1771 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height());
1999 EXPECT_EQ(0u, tiling_->AllTilesForTesting().size()); 1772 EXPECT_EQ(0u, tiling_->AllTilesForTesting().size());
2000 } 1773 }
2001 1774
2002 } // namespace 1775 } // namespace
2003 } // namespace cc 1776 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/picture_layer_tiling_set_unittest.cc ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698