| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return 0; | 131 return 0; |
| 132 | 132 |
| 133 src_position -= tiling_rect_.y(); | 133 src_position -= tiling_rect_.y(); |
| 134 | 134 |
| 135 DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0); | 135 DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0); |
| 136 int inner_tile_size = max_texture_size_.height() - 2 * border_texels_; | 136 int inner_tile_size = max_texture_size_.height() - 2 * border_texels_; |
| 137 int y = src_position / inner_tile_size; | 137 int y = src_position / inner_tile_size; |
| 138 return std::min(std::max(y, 0), num_tiles_y_ - 1); | 138 return std::min(std::max(y, 0), num_tiles_y_ - 1); |
| 139 } | 139 } |
| 140 | 140 |
| 141 gfx::Rect TilingData::ExpandRectToTileBoundsWithBorders( | 141 gfx::Rect TilingData::ExpandRectIgnoringBordersToTileBoundsWithBorders( |
| 142 const gfx::Rect& rect) const { | 142 const gfx::Rect& rect) const { |
| 143 if (!rect.Intersects(tiling_rect_) || has_empty_bounds()) | 143 if (!rect.Intersects(tiling_rect_) || has_empty_bounds()) |
| 144 return gfx::Rect(); | 144 return gfx::Rect(); |
| 145 int index_x = FirstBorderTileXIndexFromSrcCoord(rect.x()); | 145 int index_x = TileXIndexFromSrcCoord(rect.x()); |
| 146 int index_y = FirstBorderTileYIndexFromSrcCoord(rect.y()); | 146 int index_y = TileYIndexFromSrcCoord(rect.y()); |
| 147 int index_right = LastBorderTileXIndexFromSrcCoord(rect.right() - 1); | 147 int index_right = TileXIndexFromSrcCoord(rect.right() - 1); |
| 148 int index_bottom = LastBorderTileYIndexFromSrcCoord(rect.bottom() - 1); | 148 int index_bottom = TileYIndexFromSrcCoord(rect.bottom() - 1); |
| 149 | 149 |
| 150 gfx::Rect rect_top_left(TileBoundsWithBorder(index_x, index_y)); | 150 gfx::Rect rect_top_left(TileBoundsWithBorder(index_x, index_y)); |
| 151 gfx::Rect rect_bottom_right(TileBoundsWithBorder(index_right, index_bottom)); | 151 gfx::Rect rect_bottom_right(TileBoundsWithBorder(index_right, index_bottom)); |
| 152 | 152 |
| 153 return gfx::UnionRects(rect_top_left, rect_bottom_right); | 153 return gfx::UnionRects(rect_top_left, rect_bottom_right); |
| 154 } | 154 } |
| 155 | 155 |
| 156 gfx::Rect TilingData::ExpandRectToTileBounds(const gfx::Rect& rect) const { | 156 gfx::Rect TilingData::ExpandRectToTileBounds(const gfx::Rect& rect) const { |
| 157 if (!rect.Intersects(tiling_rect_) || has_empty_bounds()) | 157 if (!rect.Intersects(tiling_rect_) || has_empty_bounds()) |
| 158 return gfx::Rect(); | 158 return gfx::Rect(); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 current_step_ = 0; | 681 current_step_ = 0; |
| 682 direction_ = static_cast<Direction>((direction_ + 1) % 4); | 682 direction_ = static_cast<Direction>((direction_ + 1) % 4); |
| 683 | 683 |
| 684 if (direction_ == RIGHT || direction_ == LEFT) { | 684 if (direction_ == RIGHT || direction_ == LEFT) { |
| 685 ++vertical_step_count_; | 685 ++vertical_step_count_; |
| 686 ++horizontal_step_count_; | 686 ++horizontal_step_count_; |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 | 689 |
| 690 } // namespace cc | 690 } // namespace cc |
| OLD | NEW |