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

Side by Side Diff: cc/resources/picture_layer_tiling_set.cc

Issue 793693003: Tile Compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 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/resources/picture_layer_tiling_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 void PictureLayerTilingSet::MarkAllTilingsNonIdeal() { 116 void PictureLayerTilingSet::MarkAllTilingsNonIdeal() {
117 for (auto* tiling : tilings_) 117 for (auto* tiling : tilings_)
118 tiling->set_resolution(NON_IDEAL_RESOLUTION); 118 tiling->set_resolution(NON_IDEAL_RESOLUTION);
119 } 119 }
120 120
121 bool PictureLayerTilingSet::SyncTilings(const PictureLayerTilingSet& other, 121 bool PictureLayerTilingSet::SyncTilings(const PictureLayerTilingSet& other,
122 const gfx::Size& new_layer_bounds, 122 const gfx::Size& new_layer_bounds,
123 const Region& layer_invalidation, 123 const Region& layer_invalidation,
124 float minimum_contents_scale, 124 float minimum_contents_scale,
125 RasterSource* raster_source) { 125 RasterSource* raster_source,
126 base::TimeTicks frame_time) {
126 if (new_layer_bounds.IsEmpty()) { 127 if (new_layer_bounds.IsEmpty()) {
127 RemoveAllTilings(); 128 RemoveAllTilings();
128 return false; 129 return false;
129 } 130 }
130 131
131 tilings_.reserve(other.tilings_.size()); 132 tilings_.reserve(other.tilings_.size());
132 133
133 // Remove any tilings that aren't in |other| or don't meet the minimum. 134 // Remove any tilings that aren't in |other| or don't meet the minimum.
134 for (size_t i = 0; i < tilings_.size(); ++i) { 135 for (size_t i = 0; i < tilings_.size(); ++i) {
135 float scale = tilings_[i]->contents_scale(); 136 float scale = tilings_[i]->contents_scale();
136 if (scale >= minimum_contents_scale && !!other.FindTilingWithScale(scale)) 137 if (scale >= minimum_contents_scale && !!other.FindTilingWithScale(scale))
137 continue; 138 continue;
138 // Swap with the last element and remove it. 139 // Swap with the last element and remove it.
139 tilings_.swap(tilings_.begin() + i, tilings_.end() - 1); 140 tilings_.swap(tilings_.begin() + i, tilings_.end() - 1);
140 tilings_.pop_back(); 141 tilings_.pop_back();
141 --i; 142 --i;
142 } 143 }
143 144
144 bool have_high_res_tiling = false; 145 bool have_high_res_tiling = false;
145 146
146 // Add any missing tilings from |other| that meet the minimum. 147 // Add any missing tilings from |other| that meet the minimum.
147 for (size_t i = 0; i < other.tilings_.size(); ++i) { 148 for (size_t i = 0; i < other.tilings_.size(); ++i) {
148 float contents_scale = other.tilings_[i]->contents_scale(); 149 float contents_scale = other.tilings_[i]->contents_scale();
149 if (contents_scale < minimum_contents_scale) 150 if (contents_scale < minimum_contents_scale)
150 continue; 151 continue;
151 if (PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale)) { 152 if (PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale)) {
152 this_tiling->set_resolution(other.tilings_[i]->resolution()); 153 this_tiling->set_resolution(other.tilings_[i]->resolution());
153 154
154 this_tiling->UpdateTilesToCurrentRasterSource( 155 this_tiling->UpdateTilesToCurrentRasterSource(
155 raster_source, layer_invalidation, new_layer_bounds); 156 raster_source, layer_invalidation, new_layer_bounds, frame_time);
156 this_tiling->CreateMissingTilesInLiveTilesRect(); 157 this_tiling->CreateMissingTilesInLiveTilesRect();
157 if (this_tiling->resolution() == HIGH_RESOLUTION) 158 if (this_tiling->resolution() == HIGH_RESOLUTION)
158 have_high_res_tiling = true; 159 have_high_res_tiling = true;
159 160
160 DCHECK(this_tiling->tile_size() == 161 DCHECK(this_tiling->tile_size() ==
161 client_->CalculateTileSize(this_tiling->tiling_size())) 162 client_->CalculateTileSize(this_tiling->tiling_size()))
162 << "tile_size: " << this_tiling->tile_size().ToString() 163 << "tile_size: " << this_tiling->tile_size().ToString()
163 << " tiling_size: " << this_tiling->tiling_size().ToString() 164 << " tiling_size: " << this_tiling->tiling_size().ToString()
164 << " CalculateTileSize: " 165 << " CalculateTileSize: "
165 << client_->CalculateTileSize(this_tiling->tiling_size()).ToString(); 166 << client_->CalculateTileSize(this_tiling->tiling_size()).ToString();
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 case LOWER_THAN_LOW_RES: 519 case LOWER_THAN_LOW_RES:
519 range = TilingRange(low_res_range.end, tilings_.size()); 520 range = TilingRange(low_res_range.end, tilings_.size());
520 break; 521 break;
521 } 522 }
522 523
523 DCHECK_LE(range.start, range.end); 524 DCHECK_LE(range.start, range.end);
524 return range; 525 return range;
525 } 526 }
526 527
527 } // namespace cc 528 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_set.h ('k') | cc/resources/picture_layer_tiling_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698