OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/base/tiling_data.h" | 5 #include "cc/base/tiling_data.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/vector2d.h" | 10 #include "ui/gfx/vector2d.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 | 250 |
251 gfx::Vector2d TilingData::TextureOffset(int x_index, int y_index) const { | 251 gfx::Vector2d TilingData::TextureOffset(int x_index, int y_index) const { |
252 int left = (!x_index || num_tiles_x_ == 1) ? 0 : border_texels_; | 252 int left = (!x_index || num_tiles_x_ == 1) ? 0 : border_texels_; |
253 int top = (!y_index || num_tiles_y_ == 1) ? 0 : border_texels_; | 253 int top = (!y_index || num_tiles_y_ == 1) ? 0 : border_texels_; |
254 | 254 |
255 return gfx::Vector2d(left, top); | 255 return gfx::Vector2d(left, top); |
256 } | 256 } |
257 | 257 |
258 void TilingData::RecomputeNumTiles() { | 258 void TilingData::RecomputeNumTiles() { |
259 num_tiles_x_ = ComputeNumTiles(max_texture_size_.width(), total_size_.width(),
border_texels_); | 259 num_tiles_x_ = ComputeNumTiles( |
260 num_tiles_y_ = ComputeNumTiles(max_texture_size_.height(), total_size_.height(
), border_texels_); | 260 max_texture_size_.width(), total_size_.width(), border_texels_); |
| 261 num_tiles_y_ = ComputeNumTiles( |
| 262 max_texture_size_.height(), total_size_.height(), border_texels_); |
261 } | 263 } |
262 | 264 |
263 TilingData::BaseIterator::BaseIterator(const TilingData* tiling_data) | 265 TilingData::BaseIterator::BaseIterator(const TilingData* tiling_data) |
264 : tiling_data_(tiling_data), | 266 : tiling_data_(tiling_data), |
265 index_x_(-1), | 267 index_x_(-1), |
266 index_y_(-1) { | 268 index_y_(-1) { |
267 } | 269 } |
268 | 270 |
269 TilingData::Iterator::Iterator(const TilingData* tiling_data, gfx::Rect rect) | 271 TilingData::Iterator::Iterator(const TilingData* tiling_data, gfx::Rect rect) |
270 : BaseIterator(tiling_data), | 272 : BaseIterator(tiling_data), |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 395 } |
394 | 396 |
395 if (index_y_ > consider_bottom_) | 397 if (index_y_ > consider_bottom_) |
396 done(); | 398 done(); |
397 } | 399 } |
398 | 400 |
399 return *this; | 401 return *this; |
400 } | 402 } |
401 | 403 |
402 } // namespace cc | 404 } // namespace cc |
OLD | NEW |