Index: cc/resources/picture_pile.cc |
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc |
index 6341e88b3688889df468543cecf2c652136f20c9..2b1c98ea3cd5547bd527b13c0e78f485b929cc3e 100644 |
--- a/cc/resources/picture_pile.cc |
+++ b/cc/resources/picture_pile.cc |
@@ -14,6 +14,8 @@ |
#include "cc/resources/raster_worker_pool.h" |
#include "cc/resources/tile_priority.h" |
+namespace cc { |
enne (OOO)
2014/07/09 17:38:34
No need for this. These are all local to this fil
hyunki
2014/07/09 17:47:26
Done.
|
+ |
namespace { |
// Layout pixel buffer around the visible layer rect to record. Any base |
// picture that intersects the visible layer rect expanded by this distance |
@@ -25,16 +27,16 @@ const int kPixelDistanceToRecord = 8000; |
// script and find a sweet spot. |
const float kDensityThreshold = 0.5f; |
-bool rect_sort_y(const gfx::Rect &r1, const gfx::Rect &r2) { |
enne (OOO)
2014/07/09 17:38:34
This name is also correct. No need to rename it.
hyunki
2014/07/09 17:47:26
Done.
|
+bool SortRectY(const gfx::Rect& r1, const gfx::Rect& r2) { |
return r1.y() < r2.y() || (r1.y() == r2.y() && r1.x() < r2.x()); |
} |
-bool rect_sort_x(const gfx::Rect &r1, const gfx::Rect &r2) { |
+bool SortRectX(const gfx::Rect& r1, const gfx::Rect& r2) { |
return r1.x() < r2.x() || (r1.x() == r2.x() && r1.y() < r2.y()); |
} |
-float do_clustering(const std::vector<gfx::Rect>& tiles, |
- std::vector<gfx::Rect>* clustered_rects) { |
+float PerformClustering(const std::vector<gfx::Rect>& tiles, |
+ std::vector<gfx::Rect>* clustered_rects) { |
// These variables track the record area and invalid area |
// for the entire clustering |
int total_record_area = 0; |
@@ -89,7 +91,7 @@ float do_clustering(const std::vector<gfx::Rect>& tiles, |
return static_cast<float>(total_invalid_area) / |
static_cast<float>(total_record_area); |
- } |
+} |
float ClusterTiles(const std::vector<gfx::Rect>& invalid_tiles, |
std::vector<gfx::Rect>* record_rects) { |
@@ -109,24 +111,24 @@ float ClusterTiles(const std::vector<gfx::Rect>& invalid_tiles, |
std::vector<gfx::Rect> invalid_tiles_vertical = invalid_tiles; |
std::sort(invalid_tiles_vertical.begin(), |
invalid_tiles_vertical.end(), |
- rect_sort_y); |
+ SortRectY); |
float vertical_density; |
std::vector<gfx::Rect> vertical_clustering; |
- vertical_density = do_clustering(invalid_tiles_vertical, |
- &vertical_clustering); |
+ vertical_density = PerformClustering(invalid_tiles_vertical, |
+ &vertical_clustering); |
// 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(), |
- rect_sort_x); |
+ SortRectX); |
float horizontal_density; |
std::vector<gfx::Rect> horizontal_clustering; |
- horizontal_density = do_clustering(invalid_tiles_vertical, |
- &horizontal_clustering); |
+ horizontal_density = PerformClustering(invalid_tiles_vertical, |
+ &horizontal_clustering); |
if (vertical_density < horizontal_density) { |
*record_rects = horizontal_clustering; |
@@ -139,8 +141,6 @@ float ClusterTiles(const std::vector<gfx::Rect>& invalid_tiles, |
} // namespace |
-namespace cc { |
- |
PicturePile::PicturePile() : is_suitable_for_gpu_rasterization_(true) {} |
PicturePile::~PicturePile() { |