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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 // TODO(danakj): We should always get an occlusion tracker when we are using | 392 // TODO(danakj): We should always get an occlusion tracker when we are using |
393 // occlusion, so update this check when we don't use a pending tree in the | 393 // occlusion, so update this check when we don't use a pending tree in the |
394 // browser compositor. | 394 // browser compositor. |
395 DCHECK(!occlusion_tracker || | 395 DCHECK(!occlusion_tracker || |
396 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization); | 396 layer_tree_impl()->settings().use_occlusion_for_tile_prioritization); |
397 | 397 |
398 // Transforms and viewport are invalid for tile management inside a | 398 // Transforms and viewport are invalid for tile management inside a |
399 // resourceless software draw, so don't update them. | 399 // resourceless software draw, so don't update them. |
400 if (!layer_tree_impl()->resourceless_software_draw()) { | 400 if (!layer_tree_impl()->resourceless_software_draw()) { |
401 visible_rect_for_tile_priority_ = visible_content_rect(); | 401 visible_rect_for_tile_priority_ = visible_content_rect(); |
402 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); | 402 viewport_rect_for_tile_priority_ = layer_tree_impl()->TilingViewportRect(); |
403 screen_space_transform_for_tile_priority_ = screen_space_transform(); | 403 screen_space_transform_for_tile_priority_ = screen_space_transform(); |
aelias_OOO_until_Jul13
2014/07/16 00:32:56
Instead of the double-ProjectClippedRect below, wo
hush (inactive)
2014/07/16 20:45:32
That works.
Done.
On 2014/07/16 00:32:56, aelias
| |
404 } | 404 } |
405 | 405 |
406 if (!CanHaveTilings()) { | 406 if (!CanHaveTilings()) { |
407 ideal_page_scale_ = 0.f; | 407 ideal_page_scale_ = 0.f; |
408 ideal_device_scale_ = 0.f; | 408 ideal_device_scale_ = 0.f; |
409 ideal_contents_scale_ = 0.f; | 409 ideal_contents_scale_ = 0.f; |
410 ideal_source_scale_ = 0.f; | 410 ideal_source_scale_ = 0.f; |
411 SanityCheckTilingState(); | 411 SanityCheckTilingState(); |
412 return; | 412 return; |
413 } | 413 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 450 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
451 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( | 451 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( |
452 current_frame_time_in_seconds)) { | 452 current_frame_time_in_seconds)) { |
453 tiling_needs_update = true; | 453 tiling_needs_update = true; |
454 break; | 454 break; |
455 } | 455 } |
456 } | 456 } |
457 if (!tiling_needs_update) | 457 if (!tiling_needs_update) |
458 return; | 458 return; |
459 | 459 |
460 // Use visible_content_rect, unless it's empty. If it's empty, then | 460 // If visible_rect_for_tile_priority_ is empty or |
461 // try to inverse project the viewport into layer space and use that. | 461 // LayerTreeImpl::TilingViewportRect is set to be different from the device |
462 // viewport, try to inverse project the viewport into layer space and use | |
463 // that. Otherwise just use visible_rect_for_tile_priority_ | |
462 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; | 464 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; |
463 if (visible_rect_in_content_space.IsEmpty()) { | 465 if (visible_rect_in_content_space.IsEmpty() || |
aelias_OOO_until_Jul13
2014/07/16 00:32:56
|| !layer_tree_impl()->TilingTransform().IsIdentit
hush (inactive)
2014/07/16 20:45:32
Done.
| |
464 gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); | 466 layer_tree_impl()->DrawViewportSize() != |
465 if (screen_space_transform_for_tile_priority_.GetInverse( | 467 layer_tree_impl()->TilingViewportRect().size()) { |
466 &screen_to_layer)) { | 468 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); |
469 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization); | |
470 if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer) && | |
471 layer_tree_impl()->TilingTransform().GetInverse(&screen_to_view)) { | |
472 // Transform the tiling viewport rect from screen to view space. | |
473 gfx::Rect viewport_rect_in_view_space = | |
474 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | |
475 screen_to_view, layer_tree_impl()->TilingViewportRect())); | |
476 | |
477 // Transform from view space to content space. | |
467 visible_rect_in_content_space = | 478 visible_rect_in_content_space = |
468 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 479 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
469 screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); | 480 view_to_layer, viewport_rect_in_view_space)); |
481 | |
470 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); | 482 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); |
471 } | 483 } |
472 } | 484 } |
473 | 485 |
474 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( | 486 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
475 visible_rect_in_content_space, 1.f / contents_scale_x()); | 487 visible_rect_in_content_space, 1.f / contents_scale_x()); |
476 WhichTree tree = | 488 WhichTree tree = |
477 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 489 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
478 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 490 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
479 tilings_->tiling_at(i)->UpdateTilePriorities(tree, | 491 tilings_->tiling_at(i)->UpdateTilePriorities(tree, |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1635 return iterator_index_ < iterators_.size(); | 1647 return iterator_index_ < iterators_.size(); |
1636 } | 1648 } |
1637 | 1649 |
1638 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1650 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1639 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1651 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1640 return it->get_type() == iteration_stage_ && | 1652 return it->get_type() == iteration_stage_ && |
1641 (**it)->required_for_activation() == required_for_activation_; | 1653 (**it)->required_for_activation() == required_for_activation_; |
1642 } | 1654 } |
1643 | 1655 |
1644 } // namespace cc | 1656 } // namespace cc |
OLD | NEW |