Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: cc/layers/tiled_layer.cc

Issue 132163009: [#6]Pass gfx structs by const ref (gfx::Vector2d) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698