OLD | NEW |
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 | 6 |
7 #include "cc/math_util.h" | 7 #include "cc/math_util.h" |
8 #include "ui/gfx/rect_conversions.h" | 8 #include "ui/gfx/rect_conversions.h" |
9 #include "ui/gfx/size_conversions.h" | 9 #include "ui/gfx/size_conversions.h" |
10 | 10 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 const gfx::Transform& last_screen_transform, | 276 const gfx::Transform& last_screen_transform, |
277 const gfx::Transform& current_screen_transform, | 277 const gfx::Transform& current_screen_transform, |
278 double time_delta) { | 278 double time_delta) { |
279 gfx::Rect content_rect = ContentRect(); | 279 gfx::Rect content_rect = ContentRect(); |
280 if (content_rect.IsEmpty()) | 280 if (content_rect.IsEmpty()) |
281 return; | 281 return; |
282 | 282 |
283 gfx::Rect view_rect(gfx::Point(), device_viewport); | 283 gfx::Rect view_rect(gfx::Point(), device_viewport); |
284 int right = tiling_data_.TileXIndexFromSrcCoord(content_rect.width() - 1); | 284 int right = tiling_data_.TileXIndexFromSrcCoord(content_rect.width() - 1); |
285 int bottom = tiling_data_.TileYIndexFromSrcCoord(content_rect.height() - 1); | 285 int bottom = tiling_data_.TileYIndexFromSrcCoord(content_rect.height() - 1); |
| 286 |
286 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 287 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
287 TileMapKey key = it->first; | 288 TileMapKey key = it->first; |
288 TilePriority priority; | 289 TilePriority priority; |
289 if (key.first > right || key.second > bottom) { | 290 if (key.first > right || key.second > bottom) { |
290 priority.distance_to_visible_in_pixels = std::numeric_limits<int>::max(); | 291 priority.distance_to_visible_in_pixels = std::numeric_limits<int>::max(); |
291 priority.time_to_visible_in_seconds = | 292 priority.time_to_visible_in_seconds = |
292 TilePriority::kMaxTimeToVisibleInSeconds; | 293 TilePriority::kMaxTimeToVisibleInSeconds; |
293 // TODO(qinmin): pass the correct tree to this function. | |
294 it->second->set_priority(tree, priority); | 294 it->second->set_priority(tree, priority); |
295 continue; | 295 continue; |
296 } | 296 } |
297 | 297 |
298 gfx::Rect tile_bound = tiling_data_.TileBounds(key.first, key.second); | 298 gfx::Rect tile_bound = tiling_data_.TileBounds(key.first, key.second); |
299 gfx::RectF layer_content_rect = gfx::ScaleRect( | 299 gfx::RectF layer_content_rect = gfx::ScaleRect( |
300 tile_bound, | 300 tile_bound, |
301 layer_content_scale_x / contents_scale_, | 301 layer_content_scale_x / contents_scale_, |
302 layer_content_scale_y / contents_scale_); | 302 layer_content_scale_y / contents_scale_); |
303 gfx::RectF screen_rect = MathUtil::mapClippedRect( | 303 gfx::RectF screen_rect = MathUtil::mapClippedRect( |
304 current_screen_transform, layer_content_rect); | 304 current_screen_transform, layer_content_rect); |
305 gfx::RectF previous_rect = MathUtil::mapClippedRect( | 305 gfx::RectF previous_rect = MathUtil::mapClippedRect( |
306 last_screen_transform, layer_content_rect); | 306 last_screen_transform, layer_content_rect); |
307 | 307 |
308 priority.resolution = HIGH_RESOLUTION; | 308 priority.resolution = HIGH_RESOLUTION; |
309 priority.time_to_visible_in_seconds = | 309 priority.time_to_visible_in_seconds = |
310 TilePriority::TimeForBoundsToIntersect( | 310 TilePriority::TimeForBoundsToIntersect( |
311 previous_rect, screen_rect, time_delta, view_rect); | 311 previous_rect, screen_rect, time_delta, view_rect); |
312 | 312 |
313 priority.distance_to_visible_in_pixels = | 313 priority.distance_to_visible_in_pixels = |
314 TilePriority::manhattanDistance(screen_rect, view_rect); | 314 TilePriority::manhattanDistance(screen_rect, view_rect); |
315 // TODO(qinmin): pass the correct tree to this function. | |
316 it->second->set_priority(tree, priority); | 315 it->second->set_priority(tree, priority); |
317 } | 316 } |
318 } | 317 } |
319 | 318 |
320 } // namespace cc | 319 } // namespace cc |
OLD | NEW |