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 #include "cc/layers/tiled_layer.h" | 5 #include "cc/layers/tiled_layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 ++iter) { | 679 ++iter) { |
680 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); | 680 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); |
681 // TODO(enne): This should not ever be null. | 681 // TODO(enne): This should not ever be null. |
682 if (!tile) | 682 if (!tile) |
683 continue; | 683 continue; |
684 tile->ResetUpdateState(); | 684 tile->ResetUpdateState(); |
685 } | 685 } |
686 } | 686 } |
687 | 687 |
688 namespace { | 688 namespace { |
689 gfx::Rect ExpandRectByDelta(const gfx::Rect& rect, gfx::Vector2d delta) { | 689 gfx::Rect ExpandRectByDelta(const gfx::Rect& rect, const gfx::Vector2d& delta) { |
690 int width = rect.width() + std::abs(delta.x()); | 690 int width = rect.width() + std::abs(delta.x()); |
691 int height = rect.height() + std::abs(delta.y()); | 691 int height = rect.height() + std::abs(delta.y()); |
692 int x = rect.x() + ((delta.x() < 0) ? delta.x() : 0); | 692 int x = rect.x() + ((delta.x() < 0) ? delta.x() : 0); |
693 int y = rect.y() + ((delta.y() < 0) ? delta.y() : 0); | 693 int y = rect.y() + ((delta.y() < 0) ? delta.y() : 0); |
694 return gfx::Rect(x, y, width, height); | 694 return gfx::Rect(x, y, width, height); |
695 } | 695 } |
696 } | 696 } |
697 | 697 |
698 void TiledLayer::UpdateScrollPrediction() { | 698 void TiledLayer::UpdateScrollPrediction() { |
699 // This scroll prediction is very primitive and should be replaced by a | 699 // This scroll prediction is very primitive and should be replaced by a |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 gfx::Rect prepaint_rect = visible_content_rect(); | 913 gfx::Rect prepaint_rect = visible_content_rect(); |
914 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, | 914 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, |
915 -tiler_->tile_size().height() * kPrepaintRows); | 915 -tiler_->tile_size().height() * kPrepaintRows); |
916 gfx::Rect content_rect(content_bounds()); | 916 gfx::Rect content_rect(content_bounds()); |
917 prepaint_rect.Intersect(content_rect); | 917 prepaint_rect.Intersect(content_rect); |
918 | 918 |
919 return prepaint_rect; | 919 return prepaint_rect; |
920 } | 920 } |
921 | 921 |
922 } // namespace cc | 922 } // namespace cc |
OLD | NEW |