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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 DCHECK_IMPLIES(raster_source_->IsSolidColor(), | 136 DCHECK_IMPLIES(raster_source_->IsSolidColor(), |
137 layer_impl->tilings_->num_tilings() == 0); | 137 layer_impl->tilings_->num_tilings() == 0); |
138 | 138 |
139 layer_impl->raster_page_scale_ = raster_page_scale_; | 139 layer_impl->raster_page_scale_ = raster_page_scale_; |
140 layer_impl->raster_device_scale_ = raster_device_scale_; | 140 layer_impl->raster_device_scale_ = raster_device_scale_; |
141 layer_impl->raster_source_scale_ = raster_source_scale_; | 141 layer_impl->raster_source_scale_ = raster_source_scale_; |
142 layer_impl->raster_contents_scale_ = raster_contents_scale_; | 142 layer_impl->raster_contents_scale_ = raster_contents_scale_; |
143 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; | 143 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; |
144 | 144 |
145 layer_impl->SanityCheckTilingState(); | 145 layer_impl->SanityCheckTilingState(); |
| 146 |
| 147 // We always need to push properties. |
| 148 // See http://crbug.com/303943 |
| 149 // TODO(danakj): Stop always pushing properties since we don't swap tilings. |
| 150 needs_push_properties_ = true; |
146 } | 151 } |
147 | 152 |
148 void PictureLayerImpl::AppendQuads(RenderPass* render_pass, | 153 void PictureLayerImpl::AppendQuads(RenderPass* render_pass, |
149 const Occlusion& occlusion_in_content_space, | 154 const Occlusion& occlusion_in_content_space, |
150 AppendQuadsData* append_quads_data) { | 155 AppendQuadsData* append_quads_data) { |
151 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 156 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
152 // PictureLayer::Update didn't happen). In that case the pile will be empty. | 157 // PictureLayer::Update didn't happen). In that case the pile will be empty. |
153 DCHECK_IMPLIES(!raster_source_->GetSize().IsEmpty(), | 158 DCHECK_IMPLIES(!raster_source_->GetSize().IsEmpty(), |
154 bounds() == raster_source_->GetSize()) | 159 bounds() == raster_source_->GetSize()) |
155 << " bounds " << bounds().ToString() << " pile " | 160 << " bounds " << bounds().ToString() << " pile " |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 // access the invalidation through the PictureLayerTilingClient interface. | 555 // access the invalidation through the PictureLayerTilingClient interface. |
551 invalidation_.Clear(); | 556 invalidation_.Clear(); |
552 invalidation_.Swap(new_invalidation); | 557 invalidation_.Swap(new_invalidation); |
553 | 558 |
554 bool can_have_tilings = CanHaveTilings(); | 559 bool can_have_tilings = CanHaveTilings(); |
555 | 560 |
556 // Need to call UpdateTiles again if CanHaveTilings changed. | 561 // Need to call UpdateTiles again if CanHaveTilings changed. |
557 if (could_have_tilings != can_have_tilings) | 562 if (could_have_tilings != can_have_tilings) |
558 layer_tree_impl()->set_needs_update_draw_properties(); | 563 layer_tree_impl()->set_needs_update_draw_properties(); |
559 | 564 |
560 // SetNeedsPushProperties when changing the raster source. This shouldn't | |
561 // imply damage but need to be synced. | |
562 SetNeedsPushProperties(); | |
563 | |
564 if (!can_have_tilings) { | 565 if (!can_have_tilings) { |
565 RemoveAllTilings(); | 566 RemoveAllTilings(); |
566 return; | 567 return; |
567 } | 568 } |
568 | 569 |
569 // We could do this after doing UpdateTiles, which would avoid doing this for | 570 // We could do this after doing UpdateTiles, which would avoid doing this for |
570 // tilings that are going to disappear on the pending tree (if scale changed). | 571 // tilings that are going to disappear on the pending tree (if scale changed). |
571 // But that would also be more complicated, so we just do it here for now. | 572 // But that would also be more complicated, so we just do it here for now. |
572 tilings_->UpdateTilingsToCurrentRasterSource( | 573 tilings_->UpdateTilingsToCurrentRasterSource( |
573 raster_source_, pending_set, invalidation_, MinimumContentsScale(), | 574 raster_source_, pending_set, invalidation_, MinimumContentsScale(), |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { | 649 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { |
649 if (!HasValidTilePriorities()) | 650 if (!HasValidTilePriorities()) |
650 return TilePriority::EVENTUALLY; | 651 return TilePriority::EVENTUALLY; |
651 return TilePriority::NOW; | 652 return TilePriority::NOW; |
652 } | 653 } |
653 | 654 |
654 bool PictureLayerImpl::RequiresHighResToDraw() const { | 655 bool PictureLayerImpl::RequiresHighResToDraw() const { |
655 return layer_tree_impl()->RequiresHighResToDraw(); | 656 return layer_tree_impl()->RequiresHighResToDraw(); |
656 } | 657 } |
657 | 658 |
658 void PictureLayerImpl::TilingLiveRectChanged() { | |
659 // SetNeedsPushProperties when the live rect changes, as there are new tiles | |
660 // on the tree. This shouldn't imply damage but need to be synced. | |
661 SetNeedsPushProperties(); | |
662 } | |
663 | |
664 gfx::Size PictureLayerImpl::CalculateTileSize( | 659 gfx::Size PictureLayerImpl::CalculateTileSize( |
665 const gfx::Size& content_bounds) const { | 660 const gfx::Size& content_bounds) const { |
666 int max_texture_size = | 661 int max_texture_size = |
667 layer_tree_impl()->resource_provider()->max_texture_size(); | 662 layer_tree_impl()->resource_provider()->max_texture_size(); |
668 | 663 |
669 if (is_mask_) { | 664 if (is_mask_) { |
670 // Masks are not tiled, so if we can't cover the whole mask with one tile, | 665 // Masks are not tiled, so if we can't cover the whole mask with one tile, |
671 // we shouldn't have such a tiling at all. | 666 // we shouldn't have such a tiling at all. |
672 DCHECK_LE(content_bounds.width(), max_texture_size); | 667 DCHECK_LE(content_bounds.width(), max_texture_size); |
673 DCHECK_LE(content_bounds.height(), max_texture_size); | 668 DCHECK_LE(content_bounds.height(), max_texture_size); |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 | 1286 |
1292 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | 1287 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { |
1293 if (!layer_tree_impl()->IsActiveTree()) | 1288 if (!layer_tree_impl()->IsActiveTree()) |
1294 return true; | 1289 return true; |
1295 | 1290 |
1296 return AllTilesRequiredAreReadyToDraw( | 1291 return AllTilesRequiredAreReadyToDraw( |
1297 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); | 1292 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); |
1298 } | 1293 } |
1299 | 1294 |
1300 } // namespace cc | 1295 } // namespace cc |
OLD | NEW |