| 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 11 matching lines...) Expand all Loading... |
| 22 (max_texture_size - 2 * border_texels)); | 22 (max_texture_size - 2 * border_texels)); |
| 23 return total_size > 0 ? num_tiles : 0; | 23 return total_size > 0 ? num_tiles : 0; |
| 24 } | 24 } |
| 25 | 25 |
| 26 TilingData::TilingData() | 26 TilingData::TilingData() |
| 27 : border_texels_(0) { | 27 : border_texels_(0) { |
| 28 RecomputeNumTiles(); | 28 RecomputeNumTiles(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 TilingData::TilingData( | 31 TilingData::TilingData( |
| 32 gfx::Size max_texture_size, | 32 const gfx::Size& max_texture_size, |
| 33 gfx::Size total_size, | 33 const gfx::Size& total_size, |
| 34 bool has_border_texels) | 34 bool has_border_texels) |
| 35 : max_texture_size_(max_texture_size), | 35 : max_texture_size_(max_texture_size), |
| 36 total_size_(total_size), | 36 total_size_(total_size), |
| 37 border_texels_(has_border_texels ? 1 : 0) { | 37 border_texels_(has_border_texels ? 1 : 0) { |
| 38 RecomputeNumTiles(); | 38 RecomputeNumTiles(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 TilingData::TilingData( | 41 TilingData::TilingData( |
| 42 gfx::Size max_texture_size, | 42 const gfx::Size& max_texture_size, |
| 43 gfx::Size total_size, | 43 const gfx::Size& total_size, |
| 44 int border_texels) | 44 int border_texels) |
| 45 : max_texture_size_(max_texture_size), | 45 : max_texture_size_(max_texture_size), |
| 46 total_size_(total_size), | 46 total_size_(total_size), |
| 47 border_texels_(border_texels) { | 47 border_texels_(border_texels) { |
| 48 RecomputeNumTiles(); | 48 RecomputeNumTiles(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void TilingData::SetTotalSize(gfx::Size total_size) { | 51 void TilingData::SetTotalSize(const gfx::Size& total_size) { |
| 52 total_size_ = total_size; | 52 total_size_ = total_size; |
| 53 RecomputeNumTiles(); | 53 RecomputeNumTiles(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void TilingData::SetMaxTextureSize(gfx::Size max_texture_size) { | 56 void TilingData::SetMaxTextureSize(const gfx::Size& max_texture_size) { |
| 57 max_texture_size_ = max_texture_size; | 57 max_texture_size_ = max_texture_size; |
| 58 RecomputeNumTiles(); | 58 RecomputeNumTiles(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void TilingData::SetHasBorderTexels(bool has_border_texels) { | 61 void TilingData::SetHasBorderTexels(bool has_border_texels) { |
| 62 border_texels_ = has_border_texels ? 1 : 0; | 62 border_texels_ = has_border_texels ? 1 : 0; |
| 63 RecomputeNumTiles(); | 63 RecomputeNumTiles(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void TilingData::SetBorderTexels(int border_texels) { | 66 void TilingData::SetBorderTexels(int border_texels) { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 403 } |
| 404 | 404 |
| 405 if (index_y_ > consider_bottom_) | 405 if (index_y_ > consider_bottom_) |
| 406 done(); | 406 done(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 return *this; | 409 return *this; |
| 410 } | 410 } |
| 411 | 411 |
| 412 } // namespace cc | 412 } // namespace cc |
| OLD | NEW |