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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 gfx::Rect tiling_bounds_rect(tiling_data_->tiling_size()); | 372 gfx::Rect tiling_bounds_rect(tiling_data_->tiling_size()); |
373 gfx::Rect consider(consider_rect); | 373 gfx::Rect consider(consider_rect); |
374 gfx::Rect ignore(ignore_rect); | 374 gfx::Rect ignore(ignore_rect); |
375 consider.Intersect(tiling_bounds_rect); | 375 consider.Intersect(tiling_bounds_rect); |
376 ignore.Intersect(tiling_bounds_rect); | 376 ignore.Intersect(tiling_bounds_rect); |
377 if (consider.IsEmpty()) { | 377 if (consider.IsEmpty()) { |
378 done(); | 378 done(); |
379 return; | 379 return; |
380 } | 380 } |
381 | 381 |
382 consider_left_ = | 382 consider_left_ = tiling_data_->TileXIndexFromSrcCoord(consider.x()); |
383 tiling_data_->FirstBorderTileXIndexFromSrcCoord(consider.x()); | 383 consider_top_ = tiling_data_->TileYIndexFromSrcCoord(consider.y()); |
384 consider_top_ = | 384 consider_right_ = tiling_data_->TileXIndexFromSrcCoord(consider.right() - 1); |
385 tiling_data_->FirstBorderTileYIndexFromSrcCoord(consider.y()); | |
386 consider_right_ = | |
387 tiling_data_->LastBorderTileXIndexFromSrcCoord(consider.right() - 1); | |
388 consider_bottom_ = | 385 consider_bottom_ = |
389 tiling_data_->LastBorderTileYIndexFromSrcCoord(consider.bottom() - 1); | 386 tiling_data_->TileYIndexFromSrcCoord(consider.bottom() - 1); |
390 | 387 |
391 if (!ignore.IsEmpty()) { | 388 if (!ignore.IsEmpty()) { |
392 ignore_left_ = | 389 ignore_left_ = tiling_data_->TileXIndexFromSrcCoord(ignore.x()); |
393 tiling_data_->FirstBorderTileXIndexFromSrcCoord(ignore.x()); | 390 ignore_top_ = tiling_data_->TileYIndexFromSrcCoord(ignore.y()); |
394 ignore_top_ = | 391 ignore_right_ = tiling_data_->TileXIndexFromSrcCoord(ignore.right() - 1); |
395 tiling_data_->FirstBorderTileYIndexFromSrcCoord(ignore.y()); | 392 ignore_bottom_ = tiling_data_->TileYIndexFromSrcCoord(ignore.bottom() - 1); |
396 ignore_right_ = | |
397 tiling_data_->LastBorderTileXIndexFromSrcCoord(ignore.right() - 1); | |
398 ignore_bottom_ = | |
399 tiling_data_->LastBorderTileYIndexFromSrcCoord(ignore.bottom() - 1); | |
400 | 393 |
401 // Clamp ignore indices to consider indices. | 394 // Clamp ignore indices to consider indices. |
402 ignore_left_ = std::max(ignore_left_, consider_left_); | 395 ignore_left_ = std::max(ignore_left_, consider_left_); |
403 ignore_top_ = std::max(ignore_top_, consider_top_); | 396 ignore_top_ = std::max(ignore_top_, consider_top_); |
404 ignore_right_ = std::min(ignore_right_, consider_right_); | 397 ignore_right_ = std::min(ignore_right_, consider_right_); |
405 ignore_bottom_ = std::min(ignore_bottom_, consider_bottom_); | 398 ignore_bottom_ = std::min(ignore_bottom_, consider_bottom_); |
406 } | 399 } |
407 | 400 |
408 if (ignore_left_ == consider_left_ && ignore_right_ == consider_right_ && | 401 if (ignore_left_ == consider_left_ && ignore_right_ == consider_right_ && |
409 ignore_top_ == consider_top_ && ignore_bottom_ == consider_bottom_) { | 402 ignore_top_ == consider_top_ && ignore_bottom_ == consider_bottom_) { |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 current_step_ = 0; | 665 current_step_ = 0; |
673 direction_ = static_cast<Direction>((direction_ + 1) % 4); | 666 direction_ = static_cast<Direction>((direction_ + 1) % 4); |
674 | 667 |
675 if (direction_ == RIGHT || direction_ == LEFT) { | 668 if (direction_ == RIGHT || direction_ == LEFT) { |
676 ++vertical_step_count_; | 669 ++vertical_step_count_; |
677 ++horizontal_step_count_; | 670 ++horizontal_step_count_; |
678 } | 671 } |
679 } | 672 } |
680 | 673 |
681 } // namespace cc | 674 } // namespace cc |
OLD | NEW |