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

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

Issue 659683002: Include mask texture size in RenderPassDrawQuad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_mask_draw_quad_test
Patch Set: No ToEnclosedRect Created 6 years, 2 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/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 DISALLOW_COPY_AND_ASSIGN(DrawableTile); 47 DISALLOW_COPY_AND_ASSIGN(DrawableTile);
48 }; 48 };
49 49
50 TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* tree_impl, int id) 50 TiledLayerImpl::TiledLayerImpl(LayerTreeImpl* tree_impl, int id)
51 : LayerImpl(tree_impl, id), skips_draw_(true) {} 51 : LayerImpl(tree_impl, id), skips_draw_(true) {}
52 52
53 TiledLayerImpl::~TiledLayerImpl() { 53 TiledLayerImpl::~TiledLayerImpl() {
54 } 54 }
55 55
56 ResourceProvider::ResourceId TiledLayerImpl::ContentsResourceId() const { 56 void TiledLayerImpl::GetContentsResourceId(
57 ResourceProvider::ResourceId* resource_id,
58 gfx::Size* resource_size) const {
57 // This function is only valid for single texture layers, e.g. masks. 59 // This function is only valid for single texture layers, e.g. masks.
58 DCHECK(tiler_); 60 DCHECK(tiler_);
59 // It's possible the mask layer is created but has no size or otherwise 61 // It's possible the mask layer is created but has no size or otherwise
60 // can't draw. 62 // can't draw.
61 if (tiler_->num_tiles_x() == 0 || tiler_->num_tiles_y() == 0) 63 if (tiler_->num_tiles_x() == 0 || tiler_->num_tiles_y() == 0) {
62 return 0; 64 *resource_id = 0;
65 return;
66 }
63 67
64 // Any other number of tiles other than 0 or 1 is incorrect for masks. 68 // Any other number of tiles other than 0 or 1 is incorrect for masks.
65 DCHECK_EQ(tiler_->num_tiles_x(), 1); 69 DCHECK_EQ(tiler_->num_tiles_x(), 1);
66 DCHECK_EQ(tiler_->num_tiles_y(), 1); 70 DCHECK_EQ(tiler_->num_tiles_y(), 1);
67 71
68 DrawableTile* tile = TileAt(0, 0); 72 DrawableTile* tile = TileAt(0, 0);
69 ResourceProvider::ResourceId resource_id = tile ? tile->resource_id() : 0; 73 *resource_id = tile ? tile->resource_id() : 0;
70 return resource_id; 74 *resource_size = tiler_->tile_size();
71 } 75 }
72 76
73 bool TiledLayerImpl::HasTileAt(int i, int j) const { 77 bool TiledLayerImpl::HasTileAt(int i, int j) const {
74 return !!tiler_->TileAt(i, j); 78 return !!tiler_->TileAt(i, j);
75 } 79 }
76 80
77 bool TiledLayerImpl::HasResourceIdForTileAt(int i, int j) const { 81 bool TiledLayerImpl::HasResourceIdForTileAt(int i, int j) const {
78 return HasTileAt(i, j) && TileAt(i, j)->resource_id(); 82 return HasTileAt(i, j) && TileAt(i, j)->resource_id();
79 } 83 }
80 84
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 307
304 void TiledLayerImpl::ReleaseResources() { 308 void TiledLayerImpl::ReleaseResources() {
305 tiler_->reset(); 309 tiler_->reset();
306 } 310 }
307 311
308 const char* TiledLayerImpl::LayerTypeAsString() const { 312 const char* TiledLayerImpl::LayerTypeAsString() const {
309 return "cc::TiledLayerImpl"; 313 return "cc::TiledLayerImpl";
310 } 314 }
311 315
312 } // namespace cc 316 } // 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