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

Side by Side Diff: cc/priority_calculator.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some missed intstuff Created 8 years, 1 month 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/priority_calculator.h" 7 #include "cc/priority_calculator.h"
8 8
9 using namespace std; 9 using namespace std;
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 int PriorityCalculator::lingeringPriority(int previousPriority) 60 int PriorityCalculator::lingeringPriority(int previousPriority)
61 { 61 {
62 // FIXME: We should remove this once we have priorities for all 62 // FIXME: We should remove this once we have priorities for all
63 // textures (we can't currently calculate distances for 63 // textures (we can't currently calculate distances for
64 // off-screen textures). 64 // off-screen textures).
65 return min(lingeringLimitPriority, 65 return min(lingeringLimitPriority,
66 max(lingeringBasePriority, previousPriority + 1)); 66 max(lingeringBasePriority, previousPriority + 1));
67 } 67 }
68 68
69 namespace { 69 namespace {
70 int manhattanDistance(const IntRect& a, const IntRect& b) 70 int manhattanDistance(const gfx::Rect& a, const gfx::Rect& b)
71 { 71 {
72 IntRect c = unionRect(a, b); 72 gfx::Rect c = gfx::UnionRects(a, b);
73 int x = max(0, c.width() - a.width() - b.width() + 1); 73 int x = max(0, c.width() - a.width() - b.width() + 1);
74 int y = max(0, c.height() - a.height() - b.height() + 1); 74 int y = max(0, c.height() - a.height() - b.height() + 1);
75 return (x + y); 75 return (x + y);
76 } 76 }
77 } 77 }
78 78
79 // static 79 // static
80 int PriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const I ntRect& textureRect, bool drawsToRootSurface) 80 int PriorityCalculator::priorityFromDistance(const gfx::Rect& visibleRect, const gfx::Rect& textureRect, bool drawsToRootSurface)
81 { 81 {
82 int distance = manhattanDistance(visibleRect, textureRect); 82 int distance = manhattanDistance(visibleRect, textureRect);
83 if (!distance) 83 if (!distance)
84 return visiblePriority(drawsToRootSurface); 84 return visiblePriority(drawsToRootSurface);
85 return min(notVisibleLimitPriority, notVisibleBasePriority + distance); 85 return min(notVisibleLimitPriority, notVisibleBasePriority + distance);
86 } 86 }
87 87
88 // static 88 // static
89 int PriorityCalculator::smallAnimatedLayerMinPriority() 89 int PriorityCalculator::smallAnimatedLayerMinPriority()
90 { 90 {
(...skipping 24 matching lines...) Expand all
115 return visibleOnlyPriorityCutoff; 115 return visibleOnlyPriorityCutoff;
116 } 116 }
117 117
118 // static 118 // static
119 int PriorityCalculator::allowEverythingCutoff() 119 int PriorityCalculator::allowEverythingCutoff()
120 { 120 {
121 return everythingPriorityCutoff; 121 return everythingPriorityCutoff;
122 } 122 }
123 123
124 } // cc 124 } // cc
OLDNEW
« cc/layer_tiling_data.cc ('K') | « cc/priority_calculator.h ('k') | cc/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698