Index: cc/picture_layer_tiling.cc |
diff --git a/cc/picture_layer_tiling.cc b/cc/picture_layer_tiling.cc |
index 7d3f975bda1c44eda663de9cac9dfd4290d850fd..796846662ba07d911590f768daab8cd654b046a7 100644 |
--- a/cc/picture_layer_tiling.cc |
+++ b/cc/picture_layer_tiling.cc |
@@ -3,6 +3,8 @@ |
// found in the LICENSE file. |
#include "cc/picture_layer_tiling.h" |
+ |
+#include "cc/math_util.h" |
#include "ui/gfx/rect_conversions.h" |
#include "ui/gfx/size_conversions.h" |
@@ -266,4 +268,41 @@ gfx::Size PictureLayerTiling::Iterator::texture_size() const { |
return tiling_->tiling_data_.max_texture_size(); |
} |
+void PictureLayerTiling::UpdateTilePriorities( |
+ const gfx::Size& view_port, |
+ float layer_content_scale, |
+ const gfx::Transform& last_screen_transform, |
+ const gfx::Transform& current_screen_transform, |
+ double time_delta) { |
+ gfx::Rect countent_rect = ContentRect(); |
+ if (countent_rect.IsEmpty()) |
+ return; |
+ |
+ gfx::Rect view_rect(gfx::Point(), view_port); |
+ int right = tiling_data_.TileXIndexFromSrcCoord(countent_rect.width() - 1); |
+ int bottom = tiling_data_.TileYIndexFromSrcCoord(countent_rect.height() - 1); |
+ for (int j = 0; j <= bottom; ++j) { |
+ for (int i = 0; i <= right; ++i) { |
+ gfx::Rect content_rect = tiling_data_.TileBounds(i, j); |
+ gfx::Rect layer_content_rect = gfx::ToEnclosingRect( |
+ gfx::ScaleRect(content_rect, layer_content_scale / contents_scale_)); |
danakj
2012/12/01 00:07:31
Maybe you should just pass in both content scale X
qinmin
2012/12/01 01:07:02
Done.
|
+ gfx::Rect screen_rect = MathUtil::mapClippedRect( |
+ current_screen_transform, layer_content_rect); |
+ gfx::Rect previous_rect = MathUtil::mapClippedRect( |
+ last_screen_transform, layer_content_rect); |
danakj
2012/12/01 00:07:31
Don't you need the last_layer_content_rect here to
qinmin
2012/12/01 01:07:02
Yes, this is some of our concerns.
If tiling_conte
|
+ |
+ TilePriority priority; |
+ priority.resolution = HIGH_RESOLUTION; |
+ priority.time_to_visible_in_seconds = |
+ TilePriority::TimeForBoundsToIntersect( |
+ previous_rect, screen_rect, time_delta, view_rect); |
+ |
+ priority.distance_to_visible_in_pixels = |
+ TilePriority::manhattanDistance(screen_rect, view_rect); |
+ // TODO(qinmin): pass the correct tree to this function. |
+ TileAt(i, j)->set_priority(ACTIVE_TREE, priority); |
+ } |
+ } |
+} |
+ |
} // namespace cc |