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

Side by Side Diff: cc/resources/tile_priority.h

Issue 343463004: Move occlusion info to TilePriority. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« cc/resources/picture_layer_tiling.cc ('K') | « cc/resources/tile.cc ('k') | no next file » | 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 #ifndef CC_RESOURCES_TILE_PRIORITY_H_ 5 #ifndef CC_RESOURCES_TILE_PRIORITY_H_
6 #define CC_RESOURCES_TILE_PRIORITY_H_ 6 #define CC_RESOURCES_TILE_PRIORITY_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 28 matching lines...) Expand all
39 }; 39 };
40 scoped_ptr<base::Value> TileResolutionAsValue( 40 scoped_ptr<base::Value> TileResolutionAsValue(
41 TileResolution resolution); 41 TileResolution resolution);
42 42
43 struct CC_EXPORT TilePriority { 43 struct CC_EXPORT TilePriority {
44 enum PriorityBin { NOW, SOON, EVENTUALLY }; 44 enum PriorityBin { NOW, SOON, EVENTUALLY };
45 45
46 TilePriority() 46 TilePriority()
47 : resolution(NON_IDEAL_RESOLUTION), 47 : resolution(NON_IDEAL_RESOLUTION),
48 required_for_activation(false), 48 required_for_activation(false),
49 is_occluded(false),
49 priority_bin(EVENTUALLY), 50 priority_bin(EVENTUALLY),
50 distance_to_visible(std::numeric_limits<float>::infinity()) {} 51 distance_to_visible(std::numeric_limits<float>::infinity()) {}
51 52
52 TilePriority(TileResolution resolution, 53 TilePriority(TileResolution resolution,
53 PriorityBin bin, 54 PriorityBin bin,
54 float distance_to_visible) 55 float distance_to_visible)
55 : resolution(resolution), 56 : resolution(resolution),
56 required_for_activation(false), 57 required_for_activation(false),
58 is_occluded(false),
57 priority_bin(bin), 59 priority_bin(bin),
58 distance_to_visible(distance_to_visible) {} 60 distance_to_visible(distance_to_visible) {}
59 61
60 TilePriority(const TilePriority& active, const TilePriority& pending) { 62 TilePriority(const TilePriority& active, const TilePriority& pending) {
danakj 2014/06/17 22:29:41 What is this constructor used for? I'm not familia
vmpstr 2014/06/17 23:42:10 It's computing "combined" priority used in SAME_PR
61 if (active.resolution == HIGH_RESOLUTION || 63 if (active.resolution == HIGH_RESOLUTION ||
62 pending.resolution == HIGH_RESOLUTION) 64 pending.resolution == HIGH_RESOLUTION)
63 resolution = HIGH_RESOLUTION; 65 resolution = HIGH_RESOLUTION;
64 else if (active.resolution == LOW_RESOLUTION || 66 else if (active.resolution == LOW_RESOLUTION ||
65 pending.resolution == LOW_RESOLUTION) 67 pending.resolution == LOW_RESOLUTION)
66 resolution = LOW_RESOLUTION; 68 resolution = LOW_RESOLUTION;
67 else 69 else
68 resolution = NON_IDEAL_RESOLUTION; 70 resolution = NON_IDEAL_RESOLUTION;
69 71
70 required_for_activation = 72 required_for_activation =
71 active.required_for_activation || pending.required_for_activation; 73 active.required_for_activation || pending.required_for_activation;
72 74
75 is_occluded = active.is_occluded && pending.is_occluded;
76
73 if (active.priority_bin < pending.priority_bin) { 77 if (active.priority_bin < pending.priority_bin) {
74 priority_bin = active.priority_bin; 78 priority_bin = active.priority_bin;
75 distance_to_visible = active.distance_to_visible; 79 distance_to_visible = active.distance_to_visible;
76 } else if (active.priority_bin > pending.priority_bin) { 80 } else if (active.priority_bin > pending.priority_bin) {
77 priority_bin = pending.priority_bin; 81 priority_bin = pending.priority_bin;
78 distance_to_visible = pending.distance_to_visible; 82 distance_to_visible = pending.distance_to_visible;
79 } else { 83 } else {
80 priority_bin = active.priority_bin; 84 priority_bin = active.priority_bin;
81 distance_to_visible = 85 distance_to_visible =
82 std::min(active.distance_to_visible, pending.distance_to_visible); 86 std::min(active.distance_to_visible, pending.distance_to_visible);
83 } 87 }
84 } 88 }
85 89
86 scoped_ptr<base::Value> AsValue() const; 90 scoped_ptr<base::Value> AsValue() const;
87 91
88 bool operator ==(const TilePriority& other) const { 92 bool operator ==(const TilePriority& other) const {
89 return resolution == other.resolution && 93 return resolution == other.resolution &&
90 priority_bin == other.priority_bin && 94 priority_bin == other.priority_bin &&
91 distance_to_visible == other.distance_to_visible && 95 distance_to_visible == other.distance_to_visible &&
92 required_for_activation == other.required_for_activation; 96 required_for_activation == other.required_for_activation &&
97 is_occluded == other.is_occluded;
93 } 98 }
94 99
95 bool operator !=(const TilePriority& other) const { 100 bool operator !=(const TilePriority& other) const {
96 return !(*this == other); 101 return !(*this == other);
97 } 102 }
98 103
99 bool IsHigherPriorityThan(const TilePriority& other) const { 104 bool IsHigherPriorityThan(const TilePriority& other) const {
100 return priority_bin < other.priority_bin || 105 return priority_bin < other.priority_bin ||
101 (priority_bin == other.priority_bin && 106 (priority_bin == other.priority_bin &&
102 distance_to_visible < other.distance_to_visible); 107 distance_to_visible < other.distance_to_visible);
103 } 108 }
104 109
105 TileResolution resolution; 110 TileResolution resolution;
106 bool required_for_activation; 111 bool required_for_activation;
112 bool is_occluded;
107 PriorityBin priority_bin; 113 PriorityBin priority_bin;
108 float distance_to_visible; 114 float distance_to_visible;
109 }; 115 };
110 116
111 scoped_ptr<base::Value> TilePriorityBinAsValue(TilePriority::PriorityBin bin); 117 scoped_ptr<base::Value> TilePriorityBinAsValue(TilePriority::PriorityBin bin);
112 118
113 enum TileMemoryLimitPolicy { 119 enum TileMemoryLimitPolicy {
114 // Nothing. 120 // Nothing.
115 ALLOW_NOTHING = 0, 121 ALLOW_NOTHING = 0,
116 122
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 bool operator!=(const GlobalStateThatImpactsTilePriority& other) const { 173 bool operator!=(const GlobalStateThatImpactsTilePriority& other) const {
168 return !(*this == other); 174 return !(*this == other);
169 } 175 }
170 176
171 scoped_ptr<base::Value> AsValue() const; 177 scoped_ptr<base::Value> AsValue() const;
172 }; 178 };
173 179
174 } // namespace cc 180 } // namespace cc
175 181
176 #endif // CC_RESOURCES_TILE_PRIORITY_H_ 182 #endif // CC_RESOURCES_TILE_PRIORITY_H_
OLDNEW
« cc/resources/picture_layer_tiling.cc ('K') | « cc/resources/tile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698