Chromium Code Reviews| 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 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 | 471 |
| 472 should_update_tile_priorities_ = true; | 472 should_update_tile_priorities_ = true; |
| 473 | 473 |
| 474 UpdateTilePriorities(occlusion_tracker); | 474 UpdateTilePriorities(occlusion_tracker); |
| 475 | 475 |
| 476 if (layer_tree_impl()->IsPendingTree()) | 476 if (layer_tree_impl()->IsPendingTree()) |
| 477 MarkVisibleResourcesAsRequired(); | 477 MarkVisibleResourcesAsRequired(); |
| 478 } | 478 } |
| 479 | 479 |
| 480 void PictureLayerImpl::UpdateTilePriorities( | 480 void PictureLayerImpl::UpdateTilePriorities( |
| 481 const OcclusionTracker<LayerImpl>* occlusion_tracker) { | 481 const OcclusionTracker<LayerImpl>* occlusion_tracker) { |
|
danakj
2014/09/09 15:14:39
even better is pass in the OcclusionChecker instea
vmpstr
2014/09/09 21:56:56
Done. I'm passing occlusion to UpdateTiles. That w
| |
| 482 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | 482 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); |
| 483 | 483 |
| 484 double current_frame_time_in_seconds = | 484 double current_frame_time_in_seconds = |
| 485 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - | 485 (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - |
| 486 base::TimeTicks()).InSecondsF(); | 486 base::TimeTicks()).InSecondsF(); |
| 487 | 487 |
| 488 bool tiling_needs_update = false; | 488 bool tiling_needs_update = false; |
| 489 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 489 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 490 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( | 490 if (tilings_->tiling_at(i)->NeedsUpdateForFrameAtTime( |
| 491 current_frame_time_in_seconds)) { | 491 current_frame_time_in_seconds)) { |
| 492 tiling_needs_update = true; | 492 tiling_needs_update = true; |
| 493 break; | 493 break; |
| 494 } | 494 } |
| 495 } | 495 } |
| 496 if (!tiling_needs_update) | 496 if (!tiling_needs_update) |
| 497 return; | 497 return; |
| 498 | 498 |
| 499 gfx::Rect visible_rect_in_content_space( | 499 gfx::Rect visible_rect_in_content_space( |
| 500 GetViewportForTilePriorityInContentSpace()); | 500 GetViewportForTilePriorityInContentSpace()); |
| 501 visible_rect_in_content_space.Intersect(visible_content_rect()); | 501 visible_rect_in_content_space.Intersect(visible_content_rect()); |
| 502 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( | 502 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
| 503 visible_rect_in_content_space, 1.f / contents_scale_x()); | 503 visible_rect_in_content_space, 1.f / contents_scale_x()); |
| 504 WhichTree tree = | 504 WhichTree tree = |
| 505 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 505 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 506 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 506 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 507 tilings_->tiling_at(i)->UpdateTilePriorities(tree, | 507 tilings_->tiling_at(i)->UpdateTilePriorities( |
| 508 visible_layer_rect, | 508 tree, |
| 509 ideal_contents_scale_, | 509 visible_layer_rect, |
| 510 current_frame_time_in_seconds, | 510 ideal_contents_scale_, |
| 511 occlusion_tracker, | 511 current_frame_time_in_seconds, |
| 512 render_target(), | 512 occlusion_tracker |
| 513 draw_transform()); | 513 ? occlusion_tracker->GenerateOcclusionChecker(draw_transform()) |
| 514 : OcclusionChecker<LayerImpl>()); | |
| 514 } | 515 } |
| 515 | 516 |
| 516 // Tile priorities were modified. | 517 // Tile priorities were modified. |
| 517 layer_tree_impl()->DidModifyTilePriorities(); | 518 layer_tree_impl()->DidModifyTilePriorities(); |
| 518 } | 519 } |
| 519 | 520 |
| 520 gfx::Rect PictureLayerImpl::GetViewportForTilePriorityInContentSpace() const { | 521 gfx::Rect PictureLayerImpl::GetViewportForTilePriorityInContentSpace() const { |
| 521 // If visible_rect_for_tile_priority_ is empty or | 522 // If visible_rect_for_tile_priority_ is empty or |
| 522 // viewport_rect_for_tile_priority_ is set to be different from the device | 523 // viewport_rect_for_tile_priority_ is set to be different from the device |
| 523 // viewport, try to inverse project the viewport into layer space and use | 524 // viewport, try to inverse project the viewport into layer space and use |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1773 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1774 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1774 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1775 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1775 return tiling_range.end - 1 - current_tiling_range_offset; | 1776 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1776 } | 1777 } |
| 1777 } | 1778 } |
| 1778 NOTREACHED(); | 1779 NOTREACHED(); |
| 1779 return 0; | 1780 return 0; |
| 1780 } | 1781 } |
| 1781 | 1782 |
| 1782 } // namespace cc | 1783 } // namespace cc |
| OLD | NEW |