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

Side by Side Diff: cc/picture_layer_tiling_set.cc

Issue 11418108: cc: Make the ScopedPtrVector and ScopedPtrDeque containers act like STL vector and deque. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android!! 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/layer_tree_impl.cc ('k') | cc/quad_culler.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/picture_layer_tiling_set.h" 5 #include "cc/picture_layer_tiling_set.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 PictureLayerTilingSet::PictureLayerTilingSet( 9 PictureLayerTilingSet::PictureLayerTilingSet(
10 PictureLayerTilingClient * client) 10 PictureLayerTilingClient * client)
11 : client_(client) { 11 : client_(client) {
12 } 12 }
13 13
14 PictureLayerTilingSet::~PictureLayerTilingSet() { 14 PictureLayerTilingSet::~PictureLayerTilingSet() {
15 } 15 }
16 16
17 void PictureLayerTilingSet::CloneAll( 17 void PictureLayerTilingSet::CloneAll(
18 const PictureLayerTilingSet& other, 18 const PictureLayerTilingSet& other,
19 const Region& invalidation) { 19 const Region& invalidation) {
20 tilings_.clear(); 20 tilings_.clear();
21 tilings_.reserve(other.tilings_.size()); 21 tilings_.reserve(other.tilings_.size());
22 for (size_t i = 0; i < other.tilings_.size(); ++i) { 22 for (size_t i = 0; i < other.tilings_.size(); ++i) {
23 tilings_.append(other.tilings_[i]->Clone()); 23 tilings_.push_back(other.tilings_[i]->Clone());
24 tilings_.last()->SetLayerBounds(LayerBounds()); 24 tilings_.back()->SetLayerBounds(LayerBounds());
25 tilings_.last()->SetClient(client_); 25 tilings_.back()->SetClient(client_);
26 tilings_.last()->Invalidate(invalidation); 26 tilings_.back()->Invalidate(invalidation);
27 } 27 }
28 } 28 }
29 29
30 void PictureLayerTilingSet::Clone( 30 void PictureLayerTilingSet::Clone(
31 const PictureLayerTiling* tiling, 31 const PictureLayerTiling* tiling,
32 const Region& invalidation) { 32 const Region& invalidation) {
33 33
34 for (size_t i = 0; i < tilings_.size(); ++i) 34 for (size_t i = 0; i < tilings_.size(); ++i)
35 DCHECK_NE(tilings_[i]->contents_scale(), tiling->contents_scale()); 35 DCHECK_NE(tilings_[i]->contents_scale(), tiling->contents_scale());
36 36
37 tilings_.append(tiling->Clone()); 37 tilings_.push_back(tiling->Clone());
38 tilings_.last()->SetClient(client_); 38 tilings_.back()->SetClient(client_);
39 tilings_.last()->Invalidate(invalidation); 39 tilings_.back()->Invalidate(invalidation);
40 } 40 }
41 41
42 void PictureLayerTilingSet::SetLayerBounds(gfx::Size layer_bounds) { 42 void PictureLayerTilingSet::SetLayerBounds(gfx::Size layer_bounds) {
43 if (layer_bounds_ == layer_bounds) 43 if (layer_bounds_ == layer_bounds)
44 return; 44 return;
45 layer_bounds_ = layer_bounds; 45 layer_bounds_ = layer_bounds;
46 for (size_t i = 0; i < tilings_.size(); ++i) 46 for (size_t i = 0; i < tilings_.size(); ++i)
47 tilings_[i]->SetLayerBounds(layer_bounds); 47 tilings_[i]->SetLayerBounds(layer_bounds);
48 } 48 }
49 49
50 gfx::Size PictureLayerTilingSet::LayerBounds() const { 50 gfx::Size PictureLayerTilingSet::LayerBounds() const {
51 return layer_bounds_; 51 return layer_bounds_;
52 } 52 }
53 53
54 const PictureLayerTiling* PictureLayerTilingSet::AddTiling( 54 const PictureLayerTiling* PictureLayerTilingSet::AddTiling(
55 float contents_scale, 55 float contents_scale,
56 gfx::Size tile_size) { 56 gfx::Size tile_size) {
57 tilings_.append(PictureLayerTiling::Create(contents_scale, tile_size)); 57 tilings_.push_back(PictureLayerTiling::Create(contents_scale, tile_size));
58 tilings_.last()->SetClient(client_); 58 tilings_.back()->SetClient(client_);
59 tilings_.last()->SetLayerBounds(layer_bounds_); 59 tilings_.back()->SetLayerBounds(layer_bounds_);
60 return tilings_.last(); 60 return tilings_.back();
61 } 61 }
62 62
63 void PictureLayerTilingSet::Reset() { 63 void PictureLayerTilingSet::Reset() {
64 for (size_t i = 0; i < tilings_.size(); ++i) 64 for (size_t i = 0; i < tilings_.size(); ++i)
65 tilings_[i]->Reset(); 65 tilings_[i]->Reset();
66 } 66 }
67 67
68 PictureLayerTilingSet::Iterator::Iterator(const PictureLayerTilingSet* set, 68 PictureLayerTilingSet::Iterator::Iterator(const PictureLayerTilingSet* set,
69 float contents_scale, 69 float contents_scale,
70 gfx::Rect content_rect) 70 gfx::Rect content_rect)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 device_viewport, 188 device_viewport,
189 layer_content_scale_x, 189 layer_content_scale_x,
190 layer_content_scale_y, 190 layer_content_scale_y,
191 last_screen_transform, 191 last_screen_transform,
192 current_screen_transform, 192 current_screen_transform,
193 time_delta); 193 time_delta);
194 } 194 }
195 } 195 }
196 196
197 } // namespace cc 197 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_impl.cc ('k') | cc/quad_culler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698