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

Side by Side Diff: cc/resources/priority_calculator.cc

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! 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
« no previous file with comments | « cc/resources/priority_calculator.h ('k') | cc/resources/raster_worker_pool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/priority_calculator.h" 5 #include "cc/resources/priority_calculator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/gfx/rect.h" 9 #include "ui/gfx/rect.h"
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 // static 63 // static
64 int PriorityCalculator::LingeringPriority(int previous_priority) { 64 int PriorityCalculator::LingeringPriority(int previous_priority) {
65 // TODO(reveman): We should remove this once we have priorities for all 65 // TODO(reveman): We should remove this once we have priorities for all
66 // textures (we can't currently calculate distances for off-screen textures). 66 // textures (we can't currently calculate distances for off-screen textures).
67 return std::min(kLingeringLimitPriority, 67 return std::min(kLingeringLimitPriority,
68 std::max(kLingeringBasePriority, previous_priority + 1)); 68 std::max(kLingeringBasePriority, previous_priority + 1));
69 } 69 }
70 70
71 // static 71 // static
72 int PriorityCalculator::PriorityFromDistance(gfx::Rect visible_rect, 72 int PriorityCalculator::PriorityFromDistance(const gfx::Rect& visible_rect,
73 gfx::Rect texture_rect, 73 const gfx::Rect& texture_rect,
74 bool draws_to_root_surface) { 74 bool draws_to_root_surface) {
75 int distance = visible_rect.ManhattanInternalDistance(texture_rect); 75 int distance = visible_rect.ManhattanInternalDistance(texture_rect);
76 if (!distance) 76 if (!distance)
77 return VisiblePriority(draws_to_root_surface); 77 return VisiblePriority(draws_to_root_surface);
78 return std::min(kNotVisibleLimitPriority, kNotVisibleBasePriority + distance); 78 return std::min(kNotVisibleLimitPriority, kNotVisibleBasePriority + distance);
79 } 79 }
80 80
81 // static 81 // static
82 int PriorityCalculator::SmallAnimatedLayerMinPriority() { 82 int PriorityCalculator::SmallAnimatedLayerMinPriority() {
83 return kSmallAnimatedLayerPriority; 83 return kSmallAnimatedLayerPriority;
(...skipping 23 matching lines...) Expand all
107 int PriorityCalculator::AllowVisibleAndNearbyCutoff() { 107 int PriorityCalculator::AllowVisibleAndNearbyCutoff() {
108 return kVisibleAndNearbyPriorityCutoff; 108 return kVisibleAndNearbyPriorityCutoff;
109 } 109 }
110 110
111 // static 111 // static
112 int PriorityCalculator::AllowEverythingCutoff() { 112 int PriorityCalculator::AllowEverythingCutoff() {
113 return kEverythingPriorityCutoff; 113 return kEverythingPriorityCutoff;
114 } 114 }
115 115
116 } // namespace cc 116 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/priority_calculator.h ('k') | cc/resources/raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698