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

Side by Side 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: addressing comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/picture_layer_tiling.h ('k') | cc/picture_layer_tiling_set.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/picture_layer_tiling.h" 5 #include "cc/picture_layer_tiling.h"
6
7 #include "cc/math_util.h"
6 #include "ui/gfx/rect_conversions.h" 8 #include "ui/gfx/rect_conversions.h"
7 #include "ui/gfx/size_conversions.h" 9 #include "ui/gfx/size_conversions.h"
8 10
9 namespace cc { 11 namespace cc {
10 12
11 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( 13 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
12 float contents_scale, 14 float contents_scale,
13 gfx::Size tile_size) { 15 gfx::Size tile_size) {
14 return make_scoped_ptr(new PictureLayerTiling(contents_scale, tile_size)); 16 return make_scoped_ptr(new PictureLayerTiling(contents_scale, tile_size));
15 } 17 }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 DCHECK_LE(texture_rect.right(), texture_size().width()); 261 DCHECK_LE(texture_rect.right(), texture_size().width());
260 DCHECK_LE(texture_rect.bottom(), texture_size().height()); 262 DCHECK_LE(texture_rect.bottom(), texture_size().height());
261 263
262 return texture_rect; 264 return texture_rect;
263 } 265 }
264 266
265 gfx::Size PictureLayerTiling::Iterator::texture_size() const { 267 gfx::Size PictureLayerTiling::Iterator::texture_size() const {
266 return tiling_->tiling_data_.max_texture_size(); 268 return tiling_->tiling_data_.max_texture_size();
267 } 269 }
268 270
271 void PictureLayerTiling::UpdateTilePriorities(
272 const gfx::Size& view_port,
273 float layer_content_scaleX,
274 float layer_content_scaleY,
275 const gfx::Transform& last_screen_transform,
276 const gfx::Transform& current_screen_transform,
277 double time_delta) {
278 gfx::Rect countent_rect = ContentRect();
279 if (countent_rect.IsEmpty())
280 return;
281
282 gfx::Rect view_rect(gfx::Point(), view_port);
283 int right = tiling_data_.TileXIndexFromSrcCoord(countent_rect.width() - 1);
284 int bottom = tiling_data_.TileYIndexFromSrcCoord(countent_rect.height() - 1);
285 for (int j = 0; j <= bottom; ++j) {
286 for (int i = 0; i <= right; ++i) {
287 gfx::Rect content_rect = tiling_data_.TileBounds(i, j);
288 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
289 gfx::ScaleRect(content_rect,
290 layer_content_scaleX / contents_scale_,
291 layer_content_scaleY / contents_scale_));
292 gfx::Rect screen_rect = MathUtil::mapClippedRect(
293 current_screen_transform, layer_content_rect);
294 gfx::Rect previous_rect = MathUtil::mapClippedRect(
295 last_screen_transform, layer_content_rect);
296
297 TilePriority priority;
298 priority.resolution = HIGH_RESOLUTION;
299 priority.time_to_visible_in_seconds =
300 TilePriority::TimeForBoundsToIntersect(
301 previous_rect, screen_rect, time_delta, view_rect);
302
303 priority.distance_to_visible_in_pixels =
304 TilePriority::manhattanDistance(screen_rect, view_rect);
305 // TODO(qinmin): pass the correct tree to this function.
306 TileAt(i, j)->set_priority(ACTIVE_TREE, priority);
307 }
308 }
309 }
310
269 } // namespace cc 311 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_tiling.h ('k') | cc/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698