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 #ifndef CC_RESOURCES_LAYER_TILING_DATA_H_ | 5 #ifndef CC_RESOURCES_LAYER_TILING_DATA_H_ |
6 #define CC_RESOURCES_LAYER_TILING_DATA_H_ | 6 #define CC_RESOURCES_LAYER_TILING_DATA_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 virtual ~Tile() {} | 57 virtual ~Tile() {} |
58 | 58 |
59 int i() const { return i_; } | 59 int i() const { return i_; } |
60 int j() const { return j_; } | 60 int j() const { return j_; } |
61 void move_to(int i, int j) { | 61 void move_to(int i, int j) { |
62 i_ = i; | 62 i_ = i; |
63 j_ = j; | 63 j_ = j; |
64 } | 64 } |
65 | 65 |
66 gfx::Rect opaque_rect() const { return opaque_rect_; } | 66 gfx::Rect opaque_rect() const { return opaque_rect_; } |
67 void set_opaque_rect(gfx::Rect opaque_rect) { opaque_rect_ = opaque_rect; } | 67 void set_opaque_rect(const gfx::Rect& opaque_rect) { |
| 68 opaque_rect_ = opaque_rect; |
| 69 } |
68 private: | 70 private: |
69 int i_; | 71 int i_; |
70 int j_; | 72 int j_; |
71 gfx::Rect opaque_rect_; | 73 gfx::Rect opaque_rect_; |
72 DISALLOW_COPY_AND_ASSIGN(Tile); | 74 DISALLOW_COPY_AND_ASSIGN(Tile); |
73 }; | 75 }; |
74 typedef std::pair<int, int> TileMapKey; | 76 typedef std::pair<int, int> TileMapKey; |
75 typedef base::ScopedPtrHashMap<TileMapKey, Tile> TileMap; | 77 typedef base::ScopedPtrHashMap<TileMapKey, Tile> TileMap; |
76 | 78 |
77 void AddTile(scoped_ptr<Tile> tile, int i, int j); | 79 void AddTile(scoped_ptr<Tile> tile, int i, int j); |
78 scoped_ptr<Tile> TakeTile(int i, int j); | 80 scoped_ptr<Tile> TakeTile(int i, int j); |
79 Tile* TileAt(int i, int j) const; | 81 Tile* TileAt(int i, int j) const; |
80 const TileMap& tiles() const { return tiles_; } | 82 const TileMap& tiles() const { return tiles_; } |
81 | 83 |
82 void SetBounds(gfx::Size size); | 84 void SetBounds(gfx::Size size); |
83 gfx::Size bounds() const { return tiling_data_.total_size(); } | 85 gfx::Size bounds() const { return tiling_data_.total_size(); } |
84 | 86 |
85 void ContentRectToTileIndices(gfx::Rect rect, | 87 void ContentRectToTileIndices(const gfx::Rect& rect, |
86 int* left, | 88 int* left, |
87 int* top, | 89 int* top, |
88 int* right, | 90 int* right, |
89 int* bottom) const; | 91 int* bottom) const; |
90 gfx::Rect TileRect(const Tile* tile) const; | 92 gfx::Rect TileRect(const Tile* tile) const; |
91 | 93 |
92 Region OpaqueRegionInContentRect(gfx::Rect rect) const; | 94 Region OpaqueRegionInContentRect(const gfx::Rect& rect) const; |
93 | 95 |
94 void reset() { tiles_.clear(); } | 96 void reset() { tiles_.clear(); } |
95 | 97 |
96 protected: | 98 protected: |
97 LayerTilingData(gfx::Size tile_size, BorderTexelOption option); | 99 LayerTilingData(gfx::Size tile_size, BorderTexelOption option); |
98 | 100 |
99 TileMap tiles_; | 101 TileMap tiles_; |
100 TilingData tiling_data_; | 102 TilingData tiling_data_; |
101 | 103 |
102 DISALLOW_COPY(LayerTilingData); | 104 DISALLOW_COPY(LayerTilingData); |
103 }; | 105 }; |
104 | 106 |
105 } // namespace cc | 107 } // namespace cc |
106 | 108 |
107 #endif // CC_RESOURCES_LAYER_TILING_DATA_H_ | 109 #endif // CC_RESOURCES_LAYER_TILING_DATA_H_ |
OLD | NEW |