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