| OLD | NEW |
| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // offset the same amount. | 253 // offset the same amount. |
| 254 gfx::Vector2d display_offset = tile_rect.origin() - display_rect.origin(); | 254 gfx::Vector2d display_offset = tile_rect.origin() - display_rect.origin(); |
| 255 gfx::Vector2d texture_offset = | 255 gfx::Vector2d texture_offset = |
| 256 tiler_->texture_offset(i, j) + display_offset; | 256 tiler_->texture_offset(i, j) + display_offset; |
| 257 gfx::RectF tex_coord_rect = gfx::RectF(tile_rect.size()) + texture_offset; | 257 gfx::RectF tex_coord_rect = gfx::RectF(tile_rect.size()) + texture_offset; |
| 258 | 258 |
| 259 float tile_width = static_cast<float>(tiler_->tile_size().width()); | 259 float tile_width = static_cast<float>(tiler_->tile_size().width()); |
| 260 float tile_height = static_cast<float>(tiler_->tile_size().height()); | 260 float tile_height = static_cast<float>(tiler_->tile_size().height()); |
| 261 gfx::Size texture_size(tile_width, tile_height); | 261 gfx::Size texture_size(tile_width, tile_height); |
| 262 | 262 |
| 263 // TODO(danakj): crbug.com/455931 | |
| 264 layer_tree_impl()->resource_provider()->ValidateResource( | |
| 265 tile->resource_id()); | |
| 266 TileDrawQuad* quad = render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); | 263 TileDrawQuad* quad = render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); |
| 267 quad->SetNew(shared_quad_state, | 264 quad->SetNew(shared_quad_state, |
| 268 tile_rect, | 265 tile_rect, |
| 269 tile_opaque_rect, | 266 tile_opaque_rect, |
| 270 visible_tile_rect, | 267 visible_tile_rect, |
| 271 tile->resource_id(), | 268 tile->resource_id(), |
| 272 tex_coord_rect, | 269 tex_coord_rect, |
| 273 texture_size, | 270 texture_size, |
| 274 tile->contents_swizzled(), | 271 tile->contents_swizzled(), |
| 275 false); | 272 false); |
| 273 ValidateQuadResources(quad); |
| 276 } | 274 } |
| 277 } | 275 } |
| 278 } | 276 } |
| 279 | 277 |
| 280 void TiledLayerImpl::SetTilingData(const LayerTilingData& tiler) { | 278 void TiledLayerImpl::SetTilingData(const LayerTilingData& tiler) { |
| 281 if (tiler_) { | 279 if (tiler_) { |
| 282 tiler_->reset(); | 280 tiler_->reset(); |
| 283 } else { | 281 } else { |
| 284 tiler_ = LayerTilingData::Create(tiler.tile_size(), | 282 tiler_ = LayerTilingData::Create(tiler.tile_size(), |
| 285 tiler.has_border_texels() | 283 tiler.has_border_texels() |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 315 |
| 318 void TiledLayerImpl::ReleaseResources() { | 316 void TiledLayerImpl::ReleaseResources() { |
| 319 tiler_->reset(); | 317 tiler_->reset(); |
| 320 } | 318 } |
| 321 | 319 |
| 322 const char* TiledLayerImpl::LayerTypeAsString() const { | 320 const char* TiledLayerImpl::LayerTypeAsString() const { |
| 323 return "cc::TiledLayerImpl"; | 321 return "cc::TiledLayerImpl"; |
| 324 } | 322 } |
| 325 | 323 |
| 326 } // namespace cc | 324 } // namespace cc |
| OLD | NEW |