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

Side by Side Diff: cc/priority_calculator.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | 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 "CCPriorityCalculator.h" 7 #include "CCPriorityCalculator.h"
8 8
9 using namespace std; 9 using namespace std;
10 10
(...skipping 11 matching lines...) Expand all
22 static const int notVisibleLimitPriority = 1900000; 22 static const int notVisibleLimitPriority = 1900000;
23 23
24 // Small animated layers are treated as though they are 512 pixels 24 // Small animated layers are treated as though they are 512 pixels
25 // from being visible. 25 // from being visible.
26 static const int smallAnimatedLayerPriority = notVisibleBasePriority + 512; 26 static const int smallAnimatedLayerPriority = notVisibleBasePriority + 512;
27 27
28 static const int lingeringBasePriority = 2000000; 28 static const int lingeringBasePriority = 2000000;
29 static const int lingeringLimitPriority = 2900000; 29 static const int lingeringLimitPriority = 2900000;
30 30
31 // static 31 // static
32 int CCPriorityCalculator::uiPriority(bool drawsToRootSurface) 32 int PriorityCalculator::uiPriority(bool drawsToRootSurface)
33 { 33 {
34 return drawsToRootSurface ? uiDrawsToRootSurfacePriority : uiDoesNotDrawToRo otSurfacePriority; 34 return drawsToRootSurface ? uiDrawsToRootSurfacePriority : uiDoesNotDrawToRo otSurfacePriority;
35 } 35 }
36 36
37 // static 37 // static
38 int CCPriorityCalculator::visiblePriority(bool drawsToRootSurface) 38 int PriorityCalculator::visiblePriority(bool drawsToRootSurface)
39 { 39 {
40 return drawsToRootSurface ? visibleDrawsToRootSurfacePriority : visibleDoesN otDrawToRootSurfacePriority; 40 return drawsToRootSurface ? visibleDrawsToRootSurfacePriority : visibleDoesN otDrawToRootSurfacePriority;
41 } 41 }
42 42
43 // static 43 // static
44 int CCPriorityCalculator::renderSurfacePriority() 44 int PriorityCalculator::renderSurfacePriority()
45 { 45 {
46 return renderSurfacesPriority; 46 return renderSurfacesPriority;
47 } 47 }
48 48
49 // static 49 // static
50 int CCPriorityCalculator::lingeringPriority(int previousPriority) 50 int PriorityCalculator::lingeringPriority(int previousPriority)
51 { 51 {
52 // FIXME: We should remove this once we have priorities for all 52 // FIXME: We should remove this once we have priorities for all
53 // textures (we can't currently calculate distances for 53 // textures (we can't currently calculate distances for
54 // off-screen textures). 54 // off-screen textures).
55 return min(lingeringLimitPriority, 55 return min(lingeringLimitPriority,
56 max(lingeringBasePriority, previousPriority + 1)); 56 max(lingeringBasePriority, previousPriority + 1));
57 } 57 }
58 58
59 namespace { 59 namespace {
60 int manhattanDistance(const IntRect& a, const IntRect& b) 60 int manhattanDistance(const IntRect& a, const IntRect& b)
61 { 61 {
62 IntRect c = unionRect(a, b); 62 IntRect c = unionRect(a, b);
63 int x = max(0, c.width() - a.width() - b.width() + 1); 63 int x = max(0, c.width() - a.width() - b.width() + 1);
64 int y = max(0, c.height() - a.height() - b.height() + 1); 64 int y = max(0, c.height() - a.height() - b.height() + 1);
65 return (x + y); 65 return (x + y);
66 } 66 }
67 } 67 }
68 68
69 // static 69 // static
70 int CCPriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface) 70 int PriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const I ntRect& textureRect, bool drawsToRootSurface)
71 { 71 {
72 int distance = manhattanDistance(visibleRect, textureRect); 72 int distance = manhattanDistance(visibleRect, textureRect);
73 if (!distance) 73 if (!distance)
74 return visiblePriority(drawsToRootSurface); 74 return visiblePriority(drawsToRootSurface);
75 return min(notVisibleLimitPriority, notVisibleBasePriority + distance); 75 return min(notVisibleLimitPriority, notVisibleBasePriority + distance);
76 } 76 }
77 77
78 // static 78 // static
79 int CCPriorityCalculator::smallAnimatedLayerMinPriority() 79 int PriorityCalculator::smallAnimatedLayerMinPriority()
80 { 80 {
81 return smallAnimatedLayerPriority; 81 return smallAnimatedLayerPriority;
82 } 82 }
83 83
84 } // cc 84 } // cc
OLDNEW
« cc/active_animation.h ('K') | « cc/priority_calculator.h ('k') | cc/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698