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

Side by Side Diff: cc/picture_layer_impl.cc

Issue 11882037: Activate LayerImpl tree with sync+push instead of pointer swap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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 | « cc/picture_layer_impl.h ('k') | cc/picture_layer_tiling_set.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 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/picture_layer_impl.h" 5 #include "cc/picture_layer_impl.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "cc/append_quads_data.h" 8 #include "cc/append_quads_data.h"
9 #include "cc/checkerboard_draw_quad.h" 9 #include "cc/checkerboard_draw_quad.h"
10 #include "cc/debug_border_draw_quad.h" 10 #include "cc/debug_border_draw_quad.h"
11 #include "cc/debug_colors.h" 11 #include "cc/debug_colors.h"
12 #include "cc/layer_tree_impl.h" 12 #include "cc/layer_tree_impl.h"
13 #include "cc/math_util.h" 13 #include "cc/math_util.h"
14 #include "cc/quad_sink.h" 14 #include "cc/quad_sink.h"
15 #include "cc/solid_color_draw_quad.h" 15 #include "cc/solid_color_draw_quad.h"
16 #include "cc/tile_draw_quad.h" 16 #include "cc/tile_draw_quad.h"
17 #include "ui/gfx/quad_f.h" 17 #include "ui/gfx/quad_f.h"
18 #include "ui/gfx/size_conversions.h" 18 #include "ui/gfx/size_conversions.h"
19 19
20 namespace { 20 namespace {
21 const float kMaxScaleRatioDuringPinch = 2.0f; 21 const float kMaxScaleRatioDuringPinch = 2.0f;
22 } 22 }
23 23
24 namespace cc { 24 namespace cc {
25 25
26 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* treeImpl, int id) 26 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* treeImpl, int id)
27 : LayerImpl(treeImpl, id), 27 : LayerImpl(treeImpl, id),
28 tilings_(this),
29 pile_(PicturePileImpl::Create()), 28 pile_(PicturePileImpl::Create()),
30 last_update_time_(0), 29 last_update_time_(0),
31 last_content_scale_(0), 30 last_content_scale_(0),
32 ideal_contents_scale_(0), 31 ideal_contents_scale_(0),
33 is_mask_(false) { 32 is_mask_(false) {
34 } 33 }
35 34
36 PictureLayerImpl::~PictureLayerImpl() { 35 PictureLayerImpl::~PictureLayerImpl() {
37 } 36 }
38 37
39 const char* PictureLayerImpl::layerTypeAsString() const { 38 const char* PictureLayerImpl::layerTypeAsString() const {
40 return "PictureLayer"; 39 return "PictureLayer";
41 } 40 }
42 41
42 scoped_ptr<LayerImpl> PictureLayerImpl::createLayerImpl(
43 LayerTreeImpl* treeImpl) {
44 return PictureLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>();
45 }
46
47 void PictureLayerImpl::CreateTilingSet() {
48 DCHECK(layerTreeImpl()->IsPendingTree());
49 DCHECK(!tilings_);
50 tilings_.reset(new PictureLayerTilingSet(this));
51 tilings_->SetLayerBounds(bounds());
52 }
53
54 void PictureLayerImpl::TransferTilingSet(scoped_ptr<PictureLayerTilingSet> tilin gs) {
55 DCHECK(layerTreeImpl()->IsActiveTree());
56 tilings->SetClient(this);
57 tilings_ = tilings.Pass();
58 }
59
60 void PictureLayerImpl::pushPropertiesTo(LayerImpl* base_layer) {
61 LayerImpl::pushPropertiesTo(base_layer);
62
63 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
64
65 layer_impl->SetIsMask(is_mask_);
66 layer_impl->TransferTilingSet(tilings_.Pass());
67 layer_impl->pile_ = pile_;
68 pile_ = PicturePileImpl::Create();
69 }
70
71
43 void PictureLayerImpl::appendQuads(QuadSink& quadSink, 72 void PictureLayerImpl::appendQuads(QuadSink& quadSink,
44 AppendQuadsData& appendQuadsData) { 73 AppendQuadsData& appendQuadsData) {
45 const gfx::Rect& rect = visibleContentRect(); 74 const gfx::Rect& rect = visibleContentRect();
46 gfx::Rect content_rect(gfx::Point(), contentBounds()); 75 gfx::Rect content_rect(gfx::Point(), contentBounds());
47 76
48 SharedQuadState* sharedQuadState = 77 SharedQuadState* sharedQuadState =
49 quadSink.useSharedQuadState(createSharedQuadState()); 78 quadSink.useSharedQuadState(createSharedQuadState());
50 bool clipped = false; 79 bool clipped = false;
51 gfx::QuadF target_quad = MathUtil::mapQuad( 80 gfx::QuadF target_quad = MathUtil::mapQuad(
52 drawTransform(), 81 drawTransform(),
53 gfx::QuadF(rect), 82 gfx::QuadF(rect),
54 clipped); 83 clipped);
55 bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear(); 84 bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear();
56 bool useAA = !isAxisAlignedInTarget; 85 bool useAA = !isAxisAlignedInTarget;
57 86
58 if (showDebugBorders()) { 87 if (showDebugBorders()) {
59 for (PictureLayerTilingSet::Iterator iter(&tilings_, 88 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
60 contentsScaleX(), 89 contentsScaleX(),
61 rect, 90 rect,
62 ideal_contents_scale_); 91 ideal_contents_scale_);
63 iter; 92 iter;
64 ++iter) { 93 ++iter) {
65 SkColor color; 94 SkColor color;
66 float width; 95 float width;
67 if (*iter && iter->GetResourceId()) { 96 if (*iter && iter->GetResourceId()) {
68 color = DebugColors::TileBorderColor(); 97 color = DebugColors::TileBorderColor();
69 width = DebugColors::TileBorderWidth(layerTreeImpl()); 98 width = DebugColors::TileBorderWidth(layerTreeImpl());
70 } else { 99 } else {
71 color = DebugColors::MissingTileBorderColor(); 100 color = DebugColors::MissingTileBorderColor();
72 width = DebugColors::MissingTileBorderWidth(layerTreeImpl()); 101 width = DebugColors::MissingTileBorderWidth(layerTreeImpl());
73 } 102 }
74 103
75 scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = 104 scoped_ptr<DebugBorderDrawQuad> debugBorderQuad =
76 DebugBorderDrawQuad::Create(); 105 DebugBorderDrawQuad::Create();
77 gfx::Rect geometry_rect = iter.geometry_rect(); 106 gfx::Rect geometry_rect = iter.geometry_rect();
78 debugBorderQuad->SetNew(sharedQuadState, geometry_rect, color, width); 107 debugBorderQuad->SetNew(sharedQuadState, geometry_rect, color, width);
79 quadSink.append(debugBorderQuad.PassAs<DrawQuad>(), appendQuadsData); 108 quadSink.append(debugBorderQuad.PassAs<DrawQuad>(), appendQuadsData);
80 } 109 }
81 } 110 }
82 111
83 // Keep track of the tilings that were used so that tilings that are 112 // Keep track of the tilings that were used so that tilings that are
84 // unused can be considered for removal. 113 // unused can be considered for removal.
85 std::vector<PictureLayerTiling*> seen_tilings; 114 std::vector<PictureLayerTiling*> seen_tilings;
86 115
87 for (PictureLayerTilingSet::Iterator iter(&tilings_, 116 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
88 contentsScaleX(), 117 contentsScaleX(),
89 rect, 118 rect,
90 ideal_contents_scale_); 119 ideal_contents_scale_);
91 iter; 120 iter;
92 ++iter) { 121 ++iter) {
93 ResourceProvider::ResourceId resource = 0; 122 ResourceProvider::ResourceId resource = 0;
94 if (*iter) 123 if (*iter)
95 resource = iter->GetResourceId(); 124 resource = iter->GetResourceId();
96 125
97 gfx::Rect geometry_rect = iter.geometry_rect(); 126 gfx::Rect geometry_rect = iter.geometry_rect();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 screenSpaceTransform(); 184 screenSpaceTransform();
156 double current_time = 185 double current_time =
157 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); 186 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
158 double time_delta = 0; 187 double time_delta = 0;
159 if (last_update_time_ != 0 && last_bounds_ == bounds() && 188 if (last_update_time_ != 0 && last_bounds_ == bounds() &&
160 last_content_bounds_ == contentBounds() && 189 last_content_bounds_ == contentBounds() &&
161 last_content_scale_ == contentsScaleX()) { 190 last_content_scale_ == contentsScaleX()) {
162 time_delta = current_time - last_update_time_; 191 time_delta = current_time - last_update_time_;
163 } 192 }
164 WhichTree tree = layerTreeImpl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; 193 WhichTree tree = layerTreeImpl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
165 tilings_.UpdateTilePriorities( 194 tilings_->UpdateTilePriorities(
166 tree, 195 tree,
167 layerTreeImpl()->device_viewport_size(), 196 layerTreeImpl()->device_viewport_size(),
168 last_content_scale_, 197 last_content_scale_,
169 contentsScaleX(), 198 contentsScaleX(),
170 last_screen_space_transform_, 199 last_screen_space_transform_,
171 current_screen_space_transform, 200 current_screen_space_transform,
172 time_delta); 201 time_delta);
173 202
174 last_screen_space_transform_ = current_screen_space_transform; 203 last_screen_space_transform_ = current_screen_space_transform;
175 last_update_time_ = current_time; 204 last_update_time_ = current_time;
176 last_bounds_ = bounds(); 205 last_bounds_ = bounds();
177 last_content_bounds_ = contentBounds(); 206 last_content_bounds_ = contentBounds();
178 last_content_scale_ = contentsScaleX(); 207 last_content_scale_ = contentsScaleX();
179 } 208 }
180 209
181 void PictureLayerImpl::didBecomeActive() { 210 void PictureLayerImpl::didBecomeActive() {
182 tilings_.DidBecomeActive(); 211 LayerImpl::didBecomeActive();
212 tilings_->DidBecomeActive();
183 } 213 }
184 214
185 void PictureLayerImpl::didLoseOutputSurface() { 215 void PictureLayerImpl::didLoseOutputSurface() {
186 tilings_.RemoveAllTilings(); 216 if (tilings_)
217 tilings_->RemoveAllTilings();
187 } 218 }
188 219
189 void PictureLayerImpl::calculateContentsScale( 220 void PictureLayerImpl::calculateContentsScale(
190 float ideal_contents_scale, 221 float ideal_contents_scale,
191 float* contents_scale_x, 222 float* contents_scale_x,
192 float* contents_scale_y, 223 float* contents_scale_y,
193 gfx::Size* content_bounds) { 224 gfx::Size* content_bounds) {
194 if (!drawsContent()) { 225 if (!drawsContent()) {
195 DCHECK(!tilings_.num_tilings()); 226 DCHECK(!tilings_->num_tilings());
196 return; 227 return;
197 } 228 }
198 229
199 float min_contents_scale = layerTreeImpl()->settings().minimumContentsScale; 230 float min_contents_scale = layerTreeImpl()->settings().minimumContentsScale;
200 ideal_contents_scale_ = std::max(ideal_contents_scale, min_contents_scale); 231 ideal_contents_scale_ = std::max(ideal_contents_scale, min_contents_scale);
201 232
202 ManageTilings(ideal_contents_scale_); 233 ManageTilings(ideal_contents_scale_);
203 234
204 // The content scale and bounds for a PictureLayerImpl is somewhat fictitious. 235 // The content scale and bounds for a PictureLayerImpl is somewhat fictitious.
205 // There are (usually) several tilings at different scales. However, the 236 // There are (usually) several tilings at different scales. However, the
206 // content bounds is the (integer!) space in which quads are generated. 237 // content bounds is the (integer!) space in which quads are generated.
207 // In order to guarantee that we can fill this integer space with any set of 238 // In order to guarantee that we can fill this integer space with any set of
208 // tilings (and then map back to floating point texture coordinates), the 239 // tilings (and then map back to floating point texture coordinates), the
209 // contents scale must be at least as large as the largest of the tilings. 240 // contents scale must be at least as large as the largest of the tilings.
210 float max_contents_scale = min_contents_scale; 241 float max_contents_scale = min_contents_scale;
211 for (size_t i = 0; i < tilings_.num_tilings(); ++i) { 242 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
212 const PictureLayerTiling* tiling = tilings_.tiling_at(i); 243 const PictureLayerTiling* tiling = tilings_->tiling_at(i);
213 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale()); 244 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale());
214 } 245 }
215 246
216 *contents_scale_x = max_contents_scale; 247 *contents_scale_x = max_contents_scale;
217 *contents_scale_y = max_contents_scale; 248 *contents_scale_y = max_contents_scale;
218 *content_bounds = gfx::ToCeiledSize( 249 *content_bounds = gfx::ToCeiledSize(
219 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale)); 250 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale));
220 } 251 }
221 252
222 skia::RefPtr<SkPicture> PictureLayerImpl::getPicture() { 253 skia::RefPtr<SkPicture> PictureLayerImpl::getPicture() {
(...skipping 26 matching lines...) Expand all
249 // tiles. This needs to be done last, after setting invalidation and the 280 // tiles. This needs to be done last, after setting invalidation and the
250 // pile. 281 // pile.
251 PictureLayerImpl* active_twin = static_cast<PictureLayerImpl*>( 282 PictureLayerImpl* active_twin = static_cast<PictureLayerImpl*>(
252 layerTreeImpl()->FindActiveTreeLayerById(id())); 283 layerTreeImpl()->FindActiveTreeLayerById(id()));
253 if (!active_twin) 284 if (!active_twin)
254 return; 285 return;
255 SyncFromActiveLayer(active_twin); 286 SyncFromActiveLayer(active_twin);
256 } 287 }
257 288
258 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { 289 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
259 tilings_.CloneAll(other->tilings_, invalidation_); 290 tilings_->CloneAll(*other->tilings_, invalidation_);
260 DCHECK(bounds() == tilings_.LayerBounds()); 291 DCHECK(bounds() == tilings_->LayerBounds());
261 } 292 }
262 293
263 void PictureLayerImpl::SyncTiling( 294 void PictureLayerImpl::SyncTiling(
264 const PictureLayerTiling* tiling) { 295 const PictureLayerTiling* tiling) {
265 tilings_.Clone(tiling, invalidation_); 296 tilings_->Clone(tiling, invalidation_);
266 } 297 }
267 298
268 void PictureLayerImpl::SetIsMask(bool is_mask) { 299 void PictureLayerImpl::SetIsMask(bool is_mask) {
269 if (is_mask_ == is_mask) 300 if (is_mask_ == is_mask)
270 return; 301 return;
271 is_mask_ = is_mask; 302 is_mask_ = is_mask;
272 tilings_.RemoveAllTiles(); 303 tilings_->RemoveAllTiles();
273 } 304 }
274 305
275 ResourceProvider::ResourceId PictureLayerImpl::contentsResourceId() const { 306 ResourceProvider::ResourceId PictureLayerImpl::contentsResourceId() const {
276 gfx::Rect content_rect(gfx::Point(), contentBounds()); 307 gfx::Rect content_rect(gfx::Point(), contentBounds());
277 float scale = contentsScaleX(); 308 float scale = contentsScaleX();
278 for (PictureLayerTilingSet::Iterator iter(&tilings_, 309 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
279 scale, 310 scale,
280 content_rect, 311 content_rect,
281 ideal_contents_scale_); 312 ideal_contents_scale_);
282 iter; 313 iter;
283 ++iter) { 314 ++iter) {
284 // Mask resource not ready yet. 315 // Mask resource not ready yet.
285 if (!*iter || !iter->GetResourceId()) 316 if (!*iter || !iter->GetResourceId())
286 return 0; 317 return 0;
287 // Masks only supported if they fit on exactly one tile. 318 // Masks only supported if they fit on exactly one tile.
288 if (iter.geometry_rect() != content_rect) 319 if (iter.geometry_rect() != content_rect)
289 return 0; 320 return 0;
290 return iter->GetResourceId(); 321 return iter->GetResourceId();
291 } 322 }
292 return 0; 323 return 0;
293 } 324 }
294 325
295 bool PictureLayerImpl::areVisibleResourcesReady() const { 326 bool PictureLayerImpl::areVisibleResourcesReady() const {
296 const gfx::Rect& rect = visibleContentRect(); 327 const gfx::Rect& rect = visibleContentRect();
297 328
298 for (size_t i = 0; i < tilings_.num_tilings(); ++i) { 329 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
299 const PictureLayerTiling* tiling = tilings_.tiling_at(i); 330 const PictureLayerTiling* tiling = tilings_->tiling_at(i);
300 331
301 // Ignore non-high resolution tilings. 332 // Ignore non-high resolution tilings.
302 if (tiling->resolution() != HIGH_RESOLUTION) 333 if (tiling->resolution() != HIGH_RESOLUTION)
303 continue; 334 continue;
304 335
305 for (PictureLayerTiling::Iterator iter(tiling, 336 for (PictureLayerTiling::Iterator iter(tiling,
306 tiling->contents_scale(), 337 tiling->contents_scale(),
307 rect); 338 rect);
308 iter; 339 iter;
309 ++iter) { 340 ++iter) {
310 // Resource not ready yet. 341 // Resource not ready yet.
311 if (!*iter || !iter->GetResourceId()) 342 if (!*iter || !iter->GetResourceId())
312 return false; 343 return false;
313 } 344 }
314 return true; 345 return true;
315 } 346 }
316 return false; 347 return false;
317 } 348 }
318 349
319 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { 350 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
320 if (contents_scale < layerTreeImpl()->settings().minimumContentsScale) 351 if (contents_scale < layerTreeImpl()->settings().minimumContentsScale)
321 return NULL; 352 return NULL;
322 353
323 PictureLayerTiling* tiling = tilings_.AddTiling( 354 PictureLayerTiling* tiling = tilings_->AddTiling(
324 contents_scale, 355 contents_scale,
325 TileSize()); 356 TileSize());
326 357
327 // If a new tiling is created on the active tree, sync it to the pending tree 358 // If a new tiling is created on the active tree, sync it to the pending tree
328 // so that it can share the same tiles. 359 // so that it can share the same tiles.
329 if (layerTreeImpl()->IsPendingTree()) 360 if (layerTreeImpl()->IsPendingTree())
330 return tiling; 361 return tiling;
331 362
332 PictureLayerImpl* pending_twin = static_cast<PictureLayerImpl*>( 363 PictureLayerImpl* pending_twin = static_cast<PictureLayerImpl*>(
333 layerTreeImpl()->FindPendingTreeLayerById(id())); 364 layerTreeImpl()->FindPendingTreeLayerById(id()));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 float low_res_factor = layerTreeImpl()->settings().lowResContentsScaleFactor; 405 float low_res_factor = layerTreeImpl()->settings().lowResContentsScaleFactor;
375 float low_res_contents_scale = ideal_contents_scale * low_res_factor; 406 float low_res_contents_scale = ideal_contents_scale * low_res_factor;
376 407
377 // Remove any tilings from the pending tree that don't exactly match the 408 // Remove any tilings from the pending tree that don't exactly match the
378 // contents scale. The pending tree should always come in crisp. However, 409 // contents scale. The pending tree should always come in crisp. However,
379 // don't do this during a pinch, to avoid throwing away a tiling that should 410 // don't do this during a pinch, to avoid throwing away a tiling that should
380 // have been kept. 411 // have been kept.
381 if (layerTreeImpl()->IsPendingTree() && 412 if (layerTreeImpl()->IsPendingTree() &&
382 !layerTreeImpl()->PinchGestureActive()) { 413 !layerTreeImpl()->PinchGestureActive()) {
383 std::vector<PictureLayerTiling*> remove_list; 414 std::vector<PictureLayerTiling*> remove_list;
384 for (size_t i = 0; i < tilings_.num_tilings(); ++i) { 415 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
385 PictureLayerTiling* tiling = tilings_.tiling_at(i); 416 PictureLayerTiling* tiling = tilings_->tiling_at(i);
386 if (tiling->contents_scale() == ideal_contents_scale) 417 if (tiling->contents_scale() == ideal_contents_scale)
387 continue; 418 continue;
388 if (tiling->contents_scale() == low_res_contents_scale) 419 if (tiling->contents_scale() == low_res_contents_scale)
389 continue; 420 continue;
390 remove_list.push_back(tiling); 421 remove_list.push_back(tiling);
391 } 422 }
392 423
393 for (size_t i = 0; i < remove_list.size(); ++i) 424 for (size_t i = 0; i < remove_list.size(); ++i)
394 tilings_.Remove(remove_list[i]); 425 tilings_->Remove(remove_list[i]);
395 } 426 }
396 427
397 // Find existing tilings closest to ideal high / low res. 428 // Find existing tilings closest to ideal high / low res.
398 PictureLayerTiling* high_res = NULL; 429 PictureLayerTiling* high_res = NULL;
399 PictureLayerTiling* low_res = NULL; 430 PictureLayerTiling* low_res = NULL;
400 for (size_t i = 0; i < tilings_.num_tilings(); ++i) { 431 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
401 PictureLayerTiling* tiling = tilings_.tiling_at(i); 432 PictureLayerTiling* tiling = tilings_->tiling_at(i);
402 if (!high_res || IsCloserToThan(tiling, high_res, ideal_contents_scale)) 433 if (!high_res || IsCloserToThan(tiling, high_res, ideal_contents_scale))
403 high_res = tiling; 434 high_res = tiling;
404 if (!low_res || IsCloserToThan(tiling, low_res, low_res_contents_scale)) 435 if (!low_res || IsCloserToThan(tiling, low_res, low_res_contents_scale))
405 low_res = tiling; 436 low_res = tiling;
406 437
407 // Reset all tilings to non-ideal until the end of this function. 438 // Reset all tilings to non-ideal until the end of this function.
408 tiling->set_resolution(NON_IDEAL_RESOLUTION); 439 tiling->set_resolution(NON_IDEAL_RESOLUTION);
409 } 440 }
410 441
411 // The active tree always has calcDrawProperties called on it first, and 442 // The active tree always has calcDrawProperties called on it first, and
(...skipping 23 matching lines...) Expand all
435 if (high_res) 466 if (high_res)
436 high_res->set_resolution(HIGH_RESOLUTION); 467 high_res->set_resolution(HIGH_RESOLUTION);
437 if (low_res && low_res != high_res) 468 if (low_res && low_res != high_res)
438 low_res->set_resolution(LOW_RESOLUTION); 469 low_res->set_resolution(LOW_RESOLUTION);
439 } 470 }
440 471
441 void PictureLayerImpl::CleanUpUnusedTilings( 472 void PictureLayerImpl::CleanUpUnusedTilings(
442 std::vector<PictureLayerTiling*> used_tilings) { 473 std::vector<PictureLayerTiling*> used_tilings) {
443 std::vector<PictureLayerTiling*> to_remove; 474 std::vector<PictureLayerTiling*> to_remove;
444 475
445 for (size_t i = 0; i < tilings_.num_tilings(); ++i) { 476 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
446 PictureLayerTiling* tiling = tilings_.tiling_at(i); 477 PictureLayerTiling* tiling = tilings_->tiling_at(i);
447 // Don't remove the current high or low res tilinig. 478 // Don't remove the current high or low res tilinig.
448 if (tiling->resolution() != NON_IDEAL_RESOLUTION) 479 if (tiling->resolution() != NON_IDEAL_RESOLUTION)
449 continue; 480 continue;
450 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) == 481 if (std::find(used_tilings.begin(), used_tilings.end(), tiling) ==
451 used_tilings.end()) 482 used_tilings.end())
452 to_remove.push_back(tiling); 483 to_remove.push_back(tiling);
453 } 484 }
454 485
455 for (size_t i = 0; i < to_remove.size(); ++i) 486 for (size_t i = 0; i < to_remove.size(); ++i)
456 tilings_.Remove(to_remove[i]); 487 tilings_->Remove(to_remove[i]);
457 } 488 }
458 489
459 } // namespace cc 490 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_impl.h ('k') | cc/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698