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

Unified Diff: cc/resources/picture_pile.cc

Issue 379823002: cc: skipping a horizontal sort by checking the value of vertical_density (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_pile.cc
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc
index 3ad0a1ff5401cb199db25a5c2187edcad38da588..5756a66c53abb63053194af0f59d9a88950cd8e4 100644
--- a/cc/resources/picture_pile.cc
+++ b/cc/resources/picture_pile.cc
@@ -116,16 +116,21 @@ float ClusterTiles(const std::vector<gfx::Rect>& invalid_tiles,
vertical_density = PerformClustering(invalid_tiles_vertical,
&vertical_clustering);
+ // If vertical density is optimal, then we can return early.
+ if (vertical_density == 1.f) {
+ *record_rects = vertical_clustering;
+ return vertical_density;
+ }
+
// Now try again with a horizontal sort, see which one is best
- // TODO(humper): Heuristics for skipping this step?
std::vector<gfx::Rect> invalid_tiles_horizontal = invalid_tiles;
- std::sort(invalid_tiles_vertical.begin(),
- invalid_tiles_vertical.end(),
+ std::sort(invalid_tiles_horizontal.begin(),
+ invalid_tiles_horizontal.end(),
rect_sort_x);
float horizontal_density;
std::vector<gfx::Rect> horizontal_clustering;
- horizontal_density = PerformClustering(invalid_tiles_vertical,
+ horizontal_density = PerformClustering(invalid_tiles_horizontal,
&horizontal_clustering);
if (vertical_density < horizontal_density) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698