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 <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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 // Always match the ideal device scale factor. | 1044 // Always match the ideal device scale factor. |
| 1045 if (raster_device_scale_ != ideal_device_scale_) | 1045 if (raster_device_scale_ != ideal_device_scale_) |
| 1046 return true; | 1046 return true; |
| 1047 | 1047 |
| 1048 return false; | 1048 return false; |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 float PictureLayerImpl::SnappedContentsScale(float scale) { | 1051 float PictureLayerImpl::SnappedContentsScale(float scale) { |
| 1052 // If a tiling exists within the max snapping ratio, snap to its scale. | 1052 // If a tiling exists within the max snapping ratio, snap to its scale. |
| 1053 float snapped_contents_scale = scale; | 1053 float snapped_contents_scale = scale; |
| 1054 float snapped_ratio = kSnapToExistingTilingRatio; | 1054 float snapped_ratio = kMaxScaleRatioDuringPinch; |
|
danakj
2014/04/29 17:30:04
This was purposely written as a separate constant.
| |
| 1055 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1055 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 1056 float tiling_contents_scale = tilings_->tiling_at(i)->contents_scale(); | 1056 float tiling_contents_scale = tilings_->tiling_at(i)->contents_scale(); |
| 1057 float ratio = PositiveRatio(tiling_contents_scale, scale); | 1057 float ratio = PositiveRatio(tiling_contents_scale, scale); |
| 1058 if (ratio < snapped_ratio) { | 1058 if (ratio < snapped_ratio) { |
| 1059 snapped_contents_scale = tiling_contents_scale; | 1059 snapped_contents_scale = tiling_contents_scale; |
| 1060 snapped_ratio = ratio; | 1060 snapped_ratio = ratio; |
| 1061 } | 1061 } |
| 1062 } | 1062 } |
| 1063 return snapped_contents_scale; | 1063 return snapped_contents_scale; |
| 1064 } | 1064 } |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1517 return iterator_index_ < iterators_.size(); | 1517 return iterator_index_ < iterators_.size(); |
| 1518 } | 1518 } |
| 1519 | 1519 |
| 1520 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1520 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1521 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1521 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1522 return it->get_type() == iteration_stage_ && | 1522 return it->get_type() == iteration_stage_ && |
| 1523 (**it)->required_for_activation() == required_for_activation_; | 1523 (**it)->required_for_activation() == required_for_activation_; |
| 1524 } | 1524 } |
| 1525 | 1525 |
| 1526 } // namespace cc | 1526 } // namespace cc |
| OLD | NEW |