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

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

Issue 136143004: cc: Remove TiledLayer mask DCHECK for 0 tiles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « no previous file | no next file » | 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 "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/debug/debug_colors.h" 10 #include "cc/debug/debug_colors.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* tree_impl, int id) 48 TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* tree_impl, int id)
49 : LayerImpl(tree_impl, id), skips_draw_(true) {} 49 : LayerImpl(tree_impl, id), skips_draw_(true) {}
50 50
51 TiledLayerImpl::~TiledLayerImpl() { 51 TiledLayerImpl::~TiledLayerImpl() {
52 } 52 }
53 53
54 ResourceProvider::ResourceId TiledLayerImpl::ContentsResourceId() const { 54 ResourceProvider::ResourceId TiledLayerImpl::ContentsResourceId() const {
55 // This function is only valid for single texture layers, e.g. masks. 55 // This function is only valid for single texture layers, e.g. masks.
56 DCHECK(tiler_); 56 DCHECK(tiler_);
57 // It's possible the mask layer is created but has no size or otherwise
58 // can't draw.
59 if (tiler_->num_tiles_x() == 0 || tiler_->num_tiles_y() == 0)
60 return 0;
61
62 // Any other number of tiles other than 0 or 1 is incorrect for masks.
57 DCHECK_EQ(tiler_->num_tiles_x(), 1); 63 DCHECK_EQ(tiler_->num_tiles_x(), 1);
58 DCHECK_EQ(tiler_->num_tiles_y(), 1); 64 DCHECK_EQ(tiler_->num_tiles_y(), 1);
59 65
60 DrawableTile* tile = TileAt(0, 0); 66 DrawableTile* tile = TileAt(0, 0);
61 ResourceProvider::ResourceId resource_id = tile ? tile->resource_id() : 0; 67 ResourceProvider::ResourceId resource_id = tile ? tile->resource_id() : 0;
62 return resource_id; 68 return resource_id;
63 } 69 }
64 70
65 bool TiledLayerImpl::HasTileAt(int i, int j) const { 71 bool TiledLayerImpl::HasTileAt(int i, int j) const {
66 return !!tiler_->TileAt(i, j); 72 return !!tiler_->TileAt(i, j);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 298
293 void TiledLayerImpl::ReleaseResources() { 299 void TiledLayerImpl::ReleaseResources() {
294 tiler_->reset(); 300 tiler_->reset();
295 } 301 }
296 302
297 const char* TiledLayerImpl::LayerTypeAsString() const { 303 const char* TiledLayerImpl::LayerTypeAsString() const {
298 return "cc::TiledLayerImpl"; 304 return "cc::TiledLayerImpl";
299 } 305 }
300 306
301 } // namespace cc 307 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698