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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/math_util.h" | 8 #include "cc/math_util.h" |
9 #include "ui/gfx/point_conversions.h" | 9 #include "ui/gfx/point_conversions.h" |
10 #include "ui/gfx/rect_conversions.h" | 10 #include "ui/gfx/rect_conversions.h" |
11 #include "ui/gfx/safe_integer_conversions.h" | 11 #include "ui/gfx/safe_integer_conversions.h" |
12 #include "ui/gfx/size_conversions.h" | 12 #include "ui/gfx/size_conversions.h" |
13 | 13 |
14 namespace { | |
15 static bool store_screen_space_quads_on_tiles = false; | |
enne (OOO)
2013/02/12 00:21:13
I agree with Shawn that this isn't great as a stat
| |
16 } | |
17 | |
14 namespace cc { | 18 namespace cc { |
15 | 19 |
20 void PictureLayerTiling::SetStoreScrenSpaceQuadsOnTiles(bool b) { | |
enne (OOO)
2013/02/12 00:21:13
Can you use a better variable name than b?
| |
21 store_screen_space_quads_on_tiles = b; | |
22 } | |
23 | |
16 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( | 24 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( |
17 float contents_scale) { | 25 float contents_scale) { |
18 return make_scoped_ptr(new PictureLayerTiling(contents_scale)); | 26 return make_scoped_ptr(new PictureLayerTiling(contents_scale)); |
19 } | 27 } |
20 | 28 |
21 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Clone() const { | 29 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Clone() const { |
22 return make_scoped_ptr(new PictureLayerTiling(*this)); | 30 return make_scoped_ptr(new PictureLayerTiling(*this)); |
23 } | 31 } |
24 | 32 |
25 PictureLayerTiling::PictureLayerTiling(float contents_scale) | 33 PictureLayerTiling::PictureLayerTiling(float contents_scale) |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 float distance_to_visible_in_pixels = | 444 float distance_to_visible_in_pixels = |
437 TilePriority::manhattanDistance(current_screen_rect, view_rect); | 445 TilePriority::manhattanDistance(current_screen_rect, view_rect); |
438 | 446 |
439 float time_to_visible_in_seconds = | 447 float time_to_visible_in_seconds = |
440 TilePriority::TimeForBoundsToIntersect( | 448 TilePriority::TimeForBoundsToIntersect( |
441 last_screen_rect, current_screen_rect, time_delta, view_rect); | 449 last_screen_rect, current_screen_rect, time_delta, view_rect); |
442 TilePriority priority( | 450 TilePriority priority( |
443 resolution_, | 451 resolution_, |
444 time_to_visible_in_seconds, | 452 time_to_visible_in_seconds, |
445 distance_to_visible_in_pixels); | 453 distance_to_visible_in_pixels); |
454 if (store_screen_space_quads_on_tiles) { | |
455 bool clipped; | |
456 priority.set_current_screen_quad( | |
457 MathUtil::projectQuad(current_screen_transform, | |
enne (OOO)
2013/02/12 00:21:13
In this case, you can just set_current_screen_quad
| |
458 gfx::QuadF(tile_bounds), | |
459 clipped)); | |
460 } | |
446 tile->set_priority(tree, priority); | 461 tile->set_priority(tree, priority); |
447 } | 462 } |
448 } | 463 } |
449 else | 464 else |
450 { | 465 { |
451 for (TilingData::Iterator iter(&tiling_data_, inflated_rect); | 466 for (TilingData::Iterator iter(&tiling_data_, inflated_rect); |
452 iter; ++iter) { | 467 iter; ++iter) { |
453 TileMap::iterator find = tiles_.find(iter.index()); | 468 TileMap::iterator find = tiles_.find(iter.index()); |
454 if (find == tiles_.end()) | 469 if (find == tiles_.end()) |
455 continue; | 470 continue; |
(...skipping 18 matching lines...) Expand all Loading... | |
474 TilePriority::manhattanDistance(current_screen_rect, view_rect); | 489 TilePriority::manhattanDistance(current_screen_rect, view_rect); |
475 | 490 |
476 float time_to_visible_in_seconds = | 491 float time_to_visible_in_seconds = |
477 TilePriority::TimeForBoundsToIntersect( | 492 TilePriority::TimeForBoundsToIntersect( |
478 last_screen_rect, current_screen_rect, time_delta, view_rect); | 493 last_screen_rect, current_screen_rect, time_delta, view_rect); |
479 | 494 |
480 TilePriority priority( | 495 TilePriority priority( |
481 resolution_, | 496 resolution_, |
482 time_to_visible_in_seconds, | 497 time_to_visible_in_seconds, |
483 distance_to_visible_in_pixels); | 498 distance_to_visible_in_pixels); |
499 if (store_screen_space_quads_on_tiles) { | |
500 bool clipped; | |
501 priority.set_current_screen_quad( | |
502 MathUtil::projectQuad(current_screen_transform, | |
503 gfx::QuadF(tile_bounds), | |
enne (OOO)
2013/02/12 00:21:13
Here's your low res issue: s/tile_bounds/current_l
| |
504 clipped)); | |
505 } | |
484 tile->set_priority(tree, priority); | 506 tile->set_priority(tree, priority); |
485 } | 507 } |
486 } | 508 } |
487 | 509 |
488 last_source_frame_number_ = current_source_frame_number; | 510 last_source_frame_number_ = current_source_frame_number; |
489 last_impl_frame_time_ = current_frame_time; | 511 last_impl_frame_time_ = current_frame_time; |
490 } | 512 } |
491 | 513 |
492 void PictureLayerTiling::DidBecomeActive() { | 514 void PictureLayerTiling::DidBecomeActive() { |
493 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 515 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
494 it->second->set_priority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); | 516 it->second->set_priority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); |
495 it->second->set_priority(PENDING_TREE, TilePriority()); | 517 it->second->set_priority(PENDING_TREE, TilePriority()); |
496 | 518 |
497 // Tile holds a ref onto a picture pile. If the tile never gets invalidated | 519 // Tile holds a ref onto a picture pile. If the tile never gets invalidated |
498 // and recreated, then that picture pile ref could exist indefinitely. To | 520 // and recreated, then that picture pile ref could exist indefinitely. To |
499 // prevent this, ask the client to update the pile to its own ref. This | 521 // prevent this, ask the client to update the pile to its own ref. This |
500 // will cause PicturePileImpls and their clones to get deleted once the | 522 // will cause PicturePileImpls and their clones to get deleted once the |
501 // corresponding PictureLayerImpl and any in flight raster jobs go out of | 523 // corresponding PictureLayerImpl and any in flight raster jobs go out of |
502 // scope. | 524 // scope. |
503 client_->UpdatePile(it->second); | 525 client_->UpdatePile(it->second); |
504 } | 526 } |
505 } | 527 } |
506 | 528 |
507 } // namespace cc | 529 } // namespace cc |
OLD | NEW |