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

Unified Diff: cc/picture_layer_tiling.cc

Issue 11414238: implement the logic to set tile priorities based on current matrix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: switching to rectF Created 8 years 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
Index: cc/picture_layer_tiling.cc
diff --git a/cc/picture_layer_tiling.cc b/cc/picture_layer_tiling.cc
index 7d3f975bda1c44eda663de9cac9dfd4290d850fd..f6e6de0a6a7d53ce031c3dca05d369920c25a60e 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();
enne (OOO) 2012/12/03 19:57:28 countent => content
qinmin 2012/12/04 00:37:30 Done.
+ 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) {
enne (OOO) 2012/12/03 19:57:28 For correctness, do you need to iterate over all t
qinmin 2012/12/04 00:37:30 Done. looping throught the whole hash map to set p
+ for (int i = 0; i <= right; ++i) {
+ gfx::Rect content_rect = tiling_data_.TileBounds(i, j);
enne (OOO) 2012/12/03 19:57:28 I think your math is wrong here for layer content
enne (OOO) 2012/12/03 22:08:54 Actually, scratch that. I think your math is righ
+ gfx::RectF layer_content_rect = gfx::ScaleRect(
+ content_rect,
+ layer_content_scaleX / contents_scale_,
+ layer_content_scaleY / contents_scale_);
+ gfx::RectF screen_rect = MathUtil::mapClippedRect(
+ current_screen_transform, layer_content_rect);
+ gfx::RectF 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);
enne (OOO) 2012/12/03 19:57:28 Oh, interesting! So rather than caring about all
qinmin 2012/12/04 00:37:30 Yes, this is an efficient way to deal with the sca
+
+ 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

Powered by Google App Engine
This is Rietveld 408576698