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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.SetToMin(gfx::Size(max_size, max_size)); | 140 requested_size.SetToMin(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::Rect old_tiling_rect = tiler_->tiling_rect(); |
146 gfx::Size new_bounds = content_bounds(); | 146 gfx::Rect new_tiling_rect = gfx::Rect(content_bounds()); |
147 if (old_bounds == new_bounds) | 147 if (old_tiling_rect == new_tiling_rect) |
148 return; | 148 return; |
149 tiler_->SetBounds(new_bounds); | 149 tiler_->SetTilingRect(new_tiling_rect); |
150 | 150 |
151 // Invalidate any areas that the new bounds exposes. | 151 // Invalidate any areas that the new bounds exposes. |
152 Region old_region = gfx::Rect(old_bounds); | 152 Region old_region = old_tiling_rect; |
153 Region new_region = gfx::Rect(new_bounds); | 153 Region new_region = new_tiling_rect; |
154 new_region.Subtract(old_region); | 154 new_tiling_rect.Subtract(old_tiling_rect); |
155 for (Region::Iterator new_rects(new_region); | 155 for (Region::Iterator new_rects(new_tiling_rect); new_rects.has_rect(); |
156 new_rects.has_rect(); | |
157 new_rects.next()) | 156 new_rects.next()) |
158 InvalidateContentRect(new_rects.rect()); | 157 InvalidateContentRect(new_rects.rect()); |
159 } | 158 } |
160 | 159 |
161 void TiledLayer::SetTileSize(const gfx::Size& size) { | 160 void TiledLayer::SetTileSize(const gfx::Size& size) { |
162 tiler_->SetTileSize(size); | 161 tiler_->SetTileSize(size); |
163 } | 162 } |
164 | 163 |
165 void TiledLayer::SetBorderTexelOption( | 164 void TiledLayer::SetBorderTexelOption( |
166 LayerTilingData::BorderTexelOption border_texel_option) { | 165 LayerTilingData::BorderTexelOption border_texel_option) { |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 gfx::Rect prepaint_rect = visible_content_rect(); | 893 gfx::Rect prepaint_rect = visible_content_rect(); |
895 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, | 894 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, |
896 -tiler_->tile_size().height() * kPrepaintRows); | 895 -tiler_->tile_size().height() * kPrepaintRows); |
897 gfx::Rect content_rect(content_bounds()); | 896 gfx::Rect content_rect(content_bounds()); |
898 prepaint_rect.Intersect(content_rect); | 897 prepaint_rect.Intersect(content_rect); |
899 | 898 |
900 return prepaint_rect; | 899 return prepaint_rect; |
901 } | 900 } |
902 | 901 |
903 } // namespace cc | 902 } // namespace cc |
OLD | NEW |