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

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

Issue 1131633003: cc: Use multiple PrepareTiles approaches Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 // No invalidation. 2092 // No invalidation.
2093 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); 2093 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region());
2094 2094
2095 // Verify active tree not ready. 2095 // Verify active tree not ready.
2096 Tile* some_active_tile = 2096 Tile* some_active_tile =
2097 active_layer_->HighResTiling()->AllTilesForTesting()[0]; 2097 active_layer_->HighResTiling()->AllTilesForTesting()[0];
2098 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); 2098 EXPECT_FALSE(some_active_tile->IsReadyToDraw());
2099 2099
2100 // When high res are required, all tiles in active high res tiling should be 2100 // When high res are required, all tiles in active high res tiling should be
2101 // required for activation. 2101 // required for activation.
2102 host_impl_.SetRequiresHighResToDraw(); 2102 host_impl_.SetRequiresHighResToDraw(true);
2103 2103
2104 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 2104 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
2105 pending_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); 2105 pending_layer_->LowResTiling()->UpdateAllRequiredStateForTesting();
2106 active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 2106 active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
2107 active_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); 2107 active_layer_->LowResTiling()->UpdateAllRequiredStateForTesting();
2108 2108
2109 EXPECT_TRUE(pending_layer_->HighResTiling()->AllTilesForTesting().empty()); 2109 EXPECT_TRUE(pending_layer_->HighResTiling()->AllTilesForTesting().empty());
2110 EXPECT_TRUE(pending_layer_->LowResTiling()->AllTilesForTesting().empty()); 2110 EXPECT_TRUE(pending_layer_->LowResTiling()->AllTilesForTesting().empty());
2111 AssertAllTilesRequired(active_layer_->HighResTiling()); 2111 AssertAllTilesRequired(active_layer_->HighResTiling());
2112 AssertNoTilesRequired(active_layer_->LowResTiling()); 2112 AssertNoTilesRequired(active_layer_->LowResTiling());
(...skipping 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after
4765 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4765 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4766 scoped_refptr<FakePicturePileImpl> active_pile = 4766 scoped_refptr<FakePicturePileImpl> active_pile =
4767 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4767 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4768 4768
4769 SetupTrees(pending_pile, active_pile); 4769 SetupTrees(pending_pile, active_pile);
4770 4770
4771 Region invalidation; 4771 Region invalidation;
4772 gfx::Rect viewport = gfx::Rect(0, 0, 100, 100); 4772 gfx::Rect viewport = gfx::Rect(0, 0, 100, 100);
4773 gfx::Transform transform; 4773 gfx::Transform transform;
4774 4774
4775 host_impl_.SetRequiresHighResToDraw(); 4775 host_impl_.SetRequiresHighResToDraw(true);
4776 4776
4777 // Update tiles. 4777 // Update tiles.
4778 pending_layer_->draw_properties().visible_content_rect = viewport; 4778 pending_layer_->draw_properties().visible_content_rect = viewport;
4779 pending_layer_->draw_properties().screen_space_transform = transform; 4779 pending_layer_->draw_properties().screen_space_transform = transform;
4780 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, 4780 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
4781 false); 4781 false);
4782 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 4782 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
4783 4783
4784 // Ensure we can't activate. 4784 // Ensure we can't activate.
4785 EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate()); 4785 EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
5088 result = layer->CalculateTileSize(gfx::Size(447, 400)); 5088 result = layer->CalculateTileSize(gfx::Size(447, 400));
5089 EXPECT_EQ(result.width(), 448); 5089 EXPECT_EQ(result.width(), 448);
5090 EXPECT_EQ(result.height(), 448); 5090 EXPECT_EQ(result.height(), 448);
5091 result = layer->CalculateTileSize(gfx::Size(500, 499)); 5091 result = layer->CalculateTileSize(gfx::Size(500, 499));
5092 EXPECT_EQ(result.width(), 512); 5092 EXPECT_EQ(result.width(), 512);
5093 EXPECT_EQ(result.height(), 500 + 2); 5093 EXPECT_EQ(result.height(), 500 + 2);
5094 } 5094 }
5095 5095
5096 } // namespace 5096 } // namespace
5097 } // namespace cc 5097 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698