| 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.h" | 5 #include "cc/layers/tiled_layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 skips_draw_(false), | 91 skips_draw_(false), |
| 92 failed_update_(false), | 92 failed_update_(false), |
| 93 tiling_option_(AUTO_TILE) { | 93 tiling_option_(AUTO_TILE) { |
| 94 tiler_ = | 94 tiler_ = |
| 95 LayerTilingData::Create(gfx::Size(), LayerTilingData::HAS_BORDER_TEXELS); | 95 LayerTilingData::Create(gfx::Size(), LayerTilingData::HAS_BORDER_TEXELS); |
| 96 } | 96 } |
| 97 | 97 |
| 98 TiledLayer::~TiledLayer() {} | 98 TiledLayer::~TiledLayer() {} |
| 99 | 99 |
| 100 scoped_ptr<LayerImpl> TiledLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 100 scoped_ptr<LayerImpl> TiledLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
| 101 return TiledLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 101 return TiledLayerImpl::Create(tree_impl, id()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void TiledLayer::UpdateTileSizeAndTilingOption() { | 104 void TiledLayer::UpdateTileSizeAndTilingOption() { |
| 105 DCHECK(layer_tree_host()); | 105 DCHECK(layer_tree_host()); |
| 106 | 106 |
| 107 gfx::Size default_tile_size = layer_tree_host()->settings().default_tile_size; | 107 gfx::Size default_tile_size = layer_tree_host()->settings().default_tile_size; |
| 108 gfx::Size max_untiled_layer_size = | 108 gfx::Size max_untiled_layer_size = |
| 109 layer_tree_host()->settings().max_untiled_layer_size; | 109 layer_tree_host()->settings().max_untiled_layer_size; |
| 110 int layer_width = content_bounds().width(); | 110 int layer_width = content_bounds().width(); |
| 111 int layer_height = content_bounds().height(); | 111 int layer_height = content_bounds().height(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 | 271 |
| 272 UpdatableTile* TiledLayer::CreateTile(int i, int j) { | 272 UpdatableTile* TiledLayer::CreateTile(int i, int j) { |
| 273 CreateUpdaterIfNeeded(); | 273 CreateUpdaterIfNeeded(); |
| 274 | 274 |
| 275 scoped_ptr<UpdatableTile> tile( | 275 scoped_ptr<UpdatableTile> tile( |
| 276 UpdatableTile::Create(Updater()->CreateResource(ResourceManager()))); | 276 UpdatableTile::Create(Updater()->CreateResource(ResourceManager()))); |
| 277 tile->managed_resource()->SetDimensions(tiler_->tile_size(), texture_format_); | 277 tile->managed_resource()->SetDimensions(tiler_->tile_size(), texture_format_); |
| 278 | 278 |
| 279 UpdatableTile* added_tile = tile.get(); | 279 UpdatableTile* added_tile = tile.get(); |
| 280 tiler_->AddTile(tile.PassAs<LayerTilingData::Tile>(), i, j); | 280 tiler_->AddTile(tile.Pass(), i, j); |
| 281 | 281 |
| 282 added_tile->dirty_rect = tiler_->TileRect(added_tile); | 282 added_tile->dirty_rect = tiler_->TileRect(added_tile); |
| 283 | 283 |
| 284 // Temporary diagnostic crash. | 284 // Temporary diagnostic crash. |
| 285 CHECK(added_tile); | 285 CHECK(added_tile); |
| 286 CHECK(TileAt(i, j)); | 286 CHECK(TileAt(i, j)); |
| 287 | 287 |
| 288 return added_tile; | 288 return added_tile; |
| 289 } | 289 } |
| 290 | 290 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 gfx::Rect prepaint_rect = visible_content_rect(); | 863 gfx::Rect prepaint_rect = visible_content_rect(); |
| 864 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, | 864 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, |
| 865 -tiler_->tile_size().height() * kPrepaintRows); | 865 -tiler_->tile_size().height() * kPrepaintRows); |
| 866 gfx::Rect content_rect(content_bounds()); | 866 gfx::Rect content_rect(content_bounds()); |
| 867 prepaint_rect.Intersect(content_rect); | 867 prepaint_rect.Intersect(content_rect); |
| 868 | 868 |
| 869 return prepaint_rect; | 869 return prepaint_rect; |
| 870 } | 870 } |
| 871 | 871 |
| 872 } // namespace cc | 872 } // namespace cc |
| OLD | NEW |