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/point_conversions.h" | 8 #include "ui/gfx/point_conversions.h" |
9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
10 #include "ui/gfx/safe_integer_conversions.h" | 10 #include "ui/gfx/safe_integer_conversions.h" |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 float time_to_visible_in_seconds = | 428 float time_to_visible_in_seconds = |
429 TilePriority::TimeForBoundsToIntersect( | 429 TilePriority::TimeForBoundsToIntersect( |
430 last_screen_rect, current_screen_rect, time_delta, view_rect); | 430 last_screen_rect, current_screen_rect, time_delta, view_rect); |
431 float distance_to_visible_in_pixels = | 431 float distance_to_visible_in_pixels = |
432 TilePriority::manhattanDistance(current_screen_rect, view_rect); | 432 TilePriority::manhattanDistance(current_screen_rect, view_rect); |
433 | 433 |
434 TilePriority priority( | 434 TilePriority priority( |
435 resolution_, | 435 resolution_, |
436 time_to_visible_in_seconds, | 436 time_to_visible_in_seconds, |
437 distance_to_visible_in_pixels); | 437 distance_to_visible_in_pixels); |
438 bool clipped; | |
439 priority.set_current_screen_quad( | |
440 MathUtil::projectQuad(current_screen_transform, | |
shawnsingh
2013/02/01 19:39:22
First, are you sure we want project here? This is
| |
441 gfx::QuadF(tile_bounds), | |
442 clipped)); | |
438 tile->set_priority(tree, priority); | 443 tile->set_priority(tree, priority); |
439 } | 444 } |
440 } | 445 } |
441 else | 446 else |
442 { | 447 { |
443 for (TilingData::Iterator iter(&tiling_data_, inflated_rect); | 448 for (TilingData::Iterator iter(&tiling_data_, inflated_rect); |
444 iter; ++iter) { | 449 iter; ++iter) { |
445 TileMap::iterator find = tiles_.find(iter.index()); | 450 TileMap::iterator find = tiles_.find(iter.index()); |
446 if (find == tiles_.end()) | 451 if (find == tiles_.end()) |
447 continue; | 452 continue; |
(...skipping 17 matching lines...) Expand all Loading... | |
465 float time_to_visible_in_seconds = | 470 float time_to_visible_in_seconds = |
466 TilePriority::TimeForBoundsToIntersect( | 471 TilePriority::TimeForBoundsToIntersect( |
467 last_screen_rect, current_screen_rect, time_delta, view_rect); | 472 last_screen_rect, current_screen_rect, time_delta, view_rect); |
468 float distance_to_visible_in_pixels = | 473 float distance_to_visible_in_pixels = |
469 TilePriority::manhattanDistance(current_screen_rect, view_rect); | 474 TilePriority::manhattanDistance(current_screen_rect, view_rect); |
470 | 475 |
471 TilePriority priority( | 476 TilePriority priority( |
472 resolution_, | 477 resolution_, |
473 time_to_visible_in_seconds, | 478 time_to_visible_in_seconds, |
474 distance_to_visible_in_pixels); | 479 distance_to_visible_in_pixels); |
480 bool clipped; | |
481 priority.set_current_screen_quad( | |
482 MathUtil::projectQuad(current_screen_transform, | |
483 gfx::QuadF(tile_bounds), | |
484 clipped)); | |
475 tile->set_priority(tree, priority); | 485 tile->set_priority(tree, priority); |
476 } | 486 } |
477 } | 487 } |
478 | 488 |
479 last_source_frame_number_ = current_source_frame_number; | 489 last_source_frame_number_ = current_source_frame_number; |
480 last_impl_frame_time_ = current_frame_time; | 490 last_impl_frame_time_ = current_frame_time; |
481 } | 491 } |
482 | 492 |
483 void PictureLayerTiling::DidBecomeActive() { | 493 void PictureLayerTiling::DidBecomeActive() { |
484 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 494 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
485 it->second->set_priority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); | 495 it->second->set_priority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); |
486 it->second->set_priority(PENDING_TREE, TilePriority()); | 496 it->second->set_priority(PENDING_TREE, TilePriority()); |
487 | 497 |
488 // Tile holds a ref onto a picture pile. If the tile never gets invalidated | 498 // Tile holds a ref onto a picture pile. If the tile never gets invalidated |
489 // and recreated, then that picture pile ref could exist indefinitely. To | 499 // and recreated, then that picture pile ref could exist indefinitely. To |
490 // prevent this, ask the client to update the pile to its own ref. This | 500 // prevent this, ask the client to update the pile to its own ref. This |
491 // will cause PicturePileImpls and their clones to get deleted once the | 501 // will cause PicturePileImpls and their clones to get deleted once the |
492 // corresponding PictureLayerImpl and any in flight raster jobs go out of | 502 // corresponding PictureLayerImpl and any in flight raster jobs go out of |
493 // scope. | 503 // scope. |
494 client_->UpdatePile(it->second); | 504 client_->UpdatePile(it->second); |
495 } | 505 } |
496 } | 506 } |
497 | 507 |
498 } // namespace cc | 508 } // namespace cc |
OLD | NEW |