| 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 } | 823 } |
| 824 | 824 |
| 825 void PictureLayerImpl::GetContentsResourceId(ResourceId* resource_id, | 825 void PictureLayerImpl::GetContentsResourceId(ResourceId* resource_id, |
| 826 gfx::Size* resource_size) const { | 826 gfx::Size* resource_size) const { |
| 827 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 827 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
| 828 // PictureLayer::Update didn't happen). In that case the pile will be empty. | 828 // PictureLayer::Update didn't happen). In that case the pile will be empty. |
| 829 DCHECK(raster_source_->GetSize().IsEmpty() || | 829 DCHECK(raster_source_->GetSize().IsEmpty() || |
| 830 bounds() == raster_source_->GetSize()) | 830 bounds() == raster_source_->GetSize()) |
| 831 << " bounds " << bounds().ToString() << " pile " | 831 << " bounds " << bounds().ToString() << " pile " |
| 832 << raster_source_->GetSize().ToString(); | 832 << raster_source_->GetSize().ToString(); |
| 833 gfx::Rect content_rect(bounds()); | 833 float dest_scale = MaximumTilingContentsScale(); |
| 834 gfx::Rect content_rect = |
| 835 gfx::ScaleToEnclosingRect(gfx::Rect(bounds()), dest_scale); |
| 834 PictureLayerTilingSet::CoverageIterator iter( | 836 PictureLayerTilingSet::CoverageIterator iter( |
| 835 tilings_.get(), 1.f, content_rect, ideal_contents_scale_); | 837 tilings_.get(), dest_scale, content_rect, ideal_contents_scale_); |
| 836 | 838 |
| 837 // Mask resource not ready yet. | 839 // Mask resource not ready yet. |
| 838 if (!iter || !*iter) { | 840 if (!iter || !*iter) { |
| 839 *resource_id = 0; | 841 *resource_id = 0; |
| 840 return; | 842 return; |
| 841 } | 843 } |
| 842 | 844 |
| 843 // Masks only supported if they fit on exactly one tile. | 845 // Masks only supported if they fit on exactly one tile. |
| 844 DCHECK(iter.geometry_rect() == content_rect) | 846 DCHECK(iter.geometry_rect() == content_rect) |
| 845 << "iter rect " << iter.geometry_rect().ToString() << " content rect " | 847 << "iter rect " << iter.geometry_rect().ToString() << " content rect " |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1335 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1334 return !layer_tree_impl()->IsRecycleTree(); | 1336 return !layer_tree_impl()->IsRecycleTree(); |
| 1335 } | 1337 } |
| 1336 | 1338 |
| 1337 bool PictureLayerImpl::HasValidTilePriorities() const { | 1339 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1338 return IsOnActiveOrPendingTree() && | 1340 return IsOnActiveOrPendingTree() && |
| 1339 is_drawn_render_surface_layer_list_member(); | 1341 is_drawn_render_surface_layer_list_member(); |
| 1340 } | 1342 } |
| 1341 | 1343 |
| 1342 } // namespace cc | 1344 } // namespace cc |
| OLD | NEW |