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 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 bool can_raster_at_maximum_scale = false; | 1041 bool can_raster_at_maximum_scale = false; |
1042 // TODO(ajuma): If we need to deal with scale-down animations starting right | 1042 // TODO(ajuma): If we need to deal with scale-down animations starting right |
1043 // as a layer gets promoted, then we'd want to have the | 1043 // as a layer gets promoted, then we'd want to have the |
1044 // |starting_animation_contents_scale| passed in here as a separate draw | 1044 // |starting_animation_contents_scale| passed in here as a separate draw |
1045 // property so we could try use that when the max is too large. | 1045 // property so we could try use that when the max is too large. |
1046 // See crbug.com/422341. | 1046 // See crbug.com/422341. |
1047 float maximum_scale = draw_properties().maximum_animation_contents_scale; | 1047 float maximum_scale = draw_properties().maximum_animation_contents_scale; |
1048 if (maximum_scale) { | 1048 if (maximum_scale) { |
1049 gfx::Size bounds_at_maximum_scale = gfx::ToCeiledSize( | 1049 gfx::Size bounds_at_maximum_scale = gfx::ToCeiledSize( |
1050 gfx::ScaleSize(raster_source_->GetSize(), maximum_scale)); | 1050 gfx::ScaleSize(raster_source_->GetSize(), maximum_scale)); |
1051 if (bounds_at_maximum_scale.GetArea() <= | 1051 int64 maximum_area = static_cast<int64>(bounds_at_maximum_scale.width()) * |
1052 layer_tree_impl()->device_viewport_size().GetArea()) | 1052 static_cast<int64>(bounds_at_maximum_scale.height()); |
| 1053 gfx::Size viewport = layer_tree_impl()->device_viewport_size(); |
| 1054 int64 viewport_area = static_cast<int64>(viewport.width()) * |
| 1055 static_cast<int64>(viewport.height()); |
| 1056 if (maximum_area <= viewport_area) |
1053 can_raster_at_maximum_scale = true; | 1057 can_raster_at_maximum_scale = true; |
1054 } | 1058 } |
1055 // Use the computed scales for the raster scale directly, do not try to use | 1059 // Use the computed scales for the raster scale directly, do not try to use |
1056 // the ideal scale here. The current ideal scale may be way too large in the | 1060 // the ideal scale here. The current ideal scale may be way too large in the |
1057 // case of an animation with scale, and will be constantly changing. | 1061 // case of an animation with scale, and will be constantly changing. |
1058 if (can_raster_at_maximum_scale) | 1062 if (can_raster_at_maximum_scale) |
1059 raster_contents_scale_ = maximum_scale; | 1063 raster_contents_scale_ = maximum_scale; |
1060 else | 1064 else |
1061 raster_contents_scale_ = 1.f * ideal_page_scale_ * ideal_device_scale_; | 1065 raster_contents_scale_ = 1.f * ideal_page_scale_ * ideal_device_scale_; |
1062 } | 1066 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 IteratorType index = stages_[current_stage_].iterator_type; | 1481 IteratorType index = stages_[current_stage_].iterator_type; |
1478 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1482 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
1479 | 1483 |
1480 if (iterators_[index] && iterators_[index].get_type() == tile_type) | 1484 if (iterators_[index] && iterators_[index].get_type() == tile_type) |
1481 break; | 1485 break; |
1482 ++current_stage_; | 1486 ++current_stage_; |
1483 } | 1487 } |
1484 } | 1488 } |
1485 | 1489 |
1486 } // namespace cc | 1490 } // namespace cc |
OLD | NEW |