| 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 #ifndef CC_BASE_TILING_DATA_H_ | 5 #ifndef CC_BASE_TILING_DATA_H_ |
| 6 #define CC_BASE_TILING_DATA_H_ | 6 #define CC_BASE_TILING_DATA_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Vector2d; | 17 class Vector2d; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class CC_EXPORT TilingData { | 22 class CC_EXPORT TilingData { |
| 23 public: | 23 public: |
| 24 TilingData(); | 24 TilingData(); |
| 25 TilingData( | 25 TilingData( |
| 26 const gfx::Size& max_texture_size, | 26 const gfx::Size& max_texture_size, |
| 27 const gfx::Size& total_size, | 27 const gfx::Rect& tiling_rect, |
| 28 bool has_border_texels); | 28 bool has_border_texels); |
| 29 TilingData( | 29 TilingData( |
| 30 const gfx::Size& max_texture_size, | 30 const gfx::Size& max_texture_size, |
| 31 const gfx::Size& total_size, | 31 const gfx::Rect& tiling_rect, |
| 32 int border_texels); | 32 int border_texels); |
| 33 | 33 |
| 34 gfx::Size total_size() const { return total_size_; } | 34 gfx::Rect tiling_rect() const { return tiling_rect_; } |
| 35 void SetTotalSize(const gfx::Size& total_size); | 35 void SetTilingRect(const gfx::Rect& tiling_rect); |
| 36 | 36 |
| 37 gfx::Size max_texture_size() const { return max_texture_size_; } | 37 gfx::Size max_texture_size() const { return max_texture_size_; } |
| 38 void SetMaxTextureSize(const gfx::Size& max_texture_size); | 38 void SetMaxTextureSize(const gfx::Size& max_texture_size); |
| 39 | 39 |
| 40 int border_texels() const { return border_texels_; } | 40 int border_texels() const { return border_texels_; } |
| 41 void SetHasBorderTexels(bool has_border_texels); | 41 void SetHasBorderTexels(bool has_border_texels); |
| 42 void SetBorderTexels(int border_texels); | 42 void SetBorderTexels(int border_texels); |
| 43 | 43 |
| 44 bool has_empty_bounds() const { return !num_tiles_x_ || !num_tiles_y_; } | 44 bool has_empty_bounds() const { return !num_tiles_x_ || !num_tiles_y_; } |
| 45 int num_tiles_x() const { return num_tiles_x_; } | 45 int num_tiles_x() const { return num_tiles_x_; } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void AssertTile(int i, int j) const { | 186 void AssertTile(int i, int j) const { |
| 187 DCHECK_GE(i, 0); | 187 DCHECK_GE(i, 0); |
| 188 DCHECK_LT(i, num_tiles_x_); | 188 DCHECK_LT(i, num_tiles_x_); |
| 189 DCHECK_GE(j, 0); | 189 DCHECK_GE(j, 0); |
| 190 DCHECK_LT(j, num_tiles_y_); | 190 DCHECK_LT(j, num_tiles_y_); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void RecomputeNumTiles(); | 193 void RecomputeNumTiles(); |
| 194 | 194 |
| 195 gfx::Size max_texture_size_; | 195 gfx::Size max_texture_size_; |
| 196 gfx::Size total_size_; | 196 gfx::Rect tiling_rect_; |
| 197 int border_texels_; | 197 int border_texels_; |
| 198 | 198 |
| 199 // These are computed values. | 199 // These are computed values. |
| 200 int num_tiles_x_; | 200 int num_tiles_x_; |
| 201 int num_tiles_y_; | 201 int num_tiles_y_; |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 } // namespace cc | 204 } // namespace cc |
| 205 | 205 |
| 206 #endif // CC_BASE_TILING_DATA_H_ | 206 #endif // CC_BASE_TILING_DATA_H_ |
| OLD | NEW |