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 <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 raster_contents_scale_ = SnappedContentsScale(desired_contents_scale); | 1104 raster_contents_scale_ = SnappedContentsScale(desired_contents_scale); |
1105 raster_page_scale_ = | 1105 raster_page_scale_ = |
1106 raster_contents_scale_ / raster_device_scale_ / raster_source_scale_; | 1106 raster_contents_scale_ / raster_device_scale_ / raster_source_scale_; |
1107 } | 1107 } |
1108 | 1108 |
1109 raster_contents_scale_ = | 1109 raster_contents_scale_ = |
1110 std::max(raster_contents_scale_, MinimumContentsScale()); | 1110 std::max(raster_contents_scale_, MinimumContentsScale()); |
1111 | 1111 |
1112 // Since we're not re-rasterizing during animation, rasterize at the maximum | 1112 // Since we're not re-rasterizing during animation, rasterize at the maximum |
1113 // scale that will occur during the animation, if the maximum scale is | 1113 // scale that will occur during the animation, if the maximum scale is |
1114 // known. | 1114 // known. However, to avoid excessive memory use, don't rasterize at a scale |
| 1115 // at which this layer would become larger than the viewport. |
1115 if (draw_properties().screen_space_transform_is_animating) { | 1116 if (draw_properties().screen_space_transform_is_animating) { |
| 1117 bool can_raster_at_maximum_scale = false; |
1116 if (draw_properties().maximum_animation_contents_scale > 0.f) { | 1118 if (draw_properties().maximum_animation_contents_scale > 0.f) { |
| 1119 gfx::Size bounds_at_maximum_scale = gfx::ToCeiledSize(gfx::ScaleSize( |
| 1120 bounds(), draw_properties().maximum_animation_contents_scale)); |
| 1121 if (bounds_at_maximum_scale.GetArea() <= |
| 1122 layer_tree_impl()->device_viewport_size().GetArea()) |
| 1123 can_raster_at_maximum_scale = true; |
| 1124 } |
| 1125 if (can_raster_at_maximum_scale) { |
1117 raster_contents_scale_ = | 1126 raster_contents_scale_ = |
1118 std::max(raster_contents_scale_, | 1127 std::max(raster_contents_scale_, |
1119 draw_properties().maximum_animation_contents_scale); | 1128 draw_properties().maximum_animation_contents_scale); |
1120 } else { | 1129 } else { |
1121 raster_contents_scale_ = | 1130 raster_contents_scale_ = |
1122 std::max(raster_contents_scale_, | 1131 std::max(raster_contents_scale_, |
1123 1.f * ideal_page_scale_ * ideal_device_scale_); | 1132 1.f * ideal_page_scale_ * ideal_device_scale_); |
1124 } | 1133 } |
1125 } | 1134 } |
1126 | 1135 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 return iterator_index_ < iterators_.size(); | 1638 return iterator_index_ < iterators_.size(); |
1630 } | 1639 } |
1631 | 1640 |
1632 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1641 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1633 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1642 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1634 return it->get_type() == iteration_stage_ && | 1643 return it->get_type() == iteration_stage_ && |
1635 (**it)->required_for_activation() == required_for_activation_; | 1644 (**it)->required_for_activation() == required_for_activation_; |
1636 } | 1645 } |
1637 | 1646 |
1638 } // namespace cc | 1647 } // namespace cc |
OLD | NEW |