| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (tiling_option_ == ALWAYS_TILE) | 130 if (tiling_option_ == ALWAYS_TILE) |
| 131 is_tiled = true; | 131 is_tiled = true; |
| 132 else if (tiling_option_ == NEVER_TILE) | 132 else if (tiling_option_ == NEVER_TILE) |
| 133 is_tiled = false; | 133 is_tiled = false; |
| 134 else | 134 else |
| 135 is_tiled = auto_tiled; | 135 is_tiled = auto_tiled; |
| 136 | 136 |
| 137 gfx::Size requested_size = is_tiled ? tile_size : content_bounds(); | 137 gfx::Size requested_size = is_tiled ? tile_size : content_bounds(); |
| 138 const int max_size = | 138 const int max_size = |
| 139 layer_tree_host()->GetRendererCapabilities().max_texture_size; | 139 layer_tree_host()->GetRendererCapabilities().max_texture_size; |
| 140 requested_size.ClampToMax(gfx::Size(max_size, max_size)); | 140 requested_size.ClampToUpperBound(gfx::Size(max_size, max_size)); |
| 141 SetTileSize(requested_size); | 141 SetTileSize(requested_size); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void TiledLayer::UpdateBounds() { | 144 void TiledLayer::UpdateBounds() { |
| 145 gfx::Size old_bounds = tiler_->bounds(); | 145 gfx::Size old_bounds = tiler_->bounds(); |
| 146 gfx::Size new_bounds = content_bounds(); | 146 gfx::Size new_bounds = content_bounds(); |
| 147 if (old_bounds == new_bounds) | 147 if (old_bounds == new_bounds) |
| 148 return; | 148 return; |
| 149 tiler_->SetBounds(new_bounds); | 149 tiler_->SetBounds(new_bounds); |
| 150 | 150 |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 gfx::Rect prepaint_rect = visible_content_rect(); | 884 gfx::Rect prepaint_rect = visible_content_rect(); |
| 885 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, | 885 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, |
| 886 -tiler_->tile_size().height() * kPrepaintRows); | 886 -tiler_->tile_size().height() * kPrepaintRows); |
| 887 gfx::Rect content_rect(content_bounds()); | 887 gfx::Rect content_rect(content_bounds()); |
| 888 prepaint_rect.Intersect(content_rect); | 888 prepaint_rect.Intersect(content_rect); |
| 889 | 889 |
| 890 return prepaint_rect; | 890 return prepaint_rect; |
| 891 } | 891 } |
| 892 | 892 |
| 893 } // namespace cc | 893 } // namespace cc |
| OLD | NEW |