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

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

Issue 294463002: cc: Reset raster scale if we didn't sync high res tiling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/picture_layer_tiling_set.h ('k') | cc/test/fake_picture_layer_impl.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/resources/picture_layer_tiling_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 PictureLayerTilingSet::~PictureLayerTilingSet() { 30 PictureLayerTilingSet::~PictureLayerTilingSet() {
31 } 31 }
32 32
33 void PictureLayerTilingSet::SetClient(PictureLayerTilingClient* client) { 33 void PictureLayerTilingSet::SetClient(PictureLayerTilingClient* client) {
34 client_ = client; 34 client_ = client;
35 for (size_t i = 0; i < tilings_.size(); ++i) 35 for (size_t i = 0; i < tilings_.size(); ++i)
36 tilings_[i]->SetClient(client_); 36 tilings_[i]->SetClient(client_);
37 } 37 }
38 38
39 void PictureLayerTilingSet::SyncTilings( 39 bool PictureLayerTilingSet::SyncTilings(const PictureLayerTilingSet& other,
40 const PictureLayerTilingSet& other, 40 const gfx::Size& new_layer_bounds,
41 const gfx::Size& new_layer_bounds, 41 const Region& layer_invalidation,
42 const Region& layer_invalidation, 42 float minimum_contents_scale) {
43 float minimum_contents_scale) {
44 if (new_layer_bounds.IsEmpty()) { 43 if (new_layer_bounds.IsEmpty()) {
45 RemoveAllTilings(); 44 RemoveAllTilings();
46 layer_bounds_ = new_layer_bounds; 45 layer_bounds_ = new_layer_bounds;
47 return; 46 return false;
48 } 47 }
49 48
50 tilings_.reserve(other.tilings_.size()); 49 tilings_.reserve(other.tilings_.size());
51 50
52 // Remove any tilings that aren't in |other| or don't meet the minimum. 51 // Remove any tilings that aren't in |other| or don't meet the minimum.
53 for (size_t i = 0; i < tilings_.size(); ++i) { 52 for (size_t i = 0; i < tilings_.size(); ++i) {
54 float scale = tilings_[i]->contents_scale(); 53 float scale = tilings_[i]->contents_scale();
55 if (scale >= minimum_contents_scale && !!other.TilingAtScale(scale)) 54 if (scale >= minimum_contents_scale && !!other.TilingAtScale(scale))
56 continue; 55 continue;
57 // Swap with the last element and remove it. 56 // Swap with the last element and remove it.
58 tilings_.swap(tilings_.begin() + i, tilings_.end() - 1); 57 tilings_.swap(tilings_.begin() + i, tilings_.end() - 1);
59 tilings_.pop_back(); 58 tilings_.pop_back();
60 --i; 59 --i;
61 } 60 }
62 61
62 bool have_high_res_tiling = false;
63
63 // Add any missing tilings from |other| that meet the minimum. 64 // Add any missing tilings from |other| that meet the minimum.
64 for (size_t i = 0; i < other.tilings_.size(); ++i) { 65 for (size_t i = 0; i < other.tilings_.size(); ++i) {
65 float contents_scale = other.tilings_[i]->contents_scale(); 66 float contents_scale = other.tilings_[i]->contents_scale();
66 if (contents_scale < minimum_contents_scale) 67 if (contents_scale < minimum_contents_scale)
67 continue; 68 continue;
68 if (PictureLayerTiling* this_tiling = TilingAtScale(contents_scale)) { 69 if (PictureLayerTiling* this_tiling = TilingAtScale(contents_scale)) {
69 this_tiling->set_resolution(other.tilings_[i]->resolution()); 70 this_tiling->set_resolution(other.tilings_[i]->resolution());
70 71
71 // These two calls must come before updating the pile, because they may 72 // These two calls must come before updating the pile, because they may
72 // destroy tiles that the new pile cannot raster. 73 // destroy tiles that the new pile cannot raster.
73 this_tiling->SetLayerBounds(new_layer_bounds); 74 this_tiling->SetLayerBounds(new_layer_bounds);
74 this_tiling->Invalidate(layer_invalidation); 75 this_tiling->Invalidate(layer_invalidation);
75 76
76 this_tiling->UpdateTilesToCurrentPile(); 77 this_tiling->UpdateTilesToCurrentPile();
77 this_tiling->CreateMissingTilesInLiveTilesRect(); 78 this_tiling->CreateMissingTilesInLiveTilesRect();
79 if (this_tiling->resolution() == HIGH_RESOLUTION)
80 have_high_res_tiling = true;
78 81
79 DCHECK(this_tiling->tile_size() == 82 DCHECK(this_tiling->tile_size() ==
80 client_->CalculateTileSize(this_tiling->TilingRect().size())); 83 client_->CalculateTileSize(this_tiling->TilingRect().size()));
81 continue; 84 continue;
82 } 85 }
83 scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create( 86 scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create(
84 contents_scale, 87 contents_scale,
85 new_layer_bounds, 88 new_layer_bounds,
86 client_); 89 client_);
87 new_tiling->set_resolution(other.tilings_[i]->resolution()); 90 new_tiling->set_resolution(other.tilings_[i]->resolution());
91 if (new_tiling->resolution() == HIGH_RESOLUTION)
92 have_high_res_tiling = true;
88 tilings_.push_back(new_tiling.Pass()); 93 tilings_.push_back(new_tiling.Pass());
89 } 94 }
90 tilings_.sort(LargestToSmallestScaleFunctor()); 95 tilings_.sort(LargestToSmallestScaleFunctor());
91 96
92 layer_bounds_ = new_layer_bounds; 97 layer_bounds_ = new_layer_bounds;
98 return have_high_res_tiling;
93 } 99 }
94 100
95 void PictureLayerTilingSet::RemoveTilesInRegion(const Region& region) { 101 void PictureLayerTilingSet::RemoveTilesInRegion(const Region& region) {
96 for (size_t i = 0; i < tilings_.size(); ++i) 102 for (size_t i = 0; i < tilings_.size(); ++i)
97 tilings_[i]->RemoveTilesInRegion(region); 103 tilings_[i]->RemoveTilesInRegion(region);
98 } 104 }
99 105
100 void PictureLayerTilingSet::SetCanUseLCDText(bool can_use_lcd_text) { 106 void PictureLayerTilingSet::SetCanUseLCDText(bool can_use_lcd_text) {
101 for (size_t i = 0; i < tilings_.size(); ++i) 107 for (size_t i = 0; i < tilings_.size(); ++i)
102 tilings_[i]->SetCanUseLCDText(can_use_lcd_text); 108 tilings_[i]->SetCanUseLCDText(can_use_lcd_text);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 350 }
345 351
346 size_t PictureLayerTilingSet::GPUMemoryUsageInBytes() const { 352 size_t PictureLayerTilingSet::GPUMemoryUsageInBytes() const {
347 size_t amount = 0; 353 size_t amount = 0;
348 for (size_t i = 0; i < tilings_.size(); ++i) 354 for (size_t i = 0; i < tilings_.size(); ++i)
349 amount += tilings_[i]->GPUMemoryUsageInBytes(); 355 amount += tilings_[i]->GPUMemoryUsageInBytes();
350 return amount; 356 return amount;
351 } 357 }
352 358
353 } // namespace cc 359 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_set.h ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698