Chromium Code Reviews| Index: cc/picture_layer_tiling.cc |
| diff --git a/cc/picture_layer_tiling.cc b/cc/picture_layer_tiling.cc |
| index 7d3f975bda1c44eda663de9cac9dfd4290d850fd..b6a01a5465509a5caf6c5851cef091b90ee87817 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,44 @@ 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_scaleX, |
| + float layer_content_scaleY, |
| + 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( |
|
danakj
2012/12/01 01:20:19
Why go to a Rect and take the enclosing rect here?
qinmin
2012/12/01 01:36:44
if we keep it rectF, then the following calculatio
danakj
2012/12/01 01:58:25
The mapRect function is going to convert it to flo
qinmin
2012/12/01 02:31:20
ok, switched to rectF for all the remaining calcul
|
| + gfx::ScaleRect(content_rect, |
| + layer_content_scaleX / contents_scale_, |
| + layer_content_scaleY / contents_scale_)); |
| + gfx::Rect screen_rect = MathUtil::mapClippedRect( |
| + current_screen_transform, layer_content_rect); |
| + gfx::Rect previous_rect = MathUtil::mapClippedRect( |
| + last_screen_transform, layer_content_rect); |
| + |
| + 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 |