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

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

Issue 1274693004: cc: Declare high res tilings to not have low res content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: waseverlowres: . Created 5 years, 4 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
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/tiles/picture_layer_tiling.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5025 matching lines...) Expand 10 before | Expand all | Expand 10 after
5036 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); 5036 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
5037 EXPECT_EQ(page_scale, 5037 EXPECT_EQ(page_scale,
5038 active_layer_->tilings()->tiling_at(0)->contents_scale()); 5038 active_layer_->tilings()->tiling_at(0)->contents_scale());
5039 EXPECT_EQ(low_res, active_layer_->tilings()->tiling_at(1)->contents_scale()); 5039 EXPECT_EQ(low_res, active_layer_->tilings()->tiling_at(1)->contents_scale());
5040 5040
5041 // Grab a current low res tile. 5041 // Grab a current low res tile.
5042 PictureLayerTiling* old_low_res_tiling = 5042 PictureLayerTiling* old_low_res_tiling =
5043 active_layer_->tilings()->tiling_at(1); 5043 active_layer_->tilings()->tiling_at(1);
5044 Tile* old_low_res_tile = active_layer_->tilings()->tiling_at(1)->TileAt(0, 0); 5044 Tile* old_low_res_tile = active_layer_->tilings()->tiling_at(1)->TileAt(0, 0);
5045 5045
5046 // The tiling knows it has low res content.
5047 EXPECT_TRUE(active_layer_->tilings()
5048 ->tiling_at(1)
5049 ->may_contain_low_resolution_tiles());
5050
5046 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 5051 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
5047 5052
5048 // Zoom in to exactly the low res factor so that the previous low res 5053 // Zoom in to exactly the low res factor so that the previous low res
5049 // would be equal to the current high res. 5054 // would be equal to the current high res.
5050 SetupDrawPropertiesAndUpdateTiles(active_layer_, low_res, 1.0f, low_res, 1.0f, 5055 SetupDrawPropertiesAndUpdateTiles(active_layer_, low_res, 1.0f, low_res, 1.0f,
5051 0.f, false); 5056 0.f, false);
5052 // 3 tilings. The old high res, the new high res (old low res) and the new low 5057 // 3 tilings. The old high res, the new high res (old low res) and the new low
5053 // res. 5058 // res.
5054 EXPECT_EQ(3u, active_layer_->num_tilings()); 5059 EXPECT_EQ(3u, active_layer_->num_tilings());
5060
5055 PictureLayerTilingSet* tilings = active_layer_->tilings(); 5061 PictureLayerTilingSet* tilings = active_layer_->tilings();
5056 EXPECT_EQ(page_scale, tilings->tiling_at(0)->contents_scale()); 5062 EXPECT_EQ(page_scale, tilings->tiling_at(0)->contents_scale());
5057 EXPECT_EQ(low_res, tilings->tiling_at(1)->contents_scale()); 5063 EXPECT_EQ(low_res, tilings->tiling_at(1)->contents_scale());
5058 EXPECT_EQ(extra_low_res, tilings->tiling_at(2)->contents_scale()); 5064 EXPECT_EQ(extra_low_res, tilings->tiling_at(2)->contents_scale());
5059 5065
5060 EXPECT_EQ(NON_IDEAL_RESOLUTION, tilings->tiling_at(0)->resolution()); 5066 EXPECT_EQ(NON_IDEAL_RESOLUTION, tilings->tiling_at(0)->resolution());
5061 EXPECT_EQ(HIGH_RESOLUTION, tilings->tiling_at(1)->resolution()); 5067 EXPECT_EQ(HIGH_RESOLUTION, tilings->tiling_at(1)->resolution());
5062 EXPECT_EQ(LOW_RESOLUTION, tilings->tiling_at(2)->resolution()); 5068 EXPECT_EQ(LOW_RESOLUTION, tilings->tiling_at(2)->resolution());
5063 5069
5064 EXPECT_FALSE(tilings->tiling_at(0)->was_ever_low_resolution());
5065 EXPECT_TRUE(tilings->tiling_at(1)->was_ever_low_resolution());
5066 EXPECT_TRUE(tilings->tiling_at(2)->was_ever_low_resolution());
5067
5068 // The old low res tile was destroyed and replaced. 5070 // The old low res tile was destroyed and replaced.
5069 EXPECT_EQ(old_low_res_tiling, tilings->tiling_at(1)); 5071 EXPECT_EQ(old_low_res_tiling, tilings->tiling_at(1));
5070 EXPECT_NE(old_low_res_tile, tilings->tiling_at(1)->TileAt(0, 0)); 5072 EXPECT_NE(old_low_res_tile, tilings->tiling_at(1)->TileAt(0, 0));
5071 EXPECT_TRUE(tilings->tiling_at(1)->TileAt(0, 0)); 5073 EXPECT_TRUE(tilings->tiling_at(1)->TileAt(0, 0));
5074
5075 // New high res tiling.
5076 EXPECT_FALSE(tilings->tiling_at(0)->may_contain_low_resolution_tiles());
5077 // New low res tiling.
5078 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles());
5079
5080 // This tiling will be high res now, it won't contain low res content since it
5081 // was all destroyed.
5082 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles());
5072 } 5083 }
5073 5084
5074 } // namespace 5085 } // namespace
5075 } // namespace cc 5086 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/tiles/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698