OLD | NEW |
---|---|
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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1159 active_layer_->SetIsMask(true); | 1159 active_layer_->SetIsMask(true); |
1160 SetContentsScaleOnBothLayers(contents_scale, | 1160 SetContentsScaleOnBothLayers(contents_scale, |
1161 device_scale, | 1161 device_scale, |
1162 page_scale, | 1162 page_scale, |
1163 maximum_animation_scale, | 1163 maximum_animation_scale, |
1164 animating_transform); | 1164 animating_transform); |
1165 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); | 1165 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); |
1166 EXPECT_BOTH_EQ(num_tilings(), 1u); | 1166 EXPECT_BOTH_EQ(num_tilings(), 1u); |
1167 } | 1167 } |
1168 | 1168 |
1169 TEST_F(PictureLayerImplTest, HugeMasksDontGetTiles) { | |
1170 gfx::Size tile_size(host_impl_.settings().default_tile_size); | |
1171 SetupDefaultTrees(tile_size); | |
1172 | |
1173 float contents_scale = 1.f; | |
1174 float device_scale = 1.f; | |
1175 float page_scale = 1.f; | |
1176 float maximum_animation_scale = 1.f; | |
1177 bool animating_transform = false; | |
1178 | |
1179 pending_layer_->SetIsMask(true); | |
1180 active_layer_->SetIsMask(true); | |
1181 SetContentsScaleOnBothLayers(contents_scale, | |
1182 device_scale, | |
1183 page_scale, | |
1184 maximum_animation_scale, | |
1185 animating_transform); | |
1186 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); | |
1187 EXPECT_BOTH_EQ(num_tilings(), 1u); | |
1188 | |
1189 pending_layer_->HighResTiling()->CreateAllTilesForTesting(); | |
1190 active_layer_->HighResTiling()->CreateAllTilesForTesting(); | |
1191 | |
1192 // Mask layers have a tiling with a single tile in it. | |
1193 EXPECT_BOTH_EQ(HighResTiling()->AllTilesForTesting().size(), 1u); | |
1194 | |
1195 ResetTilingsAndRasterScales(); | |
1196 | |
1197 int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size; | |
1198 EXPECT_LE(pending_layer_->bounds().width(), max_texture_size); | |
1199 EXPECT_LE(pending_layer_->bounds().height(), max_texture_size); | |
1200 EXPECT_LE(active_layer_->bounds().width(), max_texture_size); | |
1201 EXPECT_LE(active_layer_->bounds().height(), max_texture_size); | |
1202 | |
1203 pending_layer_->SetBounds(gfx::Size(max_texture_size + 1, 10)); | |
1204 active_layer_->SetBounds(gfx::Size(10, max_texture_size + 1)); | |
1205 | |
1206 SetContentsScaleOnBothLayers(contents_scale, | |
1207 device_scale, | |
1208 page_scale, | |
1209 maximum_animation_scale, | |
1210 animating_transform); | |
1211 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); | |
1212 EXPECT_BOTH_EQ(num_tilings(), 1u); | |
1213 | |
1214 pending_layer_->HighResTiling()->CreateAllTilesForTesting(); | |
1215 active_layer_->HighResTiling()->CreateAllTilesForTesting(); | |
1216 | |
1217 // Mask layers have a tiling, but there should be no tiles in it. | |
1218 EXPECT_BOTH_EQ(HighResTiling()->AllTilesForTesting().size(), 1u); | |
enne (OOO)
2014/09/05 17:41:46
"there should be no tiles" but 1u?
Also, can you
danakj
2014/09/05 22:09:52
Oh snap, thanks. My test is bad and I feel bad.
| |
1219 } | |
1220 | |
1169 TEST_F(PictureLayerImplTest, ReleaseResources) { | 1221 TEST_F(PictureLayerImplTest, ReleaseResources) { |
1170 gfx::Size tile_size(400, 400); | 1222 gfx::Size tile_size(400, 400); |
1171 gfx::Size layer_bounds(1300, 1900); | 1223 gfx::Size layer_bounds(1300, 1900); |
1172 | 1224 |
1173 scoped_refptr<FakePicturePileImpl> pending_pile = | 1225 scoped_refptr<FakePicturePileImpl> pending_pile = |
1174 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1226 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1175 scoped_refptr<FakePicturePileImpl> active_pile = | 1227 scoped_refptr<FakePicturePileImpl> active_pile = |
1176 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1228 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1177 | 1229 |
1178 SetupTrees(pending_pile, active_pile); | 1230 SetupTrees(pending_pile, active_pile); |
(...skipping 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4121 ActivateTree(); | 4173 ActivateTree(); |
4122 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); | 4174 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); |
4123 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); | 4175 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); |
4124 | 4176 |
4125 host_impl_.ResetRecycleTreeForTesting(); | 4177 host_impl_.ResetRecycleTreeForTesting(); |
4126 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); | 4178 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); |
4127 } | 4179 } |
4128 | 4180 |
4129 } // namespace | 4181 } // namespace |
4130 } // namespace cc | 4182 } // namespace cc |
OLD | NEW |