| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Return the tile index whose non-border texels include src_position. | 45 // Return the tile index whose non-border texels include src_position. |
| 46 int TileXIndexFromSrcCoord(int src_position) const; | 46 int TileXIndexFromSrcCoord(int src_position) const; |
| 47 int TileYIndexFromSrcCoord(int src_position) const; | 47 int TileYIndexFromSrcCoord(int src_position) const; |
| 48 // Return the lowest tile index whose border texels include src_position. | 48 // Return the lowest tile index whose border texels include src_position. |
| 49 int FirstBorderTileXIndexFromSrcCoord(int src_position) const; | 49 int FirstBorderTileXIndexFromSrcCoord(int src_position) const; |
| 50 int FirstBorderTileYIndexFromSrcCoord(int src_position) const; | 50 int FirstBorderTileYIndexFromSrcCoord(int src_position) const; |
| 51 // Return the highest tile index whose border texels include src_position. | 51 // Return the highest tile index whose border texels include src_position. |
| 52 int LastBorderTileXIndexFromSrcCoord(int src_position) const; | 52 int LastBorderTileXIndexFromSrcCoord(int src_position) const; |
| 53 int LastBorderTileYIndexFromSrcCoord(int src_position) const; | 53 int LastBorderTileYIndexFromSrcCoord(int src_position) const; |
| 54 | 54 |
| 55 gfx::Rect ExpandRectIgnoringBordersToTileBoundsWithBorders( | 55 gfx::Rect ExpandRectIgnoringBordersToTileBounds(const gfx::Rect& rect) const; |
| 56 const gfx::Rect& rect) const; | |
| 57 gfx::Rect ExpandRectToTileBounds(const gfx::Rect& rect) const; | 56 gfx::Rect ExpandRectToTileBounds(const gfx::Rect& rect) const; |
| 58 | 57 |
| 59 gfx::Rect TileBounds(int i, int j) const; | 58 gfx::Rect TileBounds(int i, int j) const; |
| 60 gfx::Rect TileBoundsWithBorder(int i, int j) const; | 59 gfx::Rect TileBoundsWithBorder(int i, int j) const; |
| 61 int TilePositionX(int x_index) const; | 60 int TilePositionX(int x_index) const; |
| 62 int TilePositionY(int y_index) const; | 61 int TilePositionY(int y_index) const; |
| 63 int TileSizeX(int x_index) const; | 62 int TileSizeX(int x_index) const; |
| 64 int TileSizeY(int y_index) const; | 63 int TileSizeY(int y_index) const; |
| 65 | 64 |
| 66 // Difference between TileBound's and TileBoundWithBorder's origin(). | 65 // Difference between TileBound's and TileBoundWithBorder's origin(). |
| (...skipping 29 matching lines...) Expand all Loading... |
| 96 const gfx::Rect& consider_rect, | 95 const gfx::Rect& consider_rect, |
| 97 bool include_borders); | 96 bool include_borders); |
| 98 Iterator& operator++(); | 97 Iterator& operator++(); |
| 99 | 98 |
| 100 private: | 99 private: |
| 101 int left_; | 100 int left_; |
| 102 int right_; | 101 int right_; |
| 103 int bottom_; | 102 int bottom_; |
| 104 }; | 103 }; |
| 105 | 104 |
| 106 // Iterate through all indices whose bounds + border intersect with | 105 // Iterate through all indices whose bounds (not including borders) intersect |
| 107 // |consider| but which also do not intersect with |ignore|. | 106 // with |consider| but which also do not intersect with |ignore|. |
| 108 class CC_EXPORT DifferenceIterator : public BaseIterator { | 107 class CC_EXPORT DifferenceIterator : public BaseIterator { |
| 109 public: | 108 public: |
| 110 DifferenceIterator( | 109 DifferenceIterator(const TilingData* tiling_data, |
| 111 const TilingData* tiling_data, | 110 const gfx::Rect& consider_rect, |
| 112 const gfx::Rect& consider_rect, | 111 const gfx::Rect& ignore_rect); |
| 113 const gfx::Rect& ignore_rect); | |
| 114 DifferenceIterator& operator++(); | 112 DifferenceIterator& operator++(); |
| 115 | 113 |
| 116 private: | 114 private: |
| 117 bool in_ignore_rect() const { | 115 bool in_ignore_rect() const { |
| 118 return index_x_ >= ignore_left_ && index_x_ <= ignore_right_ && | 116 return index_x_ >= ignore_left_ && index_x_ <= ignore_right_ && |
| 119 index_y_ >= ignore_top_ && index_y_ <= ignore_bottom_; | 117 index_y_ >= ignore_top_ && index_y_ <= ignore_bottom_; |
| 120 } | 118 } |
| 121 | 119 |
| 122 int consider_left_; | 120 int consider_left_; |
| 123 int consider_top_; | 121 int consider_top_; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 int border_texels_; | 197 int border_texels_; |
| 200 | 198 |
| 201 // These are computed values. | 199 // These are computed values. |
| 202 int num_tiles_x_; | 200 int num_tiles_x_; |
| 203 int num_tiles_y_; | 201 int num_tiles_y_; |
| 204 }; | 202 }; |
| 205 | 203 |
| 206 } // namespace cc | 204 } // namespace cc |
| 207 | 205 |
| 208 #endif // CC_BASE_TILING_DATA_H_ | 206 #endif // CC_BASE_TILING_DATA_H_ |
| OLD | NEW |