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

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

Issue 1144523003: Rename cc::ResourceProvider::ResourceId to cc::ResourceId and move it to its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « cc/layers/tiled_layer_impl.h ('k') | cc/layers/tiled_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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/tiled_layer_impl.h" 5 #include "cc/layers/tiled_layer_impl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event_argument.h" 9 #include "base/trace_event/trace_event_argument.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 11 matching lines...) Expand all
22 #include "ui/gfx/geometry/quad_f.h" 22 #include "ui/gfx/geometry/quad_f.h"
23 23
24 namespace cc { 24 namespace cc {
25 25
26 class DrawableTile : public LayerTilingData::Tile { 26 class DrawableTile : public LayerTilingData::Tile {
27 public: 27 public:
28 static scoped_ptr<DrawableTile> Create() { 28 static scoped_ptr<DrawableTile> Create() {
29 return make_scoped_ptr(new DrawableTile()); 29 return make_scoped_ptr(new DrawableTile());
30 } 30 }
31 31
32 ResourceProvider::ResourceId resource_id() const { return resource_id_; } 32 ResourceId resource_id() const { return resource_id_; }
33 void set_resource_id(ResourceProvider::ResourceId resource_id) { 33 void set_resource_id(ResourceId resource_id) { resource_id_ = resource_id; }
34 resource_id_ = resource_id;
35 }
36 bool contents_swizzled() { return contents_swizzled_; } 34 bool contents_swizzled() { return contents_swizzled_; }
37 void set_contents_swizzled(bool contents_swizzled) { 35 void set_contents_swizzled(bool contents_swizzled) {
38 contents_swizzled_ = contents_swizzled; 36 contents_swizzled_ = contents_swizzled;
39 } 37 }
40 38
41 private: 39 private:
42 DrawableTile() : resource_id_(0), contents_swizzled_(false) {} 40 DrawableTile() : resource_id_(0), contents_swizzled_(false) {}
43 41
44 ResourceProvider::ResourceId resource_id_; 42 ResourceId resource_id_;
45 bool contents_swizzled_; 43 bool contents_swizzled_;
46 44
47 DISALLOW_COPY_AND_ASSIGN(DrawableTile); 45 DISALLOW_COPY_AND_ASSIGN(DrawableTile);
48 }; 46 };
49 47
50 TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* tree_impl, int id) 48 TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* tree_impl, int id)
51 : TiledLayerImpl(tree_impl, id, new LayerImpl::SyncedScrollOffset) { 49 : TiledLayerImpl(tree_impl, id, new LayerImpl::SyncedScrollOffset) {
52 } 50 }
53 51
54 TiledLayerImpl::TiledLayerImpl( 52 TiledLayerImpl::TiledLayerImpl(
55 LayerTreeImpl* tree_impl, 53 LayerTreeImpl* tree_impl,
56 int id, 54 int id,
57 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset) 55 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset)
58 : LayerImpl(tree_impl, id, synced_scroll_offset), skips_draw_(true) { 56 : LayerImpl(tree_impl, id, synced_scroll_offset), skips_draw_(true) {
59 } 57 }
60 58
61 TiledLayerImpl::~TiledLayerImpl() { 59 TiledLayerImpl::~TiledLayerImpl() {
62 } 60 }
63 61
64 void TiledLayerImpl::GetContentsResourceId( 62 void TiledLayerImpl::GetContentsResourceId(ResourceId* resource_id,
65 ResourceProvider::ResourceId* resource_id, 63 gfx::Size* resource_size) const {
66 gfx::Size* resource_size) const {
67 // This function is only valid for single texture layers, e.g. masks. 64 // This function is only valid for single texture layers, e.g. masks.
68 DCHECK(tiler_); 65 DCHECK(tiler_);
69 // It's possible the mask layer is created but has no size or otherwise 66 // It's possible the mask layer is created but has no size or otherwise
70 // can't draw. 67 // can't draw.
71 if (tiler_->num_tiles_x() == 0 || tiler_->num_tiles_y() == 0) { 68 if (tiler_->num_tiles_x() == 0 || tiler_->num_tiles_y() == 0) {
72 *resource_id = 0; 69 *resource_id = 0;
73 return; 70 return;
74 } 71 }
75 72
76 // Any other number of tiles other than 0 or 1 is incorrect for masks. 73 // Any other number of tiles other than 0 or 1 is incorrect for masks.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 tiler_->reset(); 277 tiler_->reset();
281 } else { 278 } else {
282 tiler_ = LayerTilingData::Create(tiler.tile_size(), 279 tiler_ = LayerTilingData::Create(tiler.tile_size(),
283 tiler.has_border_texels() 280 tiler.has_border_texels()
284 ? LayerTilingData::HAS_BORDER_TEXELS 281 ? LayerTilingData::HAS_BORDER_TEXELS
285 : LayerTilingData::NO_BORDER_TEXELS); 282 : LayerTilingData::NO_BORDER_TEXELS);
286 } 283 }
287 *tiler_ = tiler; 284 *tiler_ = tiler;
288 } 285 }
289 286
290 void TiledLayerImpl::PushTileProperties( 287 void TiledLayerImpl::PushTileProperties(int i,
291 int i, 288 int j,
292 int j, 289 ResourceId resource_id,
293 ResourceProvider::ResourceId resource_id, 290 bool contents_swizzled) {
294 bool contents_swizzled) {
295 DrawableTile* tile = TileAt(i, j); 291 DrawableTile* tile = TileAt(i, j);
296 if (!tile) 292 if (!tile)
297 tile = CreateTile(i, j); 293 tile = CreateTile(i, j);
298 tile->set_resource_id(resource_id); 294 tile->set_resource_id(resource_id);
299 tile->set_contents_swizzled(contents_swizzled); 295 tile->set_contents_swizzled(contents_swizzled);
300 } 296 }
301 297
302 void TiledLayerImpl::PushInvalidTile(int i, int j) { 298 void TiledLayerImpl::PushInvalidTile(int i, int j) {
303 DrawableTile* tile = TileAt(i, j); 299 DrawableTile* tile = TileAt(i, j);
304 if (!tile) 300 if (!tile)
(...skipping 10 matching lines...) Expand all
315 311
316 void TiledLayerImpl::ReleaseResources() { 312 void TiledLayerImpl::ReleaseResources() {
317 tiler_->reset(); 313 tiler_->reset();
318 } 314 }
319 315
320 const char* TiledLayerImpl::LayerTypeAsString() const { 316 const char* TiledLayerImpl::LayerTypeAsString() const {
321 return "cc::TiledLayerImpl"; 317 return "cc::TiledLayerImpl";
322 } 318 }
323 319
324 } // namespace cc 320 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/tiled_layer_impl.h ('k') | cc/layers/tiled_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698