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

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

Issue 323193002: cc: Don't cleanup the pending twin's low res tiling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: scale-collision: . Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 void PictureLayerImpl::CleanUpTilingsOnActiveLayer( 1214 void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
1215 std::vector<PictureLayerTiling*> used_tilings) { 1215 std::vector<PictureLayerTiling*> used_tilings) {
1216 DCHECK(layer_tree_impl()->IsActiveTree()); 1216 DCHECK(layer_tree_impl()->IsActiveTree());
1217 if (tilings_->num_tilings() == 0) 1217 if (tilings_->num_tilings() == 0)
1218 return; 1218 return;
1219 1219
1220 float min_acceptable_high_res_scale = std::min( 1220 float min_acceptable_high_res_scale = std::min(
1221 raster_contents_scale_, ideal_contents_scale_); 1221 raster_contents_scale_, ideal_contents_scale_);
1222 float max_acceptable_high_res_scale = std::max( 1222 float max_acceptable_high_res_scale = std::max(
1223 raster_contents_scale_, ideal_contents_scale_); 1223 raster_contents_scale_, ideal_contents_scale_);
1224 float twin_low_res_scale = 0.f;
1224 1225
1225 PictureLayerImpl* twin = twin_layer_; 1226 PictureLayerImpl* twin = twin_layer_;
1226 if (twin) { 1227 if (twin) {
1227 min_acceptable_high_res_scale = std::min( 1228 min_acceptable_high_res_scale = std::min(
1228 min_acceptable_high_res_scale, 1229 min_acceptable_high_res_scale,
1229 std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_)); 1230 std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_));
1230 max_acceptable_high_res_scale = std::max( 1231 max_acceptable_high_res_scale = std::max(
1231 max_acceptable_high_res_scale, 1232 max_acceptable_high_res_scale,
1232 std::max(twin->raster_contents_scale_, twin->ideal_contents_scale_)); 1233 std::max(twin->raster_contents_scale_, twin->ideal_contents_scale_));
1234
1235 for (size_t i = 0; i < twin->tilings_->num_tilings(); ++i) {
1236 PictureLayerTiling* tiling = twin->tilings_->tiling_at(i);
1237 if (tiling->resolution() == LOW_RESOLUTION)
1238 twin_low_res_scale = tiling->contents_scale();
1239 }
1233 } 1240 }
1234 1241
1235 std::vector<PictureLayerTiling*> to_remove; 1242 std::vector<PictureLayerTiling*> to_remove;
1236 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 1243 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
1237 PictureLayerTiling* tiling = tilings_->tiling_at(i); 1244 PictureLayerTiling* tiling = tilings_->tiling_at(i);
1238 1245
1239 // Keep multiple high resolution tilings even if not used to help 1246 // Keep multiple high resolution tilings even if not used to help
1240 // activate earlier at non-ideal resolutions. 1247 // activate earlier at non-ideal resolutions.
1241 if (tiling->contents_scale() >= min_acceptable_high_res_scale && 1248 if (tiling->contents_scale() >= min_acceptable_high_res_scale &&
1242 tiling->contents_scale() <= max_acceptable_high_res_scale) 1249 tiling->contents_scale() <= max_acceptable_high_res_scale)
1243 continue; 1250 continue;
1244 1251
1245 // Keep low resolution tilings, if the layer should have them. 1252 // Keep low resolution tilings, if the layer should have them.
1246 if (tiling->resolution() == LOW_RESOLUTION && 1253 if (layer_tree_impl()->create_low_res_tiling()) {
1247 layer_tree_impl()->create_low_res_tiling()) 1254 if (tiling->resolution() == LOW_RESOLUTION ||
1248 continue; 1255 tiling->contents_scale() == twin_low_res_scale)
1256 continue;
1257 }
1249 1258
1250 // Don't remove tilings that are being used (and thus would cause a flash.) 1259 // Don't remove tilings that are being used (and thus would cause a flash.)
1251 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) != 1260 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) !=
1252 used_tilings.end()) 1261 used_tilings.end())
1253 continue; 1262 continue;
1254 1263
1255 to_remove.push_back(tiling); 1264 to_remove.push_back(tiling);
1256 } 1265 }
1257 1266
1258 for (size_t i = 0; i < to_remove.size(); ++i) { 1267 for (size_t i = 0; i < to_remove.size(); ++i) {
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 return iterator_index_ < iterators_.size(); 1648 return iterator_index_ < iterators_.size();
1640 } 1649 }
1641 1650
1642 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1651 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1643 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1652 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1644 return it->get_type() == iteration_stage_ && 1653 return it->get_type() == iteration_stage_ &&
1645 (**it)->required_for_activation() == required_for_activation_; 1654 (**it)->required_for_activation() == required_for_activation_;
1646 } 1655 }
1647 1656
1648 } // namespace cc 1657 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698