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

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: fix raster source detection 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->draw_info().IsReadyToDraw()); 2098 EXPECT_FALSE(some_active_tile->draw_info().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 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after
4761 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4761 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4762 scoped_refptr<FakePicturePileImpl> active_pile = 4762 scoped_refptr<FakePicturePileImpl> active_pile =
4763 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4763 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4764 4764
4765 SetupTrees(pending_pile, active_pile); 4765 SetupTrees(pending_pile, active_pile);
4766 4766
4767 Region invalidation; 4767 Region invalidation;
4768 gfx::Rect viewport = gfx::Rect(0, 0, 100, 100); 4768 gfx::Rect viewport = gfx::Rect(0, 0, 100, 100);
4769 gfx::Transform transform; 4769 gfx::Transform transform;
4770 4770
4771 host_impl_.SetRequiresHighResToDraw(); 4771 host_impl_.SetRequiresHighResToDraw(true);
4772 4772
4773 // Update tiles. 4773 // Update tiles.
4774 pending_layer_->draw_properties().visible_content_rect = viewport; 4774 pending_layer_->draw_properties().visible_content_rect = viewport;
4775 pending_layer_->draw_properties().screen_space_transform = transform; 4775 pending_layer_->draw_properties().screen_space_transform = transform;
4776 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, 4776 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
4777 false); 4777 false);
4778 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 4778 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
4779 4779
4780 // Ensure we can't activate. 4780 // Ensure we can't activate.
4781 EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate()); 4781 EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
5082 result = layer->CalculateTileSize(gfx::Size(447, 400)); 5082 result = layer->CalculateTileSize(gfx::Size(447, 400));
5083 EXPECT_EQ(result.width(), 448); 5083 EXPECT_EQ(result.width(), 448);
5084 EXPECT_EQ(result.height(), 448); 5084 EXPECT_EQ(result.height(), 448);
5085 result = layer->CalculateTileSize(gfx::Size(500, 499)); 5085 result = layer->CalculateTileSize(gfx::Size(500, 499));
5086 EXPECT_EQ(result.width(), 512); 5086 EXPECT_EQ(result.width(), 512);
5087 EXPECT_EQ(result.height(), 500 + 2); 5087 EXPECT_EQ(result.height(), 500 + 2);
5088 } 5088 }
5089 5089
5090 } // namespace 5090 } // namespace
5091 } // namespace cc 5091 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698