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 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2491 | 2491 |
| 2492 SetContentsScaleOnBothLayers(contents_scale, | 2492 SetContentsScaleOnBothLayers(contents_scale, |
| 2493 device_scale, | 2493 device_scale, |
| 2494 page_scale, | 2494 page_scale, |
| 2495 maximum_animation_scale, | 2495 maximum_animation_scale, |
| 2496 animating_transform); | 2496 animating_transform); |
| 2497 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); | 2497 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
| 2498 } | 2498 } |
| 2499 | 2499 |
| 2500 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { | 2500 TEST_F(PictureLayerImplTest, LayerRasterTileIterator) { |
| 2501 base::TimeTicks time_ticks; | |
| 2502 time_ticks += base::TimeDelta::FromMilliseconds(1); | |
| 2503 host_impl_.SetCurrentBeginFrameArgs( | |
| 2504 CreateBeginFrameArgsForTesting(time_ticks)); | |
| 2505 | |
| 2501 gfx::Size tile_size(100, 100); | 2506 gfx::Size tile_size(100, 100); |
| 2502 gfx::Size layer_bounds(1000, 1000); | 2507 gfx::Size layer_bounds(1000, 1000); |
| 2503 | 2508 |
| 2504 scoped_refptr<FakePicturePileImpl> pending_pile = | 2509 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 2505 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 2510 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 2506 | 2511 |
| 2507 SetupPendingTree(pending_pile); | 2512 SetupPendingTree(pending_pile); |
| 2508 | 2513 |
| 2509 ASSERT_TRUE(pending_layer_->CanHaveTilings()); | 2514 ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
| 2510 | 2515 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2556 unique_tiles.insert(tile); | 2561 unique_tiles.insert(tile); |
| 2557 } | 2562 } |
| 2558 | 2563 |
| 2559 EXPECT_TRUE(reached_prepaint); | 2564 EXPECT_TRUE(reached_prepaint); |
| 2560 EXPECT_EQ(0u, non_ideal_tile_count); | 2565 EXPECT_EQ(0u, non_ideal_tile_count); |
| 2561 EXPECT_EQ(1u, low_res_tile_count); | 2566 EXPECT_EQ(1u, low_res_tile_count); |
| 2562 EXPECT_EQ(16u, high_res_tile_count); | 2567 EXPECT_EQ(16u, high_res_tile_count); |
| 2563 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count, | 2568 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count, |
| 2564 unique_tiles.size()); | 2569 unique_tiles.size()); |
| 2565 | 2570 |
| 2571 time_ticks += base::TimeDelta::FromMilliseconds(200); | |
| 2572 host_impl_.SetCurrentBeginFrameArgs( | |
| 2573 CreateBeginFrameArgsForTesting(time_ticks)); | |
| 2574 | |
| 2575 gfx::Rect viewport = gfx::Rect(1100, 1100, 500, 500); | |
| 2576 gfx::Transform transform; | |
| 2577 bool resourceless_software_draw = false; | |
| 2578 host_impl_.SetExternalDrawConstraints(transform, | |
|
vmpstr
2014/09/09 17:37:35
nit: Does host_impl_.SetViewportSize work here ins
USE eero AT chromium.org
2014/09/10 07:48:19
I don't see how as it is not about size but positi
| |
| 2579 viewport, | |
| 2580 viewport, | |
| 2581 viewport, | |
| 2582 transform, | |
| 2583 resourceless_software_draw); | |
| 2584 pending_layer_->draw_properties().visible_content_rect = viewport; | |
| 2585 pending_layer_->draw_properties().screen_space_transform = transform; | |
|
vmpstr
2014/09/09 17:37:35
I don't think you need this?
USE eero AT chromium.org
2014/09/10 07:48:19
I'll check.
| |
| 2586 pending_layer_->UpdateTiles(NULL); | |
| 2587 | |
| 2588 unique_tiles.clear(); | |
| 2589 reached_prepaint = false; | |
| 2590 non_ideal_tile_count = 0u; | |
| 2591 low_res_tile_count = 0u; | |
| 2592 high_res_tile_count = 0u; | |
| 2593 for (it = PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); | |
| 2594 it; | |
| 2595 ++it) { | |
| 2596 Tile* tile = *it; | |
| 2597 TilePriority priority = tile->priority(PENDING_TREE); | |
| 2598 | |
| 2599 EXPECT_TRUE(tile); | |
| 2600 | |
| 2601 // Non-high res tiles only get visible tiles. Also, prepaint should only | |
| 2602 // come at the end of the iteration. | |
| 2603 if (priority.resolution != HIGH_RESOLUTION) | |
| 2604 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | |
| 2605 else if (reached_prepaint) | |
| 2606 EXPECT_NE(TilePriority::NOW, priority.priority_bin); | |
| 2607 else | |
| 2608 reached_prepaint = priority.priority_bin != TilePriority::NOW; | |
| 2609 | |
| 2610 non_ideal_tile_count += priority.resolution == NON_IDEAL_RESOLUTION; | |
| 2611 low_res_tile_count += priority.resolution == LOW_RESOLUTION; | |
| 2612 high_res_tile_count += priority.resolution == HIGH_RESOLUTION; | |
| 2613 | |
| 2614 unique_tiles.insert(tile); | |
| 2615 } | |
| 2616 | |
| 2617 EXPECT_TRUE(reached_prepaint); | |
| 2618 EXPECT_EQ(0u, non_ideal_tile_count); | |
| 2619 EXPECT_EQ(0u, low_res_tile_count); | |
| 2620 EXPECT_EQ(16u, high_res_tile_count); | |
|
USE eero AT chromium.org
2014/09/09 17:13:45
Without the fix, the iterator returns only 15 high
vmpstr
2014/09/09 17:37:35
These are non-now ones, right?
USE eero AT chromium.org
2014/09/10 07:48:19
Yes, correct.
| |
| 2621 EXPECT_EQ(low_res_tile_count + high_res_tile_count + non_ideal_tile_count, | |
| 2622 unique_tiles.size()); | |
| 2623 | |
| 2624 time_ticks += base::TimeDelta::FromMilliseconds(200); | |
| 2625 host_impl_.SetCurrentBeginFrameArgs( | |
| 2626 CreateBeginFrameArgsForTesting(time_ticks)); | |
| 2627 | |
| 2628 viewport = gfx::Rect(0, 0, 500, 500); | |
| 2629 host_impl_.SetExternalDrawConstraints(transform, | |
|
vmpstr
2014/09/09 17:37:35
Same comments here as above
USE eero AT chromium.org
2014/09/10 07:48:19
And the same reply.
| |
| 2630 viewport, | |
| 2631 viewport, | |
| 2632 viewport, | |
| 2633 transform, | |
| 2634 resourceless_software_draw); | |
| 2635 pending_layer_->draw_properties().visible_content_rect = viewport; | |
| 2636 pending_layer_->draw_properties().screen_space_transform = transform; | |
| 2637 pending_layer_->UpdateTiles(NULL); | |
| 2638 | |
| 2566 std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting(); | 2639 std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting(); |
| 2567 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); | 2640 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); |
| 2568 tile_it != high_res_tiles.end(); | 2641 tile_it != high_res_tiles.end(); |
| 2569 ++tile_it) { | 2642 ++tile_it) { |
| 2570 Tile* tile = *tile_it; | 2643 Tile* tile = *tile_it; |
| 2571 ManagedTileState::TileVersion& tile_version = | 2644 ManagedTileState::TileVersion& tile_version = |
| 2572 tile->GetTileVersionForTesting( | 2645 tile->GetTileVersionForTesting( |
| 2573 tile->DetermineRasterModeForTree(ACTIVE_TREE)); | 2646 tile->DetermineRasterModeForTree(ACTIVE_TREE)); |
| 2574 tile_version.SetSolidColorForTesting(SK_ColorRED); | 2647 tile_version.SetSolidColorForTesting(SK_ColorRED); |
| 2575 } | 2648 } |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4173 ActivateTree(); | 4246 ActivateTree(); |
| 4174 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); | 4247 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); |
| 4175 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); | 4248 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); |
| 4176 | 4249 |
| 4177 host_impl_.ResetRecycleTreeForTesting(); | 4250 host_impl_.ResetRecycleTreeForTesting(); |
| 4178 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); | 4251 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); |
| 4179 } | 4252 } |
| 4180 | 4253 |
| 4181 } // namespace | 4254 } // namespace |
| 4182 } // namespace cc | 4255 } // namespace cc |
| OLD | NEW |