Chromium Code Reviews| 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 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2354 contents_scale = 0.5f; | 2354 contents_scale = 0.5f; |
| 2355 | 2355 |
| 2356 SetContentsScaleOnBothLayers(contents_scale, | 2356 SetContentsScaleOnBothLayers(contents_scale, |
| 2357 device_scale, | 2357 device_scale, |
| 2358 page_scale, | 2358 page_scale, |
| 2359 maximum_animation_scale, | 2359 maximum_animation_scale, |
| 2360 animating_transform); | 2360 animating_transform); |
| 2361 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); | 2361 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
| 2362 } | 2362 } |
| 2363 | 2363 |
| 2364 TEST_F(PictureLayerImplTest, AllTilesRequiredForActivationAreReadyToDraw) { | |
|
vmpstr
2014/05/21 22:28:30
Can you add a similar test where you first mark al
reveman
2014/05/22 20:47:49
Done.
| |
| 2365 gfx::Size tile_size(100, 100); | |
| 2366 gfx::Size layer_bounds(1000, 1000); | |
| 2367 | |
| 2368 scoped_refptr<FakePicturePileImpl> pending_pile = | |
| 2369 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | |
| 2370 | |
| 2371 SetupPendingTree(pending_pile); | |
| 2372 pending_layer_->SetBounds(layer_bounds); | |
| 2373 | |
| 2374 ASSERT_TRUE(pending_layer_->CanHaveTilings()); | |
| 2375 | |
| 2376 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | |
| 2377 | |
| 2378 pending_layer_->AddTiling(low_res_factor); | |
| 2379 pending_layer_->AddTiling(0.3f); | |
| 2380 pending_layer_->AddTiling(0.7f); | |
| 2381 pending_layer_->AddTiling(1.0f); | |
| 2382 pending_layer_->AddTiling(2.0f); | |
| 2383 | |
| 2384 host_impl_.SetViewportSize(gfx::Size(500, 500)); | |
| 2385 host_impl_.pending_tree()->UpdateDrawProperties(); | |
| 2386 | |
| 2387 // Initialize all low-res tiles. | |
| 2388 for (PictureLayerImpl::LayerRasterTileIterator it( | |
| 2389 pending_layer_, SAME_PRIORITY_FOR_BOTH_TREES); | |
| 2390 it; | |
| 2391 ++it) { | |
| 2392 Tile* tile = *it; | |
| 2393 TilePriority priority = tile->priority(PENDING_TREE); | |
| 2394 | |
| 2395 if (priority.resolution != LOW_RESOLUTION) | |
| 2396 continue; | |
| 2397 | |
| 2398 ManagedTileState::TileVersion& tile_version = | |
| 2399 tile->GetTileVersionForTesting( | |
| 2400 tile->DetermineRasterModeForTree(PENDING_TREE)); | |
| 2401 tile_version.SetSolidColorForTesting(SK_ColorRED); | |
| 2402 } | |
| 2403 | |
| 2404 // Low-res tiles should not be enough. | |
| 2405 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | |
| 2406 | |
| 2407 // Initialize all tiles. | |
| 2408 for (PictureLayerImpl::LayerRasterTileIterator it( | |
| 2409 pending_layer_, SAME_PRIORITY_FOR_BOTH_TREES); | |
| 2410 it; | |
| 2411 ++it) { | |
| 2412 Tile* tile = *it; | |
| 2413 | |
| 2414 ManagedTileState::TileVersion& tile_version = | |
| 2415 tile->GetTileVersionForTesting( | |
| 2416 tile->DetermineRasterModeForTree(PENDING_TREE)); | |
| 2417 tile_version.SetSolidColorForTesting(SK_ColorRED); | |
| 2418 } | |
| 2419 | |
| 2420 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); | |
| 2421 } | |
| 2422 | |
| 2364 } // namespace | 2423 } // namespace |
| 2365 } // namespace cc | 2424 } // namespace cc |
| OLD | NEW |