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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 high_res->set_resolution(HIGH_RESOLUTION); | 1027 high_res->set_resolution(HIGH_RESOLUTION); |
1028 | 1028 |
1029 SanityCheckTilingState(); | 1029 SanityCheckTilingState(); |
1030 } | 1030 } |
1031 | 1031 |
1032 bool PictureLayerImpl::ShouldAdjustRasterScale( | 1032 bool PictureLayerImpl::ShouldAdjustRasterScale( |
1033 bool animating_transform_to_screen) const { | 1033 bool animating_transform_to_screen) const { |
1034 if (was_animating_transform_to_screen_ != animating_transform_to_screen) | 1034 if (was_animating_transform_to_screen_ != animating_transform_to_screen) |
1035 return true; | 1035 return true; |
1036 | 1036 |
1037 if (animating_transform_to_screen && | |
1038 raster_contents_scale_ != ideal_contents_scale_ && | |
1039 use_gpu_rasterization()) | |
1040 return true; | |
1041 | |
1042 bool is_pinching = layer_tree_impl()->PinchGestureActive(); | 1037 bool is_pinching = layer_tree_impl()->PinchGestureActive(); |
1043 if (is_pinching && raster_page_scale_) { | 1038 if (is_pinching && raster_page_scale_) { |
1044 // We change our raster scale when it is: | 1039 // We change our raster scale when it is: |
1045 // - Higher than ideal (need a lower-res tiling available) | 1040 // - Higher than ideal (need a lower-res tiling available) |
1046 // - Too far from ideal (need a higher-res tiling available) | 1041 // - Too far from ideal (need a higher-res tiling available) |
1047 float ratio = ideal_page_scale_ / raster_page_scale_; | 1042 float ratio = ideal_page_scale_ / raster_page_scale_; |
1048 if (raster_page_scale_ > ideal_page_scale_ || | 1043 if (raster_page_scale_ > ideal_page_scale_ || |
1049 ratio > kMaxScaleRatioDuringPinch) | 1044 ratio > kMaxScaleRatioDuringPinch) |
1050 return true; | 1045 return true; |
1051 } | 1046 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 zooming_out ? old_raster_contents_scale / kMaxScaleRatioDuringPinch | 1121 zooming_out ? old_raster_contents_scale / kMaxScaleRatioDuringPinch |
1127 : old_raster_contents_scale * kMaxScaleRatioDuringPinch; | 1122 : old_raster_contents_scale * kMaxScaleRatioDuringPinch; |
1128 raster_contents_scale_ = SnappedContentsScale(desired_contents_scale); | 1123 raster_contents_scale_ = SnappedContentsScale(desired_contents_scale); |
1129 raster_page_scale_ = | 1124 raster_page_scale_ = |
1130 raster_contents_scale_ / raster_device_scale_ / raster_source_scale_; | 1125 raster_contents_scale_ / raster_device_scale_ / raster_source_scale_; |
1131 } | 1126 } |
1132 | 1127 |
1133 raster_contents_scale_ = | 1128 raster_contents_scale_ = |
1134 std::max(raster_contents_scale_, MinimumContentsScale()); | 1129 std::max(raster_contents_scale_, MinimumContentsScale()); |
1135 | 1130 |
1136 // If we're not re-rasterizing during animation, rasterize at the maximum | 1131 // Since we're not re-rasterizing during animation, rasterize at the maximum |
1137 // scale that will occur during the animation, if the maximum scale is | 1132 // scale that will occur during the animation, if the maximum scale is |
1138 // known. | 1133 // known. |
1139 if (animating_transform_to_screen && !use_gpu_rasterization()) { | 1134 if (animating_transform_to_screen) { |
1140 if (maximum_animation_contents_scale > 0.f) { | 1135 if (maximum_animation_contents_scale > 0.f) { |
1141 raster_contents_scale_ = | 1136 raster_contents_scale_ = |
1142 std::max(raster_contents_scale_, maximum_animation_contents_scale); | 1137 std::max(raster_contents_scale_, maximum_animation_contents_scale); |
1143 } else { | 1138 } else { |
1144 raster_contents_scale_ = | 1139 raster_contents_scale_ = |
1145 std::max(raster_contents_scale_, | 1140 std::max(raster_contents_scale_, |
1146 1.f * ideal_page_scale_ * ideal_device_scale_); | 1141 1.f * ideal_page_scale_ * ideal_device_scale_); |
1147 } | 1142 } |
1148 } | 1143 } |
1149 | 1144 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 return iterator_index_ < iterators_.size(); | 1557 return iterator_index_ < iterators_.size(); |
1563 } | 1558 } |
1564 | 1559 |
1565 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1560 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1566 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1561 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1567 return it->get_type() == iteration_stage_ && | 1562 return it->get_type() == iteration_stage_ && |
1568 (**it)->required_for_activation() == required_for_activation_; | 1563 (**it)->required_for_activation() == required_for_activation_; |
1569 } | 1564 } |
1570 | 1565 |
1571 } // namespace cc | 1566 } // namespace cc |
OLD | NEW |