Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | |
|
tfarina
2012/11/02 00:19:07
2010 -> 2012?
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_TILING_DATA_H_ | |
| 6 #define CC_TILING_DATA_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/logging.h" | |
| 10 #include "ui/gfx/size.h" | |
| 11 | |
| 12 namespace gfx { | |
| 13 class Rect; | |
| 14 class Vector2d; | |
| 15 } | |
| 16 | |
| 17 namespace cc { | |
| 18 | |
| 19 class TilingData { | |
| 20 public: | |
| 21 TilingData(gfx::Size max_texture_size, gfx::Size total_size, bool has_border_t exels); | |
| 22 ~TilingData(); | |
| 23 | |
| 24 gfx::Size total_size() const { return total_size_; } | |
|
tfarina
2012/11/02 00:18:46
const-ref as well.
danakj
2012/11/02 00:28:03
no const ref for <= 4 ints :)
| |
| 25 void SetTotalSize(const gfx::Size total_size); | |
|
tfarina
2012/11/02 00:18:46
const-ref!
| |
| 26 | |
| 27 gfx::Size max_texture_size() const { return max_texture_size_; } | |
| 28 void SetMaxTextureSize(gfx::Size max_texture_size); | |
|
tfarina
2012/11/02 00:18:46
const-ref!
Same at the ctor!
| |
| 29 | |
| 30 int border_texels() const { return border_texels_; } | |
| 31 void SetHasBorderTexels(bool has_border_texels); | |
| 32 | |
| 33 bool has_empty_bounds() const { return !num_tiles_x_ || !num_tiles_y_; } | |
| 34 int num_tiles_x() const { return num_tiles_x_; } | |
| 35 int num_tiles_y() const { return num_tiles_y_; } | |
| 36 int TileXIndexFromSrcCoord(int src_position) const; | |
| 37 int TileYIndexFromSrcCoord(int src_position) const; | |
| 38 | |
| 39 gfx::Rect TileBounds(int i, int j) const; | |
| 40 gfx::Rect TileBoundsWithBorder(int i, int j) const; | |
| 41 int TilePositionX(int x_index) const; | |
| 42 int TilePositionY(int y_index) const; | |
| 43 int TileSizeX(int x_index) const; | |
| 44 int TileSizeY(int y_index) const; | |
| 45 | |
| 46 // Difference between TileBound's and TileBoundWithBorder's origin(). | |
| 47 gfx::Vector2d TextureOffset(int x_index, int y_index) const; | |
| 48 | |
| 49 private: | |
| 50 void AssertTile(int i, int j) const { | |
| 51 DCHECK_GE(i, 0); | |
| 52 DCHECK_LT(i, num_tiles_x_); | |
| 53 DCHECK_GE(j, 0); | |
| 54 DCHECK_LT(j, num_tiles_y_); | |
| 55 } | |
| 56 | |
| 57 void RecomputeNumTiles(); | |
| 58 | |
| 59 gfx::Size max_texture_size_; | |
| 60 gfx::Size total_size_; | |
| 61 // This value is always 0 or 1. | |
| 62 int border_texels_; | |
| 63 | |
| 64 // These are computed values. | |
| 65 int num_tiles_x_; | |
| 66 int num_tiles_y_; | |
| 67 }; | |
| 68 | |
| 69 } // namespace cc | |
| 70 | |
| 71 #endif // CC_TILING_DATA_H_ | |
| OLD | NEW |