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

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: ScaleAsVector 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
« no previous file with comments | « cc/priority_calculator.h ('k') | cc/proxy.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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/priority_calculator.h" 7 #include "cc/priority_calculator.h"
8 #include "ui/gfx/rect.h"
8 9
9 using namespace std; 10 using namespace std;
10 11
11 namespace cc { 12 namespace cc {
12 13
13 static const int nothingPriorityCutoff = -3; 14 static const int nothingPriorityCutoff = -3;
14 15
15 static const int mostHighPriority = -2; 16 static const int mostHighPriority = -2;
16 17
17 static const int uiDrawsToRootSurfacePriority = -1; 18 static const int uiDrawsToRootSurfacePriority = -1;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 int PriorityCalculator::lingeringPriority(int previousPriority) 65 int PriorityCalculator::lingeringPriority(int previousPriority)
65 { 66 {
66 // FIXME: We should remove this once we have priorities for all 67 // FIXME: We should remove this once we have priorities for all
67 // textures (we can't currently calculate distances for 68 // textures (we can't currently calculate distances for
68 // off-screen textures). 69 // off-screen textures).
69 return min(lingeringLimitPriority, 70 return min(lingeringLimitPriority,
70 max(lingeringBasePriority, previousPriority + 1)); 71 max(lingeringBasePriority, previousPriority + 1));
71 } 72 }
72 73
73 namespace { 74 namespace {
74 int manhattanDistance(const IntRect& a, const IntRect& b) 75 int manhattanDistance(const gfx::Rect& a, const gfx::Rect& b)
75 { 76 {
76 IntRect c = unionRect(a, b); 77 gfx::Rect c = gfx::UnionRects(a, b);
77 int x = max(0, c.width() - a.width() - b.width() + 1); 78 int x = max(0, c.width() - a.width() - b.width() + 1);
78 int y = max(0, c.height() - a.height() - b.height() + 1); 79 int y = max(0, c.height() - a.height() - b.height() + 1);
79 return (x + y); 80 return (x + y);
80 } 81 }
81 } 82 }
82 83
83 // static 84 // static
84 int PriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const I ntRect& textureRect, bool drawsToRootSurface) 85 int PriorityCalculator::priorityFromDistance(const gfx::Rect& visibleRect, const gfx::Rect& textureRect, bool drawsToRootSurface)
85 { 86 {
86 int distance = manhattanDistance(visibleRect, textureRect); 87 int distance = manhattanDistance(visibleRect, textureRect);
87 if (!distance) 88 if (!distance)
88 return visiblePriority(drawsToRootSurface); 89 return visiblePriority(drawsToRootSurface);
89 return min(notVisibleLimitPriority, notVisibleBasePriority + distance); 90 return min(notVisibleLimitPriority, notVisibleBasePriority + distance);
90 } 91 }
91 92
92 // static 93 // static
93 int PriorityCalculator::smallAnimatedLayerMinPriority() 94 int PriorityCalculator::smallAnimatedLayerMinPriority()
94 { 95 {
(...skipping 30 matching lines...) Expand all
125 return visibleAndNearbyPriorityCutoff; 126 return visibleAndNearbyPriorityCutoff;
126 } 127 }
127 128
128 // static 129 // static
129 int PriorityCalculator::allowEverythingCutoff() 130 int PriorityCalculator::allowEverythingCutoff()
130 { 131 {
131 return everythingPriorityCutoff; 132 return everythingPriorityCutoff;
132 } 133 }
133 134
134 } // cc 135 } // cc
OLDNEW
« no previous file with comments | « cc/priority_calculator.h ('k') | cc/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698