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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 828 } | 828 } |
| 829 | 829 |
| 830 void PictureLayerImpl::GetContentsResourceId(ResourceId* resource_id, | 830 void PictureLayerImpl::GetContentsResourceId(ResourceId* resource_id, |
| 831 gfx::Size* resource_size) const { | 831 gfx::Size* resource_size) const { |
| 832 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 832 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
| 833 // PictureLayer::Update didn't happen). In that case the pile will be empty. | 833 // PictureLayer::Update didn't happen). In that case the pile will be empty. |
| 834 DCHECK(raster_source_->GetSize().IsEmpty() || | 834 DCHECK(raster_source_->GetSize().IsEmpty() || |
| 835 bounds() == raster_source_->GetSize()) | 835 bounds() == raster_source_->GetSize()) |
| 836 << " bounds " << bounds().ToString() << " pile " | 836 << " bounds " << bounds().ToString() << " pile " |
| 837 << raster_source_->GetSize().ToString(); | 837 << raster_source_->GetSize().ToString(); |
| 838 gfx::Rect content_rect(bounds()); | 838 float dest_scale = MaximumTilingContentsScale(); |
|
enne (OOO)
2016/09/09 21:46:33
I assume both this and the picture_layer_impl_unit
trchen
2016/09/09 23:39:19
Yes. And that DCHECK is important for correctness
| |
| 839 gfx::Rect content_rect = | |
| 840 gfx::ScaleToEnclosingRect(gfx::Rect(bounds()), dest_scale); | |
| 839 PictureLayerTilingSet::CoverageIterator iter( | 841 PictureLayerTilingSet::CoverageIterator iter( |
| 840 tilings_.get(), 1.f, content_rect, ideal_contents_scale_); | 842 tilings_.get(), dest_scale, content_rect, ideal_contents_scale_); |
| 841 | 843 |
| 842 // Mask resource not ready yet. | 844 // Mask resource not ready yet. |
| 843 if (!iter || !*iter) { | 845 if (!iter || !*iter) { |
| 844 *resource_id = 0; | 846 *resource_id = 0; |
| 845 return; | 847 return; |
| 846 } | 848 } |
| 847 | 849 |
| 848 // Masks only supported if they fit on exactly one tile. | 850 // Masks only supported if they fit on exactly one tile. |
| 849 DCHECK(iter.geometry_rect() == content_rect) | 851 DCHECK(iter.geometry_rect() == content_rect) |
| 850 << "iter rect " << iter.geometry_rect().ToString() << " content rect " | 852 << "iter rect " << iter.geometry_rect().ToString() << " content rect " |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1337 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1339 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1338 return !layer_tree_impl()->IsRecycleTree(); | 1340 return !layer_tree_impl()->IsRecycleTree(); |
| 1339 } | 1341 } |
| 1340 | 1342 |
| 1341 bool PictureLayerImpl::HasValidTilePriorities() const { | 1343 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1342 return IsOnActiveOrPendingTree() && | 1344 return IsOnActiveOrPendingTree() && |
| 1343 is_drawn_render_surface_layer_list_member(); | 1345 is_drawn_render_surface_layer_list_member(); |
| 1344 } | 1346 } |
| 1345 | 1347 |
| 1346 } // namespace cc | 1348 } // namespace cc |
| OLD | NEW |