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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 << " bounds " << bounds().ToString() << " pile " | 570 << " bounds " << bounds().ToString() << " pile " |
571 << raster_source->GetSize().ToString(); | 571 << raster_source->GetSize().ToString(); |
572 | 572 |
573 // The |raster_source_| is initially null, so have to check for that for the | 573 // The |raster_source_| is initially null, so have to check for that for the |
574 // first frame. | 574 // first frame. |
575 bool could_have_tilings = raster_source_.get() && CanHaveTilings(); | 575 bool could_have_tilings = raster_source_.get() && CanHaveTilings(); |
576 raster_source_.swap(raster_source); | 576 raster_source_.swap(raster_source); |
577 | 577 |
578 // Only set the image decode controller when we're committing. | 578 // Only set the image decode controller when we're committing. |
579 if (!pending_set) { | 579 if (!pending_set) { |
580 raster_source_->set_image_decode_controller( | 580 raster_source_->set_image_decode_cache( |
581 layer_tree_impl()->image_decode_controller()); | 581 layer_tree_impl()->image_decode_cache()); |
582 } | 582 } |
583 | 583 |
584 // The |new_invalidation| must be cleared before updating tilings since they | 584 // The |new_invalidation| must be cleared before updating tilings since they |
585 // access the invalidation through the PictureLayerTilingClient interface. | 585 // access the invalidation through the PictureLayerTilingClient interface. |
586 invalidation_.Clear(); | 586 invalidation_.Clear(); |
587 invalidation_.Swap(new_invalidation); | 587 invalidation_.Swap(new_invalidation); |
588 | 588 |
589 bool can_have_tilings = CanHaveTilings(); | 589 bool can_have_tilings = CanHaveTilings(); |
590 DCHECK(!pending_set || | 590 DCHECK(!pending_set || |
591 can_have_tilings == GetPendingOrActiveTwinLayer()->CanHaveTilings()); | 591 can_have_tilings == GetPendingOrActiveTwinLayer()->CanHaveTilings()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 } | 672 } |
673 | 673 |
674 void PictureLayerImpl::ReleaseTileResources() { | 674 void PictureLayerImpl::ReleaseTileResources() { |
675 // All resources are tile resources. | 675 // All resources are tile resources. |
676 ReleaseResources(); | 676 ReleaseResources(); |
677 } | 677 } |
678 | 678 |
679 void PictureLayerImpl::RecreateTileResources() { | 679 void PictureLayerImpl::RecreateTileResources() { |
680 tilings_ = CreatePictureLayerTilingSet(); | 680 tilings_ = CreatePictureLayerTilingSet(); |
681 if (raster_source_) { | 681 if (raster_source_) { |
682 raster_source_->set_image_decode_controller( | 682 raster_source_->set_image_decode_cache( |
683 layer_tree_impl()->image_decode_controller()); | 683 layer_tree_impl()->image_decode_cache()); |
684 } | 684 } |
685 } | 685 } |
686 | 686 |
687 Region PictureLayerImpl::GetInvalidationRegionForDebugging() { | 687 Region PictureLayerImpl::GetInvalidationRegionForDebugging() { |
688 // |invalidation_| gives the invalidation contained in the source frame, but | 688 // |invalidation_| gives the invalidation contained in the source frame, but |
689 // is not cleared after drawing from the layer. However, update_rect() is | 689 // is not cleared after drawing from the layer. However, update_rect() is |
690 // cleared once the invalidation is drawn, which is useful for debugging | 690 // cleared once the invalidation is drawn, which is useful for debugging |
691 // visualizations. This method intersects the two to give a more exact | 691 // visualizations. This method intersects the two to give a more exact |
692 // representation of what was invalidated that is cleared after drawing. | 692 // representation of what was invalidated that is cleared after drawing. |
693 return IntersectRegions(invalidation_, update_rect()); | 693 return IntersectRegions(invalidation_, update_rect()); |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1342 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1343 return !layer_tree_impl()->IsRecycleTree(); | 1343 return !layer_tree_impl()->IsRecycleTree(); |
1344 } | 1344 } |
1345 | 1345 |
1346 bool PictureLayerImpl::HasValidTilePriorities() const { | 1346 bool PictureLayerImpl::HasValidTilePriorities() const { |
1347 return IsOnActiveOrPendingTree() && | 1347 return IsOnActiveOrPendingTree() && |
1348 is_drawn_render_surface_layer_list_member(); | 1348 is_drawn_render_surface_layer_list_member(); |
1349 } | 1349 } |
1350 | 1350 |
1351 } // namespace cc | 1351 } // namespace cc |
OLD | NEW |