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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 418 |
419 DCHECK(raster_page_scale_); | 419 DCHECK(raster_page_scale_); |
420 DCHECK(raster_device_scale_); | 420 DCHECK(raster_device_scale_); |
421 DCHECK(raster_source_scale_); | 421 DCHECK(raster_source_scale_); |
422 DCHECK(raster_contents_scale_); | 422 DCHECK(raster_contents_scale_); |
423 DCHECK(low_res_raster_contents_scale_); | 423 DCHECK(low_res_raster_contents_scale_); |
424 | 424 |
425 was_screen_space_transform_animating_ = | 425 was_screen_space_transform_animating_ = |
426 draw_properties().screen_space_transform_is_animating; | 426 draw_properties().screen_space_transform_is_animating; |
427 | 427 |
428 // TODO(sohanjg): Avoid needlessly update priorities when syncing to a | |
429 // non-updated tree which will then be updated immediately afterwards. | |
430 should_update_tile_priorities_ = true; | 428 should_update_tile_priorities_ = true; |
431 | 429 |
432 UpdateTilePriorities(); | 430 UpdateTilePriorities(); |
433 | 431 |
434 if (layer_tree_impl()->IsPendingTree()) | 432 if (layer_tree_impl()->IsPendingTree()) |
435 MarkVisibleResourcesAsRequired(); | 433 MarkVisibleResourcesAsRequired(); |
436 } | 434 } |
437 | 435 |
438 void PictureLayerImpl::UpdateTilePriorities() { | 436 void PictureLayerImpl::UpdateTilePriorities() { |
439 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | 437 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); |
(...skipping 25 matching lines...) Expand all Loading... |
465 screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); | 463 screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); |
466 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); | 464 visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); |
467 } | 465 } |
468 } | 466 } |
469 | 467 |
470 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( | 468 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
471 visible_rect_in_content_space, 1.f / contents_scale_x()); | 469 visible_rect_in_content_space, 1.f / contents_scale_x()); |
472 WhichTree tree = | 470 WhichTree tree = |
473 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 471 layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
474 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 472 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
475 // TODO(sohanjg): Passing MaximumContentsScale as layer contents scale | |
476 // in UpdateTilePriorities is wrong and should be ideal contents scale. | |
477 tilings_->tiling_at(i)->UpdateTilePriorities(tree, | 473 tilings_->tiling_at(i)->UpdateTilePriorities(tree, |
478 visible_layer_rect, | 474 visible_layer_rect, |
479 MaximumTilingContentsScale(), | 475 ideal_contents_scale_, |
480 current_frame_time_in_seconds); | 476 current_frame_time_in_seconds); |
481 } | 477 } |
482 | 478 |
483 // Tile priorities were modified. | 479 // Tile priorities were modified. |
484 layer_tree_impl()->DidModifyTilePriorities(); | 480 layer_tree_impl()->DidModifyTilePriorities(); |
485 } | 481 } |
486 | 482 |
487 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 483 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
488 if (layer_tree_impl()->IsActiveTree()) { | 484 if (layer_tree_impl()->IsActiveTree()) { |
489 gfx::RectF layer_damage_rect = | 485 gfx::RectF layer_damage_rect = |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 return iterator_index_ < iterators_.size(); | 1609 return iterator_index_ < iterators_.size(); |
1614 } | 1610 } |
1615 | 1611 |
1616 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1612 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1617 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1613 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1618 return it->get_type() == iteration_stage_ && | 1614 return it->get_type() == iteration_stage_ && |
1619 (**it)->required_for_activation() == required_for_activation_; | 1615 (**it)->required_for_activation() == required_for_activation_; |
1620 } | 1616 } |
1621 | 1617 |
1622 } // namespace cc | 1618 } // namespace cc |
OLD | NEW |