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

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

Issue 140513006: cc: Simplify picture layer tiling update tile priorities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/prioritized_tile_set.h" 5 #include "cc/resources/prioritized_tile_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/resources/managed_tile_state.h" 9 #include "cc/resources/managed_tile_state.h"
10 #include "cc/resources/tile.h" 10 #include "cc/resources/tile.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class BinComparator { 14 class BinComparator {
15 public: 15 public:
16 bool operator()(const Tile* a, 16 bool operator()(const Tile* a,
17 const Tile* b) const { 17 const Tile* b) const {
18 const ManagedTileState& ams = a->managed_state(); 18 const ManagedTileState& ams = a->managed_state();
19 const ManagedTileState& bms = b->managed_state(); 19 const ManagedTileState& bms = b->managed_state();
20 20
21 if (ams.priority_bin != bms.priority_bin)
enne (OOO) 2014/01/31 23:07:46 Isn't the bin comparator for tiles in the same bin
vmpstr 2014/02/03 20:27:24 Not exactly. I mean, I hope that in the near futur
22 return ams.priority_bin < bms.priority_bin;
23
21 if (ams.required_for_activation != bms.required_for_activation) 24 if (ams.required_for_activation != bms.required_for_activation)
22 return ams.required_for_activation; 25 return ams.required_for_activation;
23 26
24 if (ams.resolution != bms.resolution) 27 if (ams.resolution != bms.resolution)
25 return ams.resolution < bms.resolution; 28 return ams.resolution < bms.resolution;
26 29
27 if (ams.time_to_needed_in_seconds != bms.time_to_needed_in_seconds) 30 if (ams.distance_to_visible != bms.distance_to_visible)
28 return ams.time_to_needed_in_seconds < bms.time_to_needed_in_seconds; 31 return ams.distance_to_visible < bms.distance_to_visible;
29
30 if (ams.distance_to_visible_in_pixels !=
31 bms.distance_to_visible_in_pixels) {
32 return ams.distance_to_visible_in_pixels <
33 bms.distance_to_visible_in_pixels;
34 }
35 32
36 gfx::Rect a_rect = a->content_rect(); 33 gfx::Rect a_rect = a->content_rect();
37 gfx::Rect b_rect = b->content_rect(); 34 gfx::Rect b_rect = b->content_rect();
38 if (a_rect.y() != b_rect.y()) 35 if (a_rect.y() != b_rect.y())
39 return a_rect.y() < b_rect.y(); 36 return a_rect.y() < b_rect.y();
40 return a_rect.x() < b_rect.x(); 37 return a_rect.x() < b_rect.x();
41 } 38 }
42 }; 39 };
43 40
44 namespace { 41 namespace {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (use_priority_ordering_) 131 if (use_priority_ordering_)
135 tile_set_->SortBinIfNeeded(current_bin_); 132 tile_set_->SortBinIfNeeded(current_bin_);
136 133
137 iterator_ = tile_set_->tiles_[current_bin_].begin(); 134 iterator_ = tile_set_->tiles_[current_bin_].begin();
138 if (iterator_ != tile_set_->tiles_[current_bin_].end()) 135 if (iterator_ != tile_set_->tiles_[current_bin_].end())
139 break; 136 break;
140 } 137 }
141 } 138 }
142 139
143 } // namespace cc 140 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698