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 <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 AddDamageRect(layer_damage_rect); | 582 AddDamageRect(layer_damage_rect); |
583 } | 583 } |
584 } | 584 } |
585 | 585 |
586 void PictureLayerImpl::DidBeginTracing() { | 586 void PictureLayerImpl::DidBeginTracing() { |
587 raster_source_->DidBeginTracing(); | 587 raster_source_->DidBeginTracing(); |
588 } | 588 } |
589 | 589 |
590 void PictureLayerImpl::ReleaseResources() { | 590 void PictureLayerImpl::ReleaseResources() { |
591 // Recreate tilings with new settings, since some of those might change when | 591 // Recreate tilings with new settings, since some of those might change when |
592 // we release resources. If tilings_ is null, then leave it as null. | 592 // we release resources. |
593 if (tilings_) | 593 tilings_ = CreatePictureLayerTilingSet(); |
594 tilings_ = CreatePictureLayerTilingSet(); | |
595 ResetRasterScale(); | 594 ResetRasterScale(); |
596 | 595 |
597 // To avoid an edge case after lost context where the tree is up to date but | 596 // To avoid an edge case after lost context where the tree is up to date but |
598 // the tilings have not been managed, request an update draw properties | 597 // the tilings have not been managed, request an update draw properties |
599 // to force tilings to get managed. | 598 // to force tilings to get managed. |
600 layer_tree_impl()->set_needs_update_draw_properties(); | 599 layer_tree_impl()->set_needs_update_draw_properties(); |
601 } | 600 } |
602 | 601 |
603 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 602 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
604 return raster_source_->GetFlattenedPicture(); | 603 return raster_source_->GetFlattenedPicture(); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 776 |
778 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { | 777 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { |
779 DCHECK(CanHaveTilings()); | 778 DCHECK(CanHaveTilings()); |
780 DCHECK_GE(contents_scale, MinimumContentsScale()); | 779 DCHECK_GE(contents_scale, MinimumContentsScale()); |
781 DCHECK_LE(contents_scale, MaximumContentsScale()); | 780 DCHECK_LE(contents_scale, MaximumContentsScale()); |
782 DCHECK(raster_source_->HasRecordings()); | 781 DCHECK(raster_source_->HasRecordings()); |
783 return tilings_->AddTiling(contents_scale, raster_source_); | 782 return tilings_->AddTiling(contents_scale, raster_source_); |
784 } | 783 } |
785 | 784 |
786 void PictureLayerImpl::RemoveAllTilings() { | 785 void PictureLayerImpl::RemoveAllTilings() { |
787 if (tilings_) | 786 tilings_->RemoveAllTilings(); |
788 tilings_->RemoveAllTilings(); | |
789 // If there are no tilings, then raster scales are no longer meaningful. | 787 // If there are no tilings, then raster scales are no longer meaningful. |
790 ResetRasterScale(); | 788 ResetRasterScale(); |
791 } | 789 } |
792 | 790 |
793 void PictureLayerImpl::AddTilingsForRasterScale() { | 791 void PictureLayerImpl::AddTilingsForRasterScale() { |
794 // Reset all resolution enums on tilings, we'll be setting new values in this | 792 // Reset all resolution enums on tilings, we'll be setting new values in this |
795 // function. | 793 // function. |
796 tilings_->MarkAllTilingsNonIdeal(); | 794 tilings_->MarkAllTilingsNonIdeal(); |
797 | 795 |
798 PictureLayerTiling* high_res = | 796 PictureLayerTiling* high_res = |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 | 1284 |
1287 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | 1285 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { |
1288 if (!layer_tree_impl()->IsActiveTree()) | 1286 if (!layer_tree_impl()->IsActiveTree()) |
1289 return true; | 1287 return true; |
1290 | 1288 |
1291 return AllTilesRequiredAreReadyToDraw( | 1289 return AllTilesRequiredAreReadyToDraw( |
1292 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); | 1290 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); |
1293 } | 1291 } |
1294 | 1292 |
1295 } // namespace cc | 1293 } // namespace cc |
OLD | NEW |