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/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1057 } | 1057 } |
1058 | 1058 |
1059 void LayerImpl::CalculateContentsScale(float ideal_contents_scale, | 1059 void LayerImpl::CalculateContentsScale(float ideal_contents_scale, |
1060 float device_scale_factor, | 1060 float device_scale_factor, |
1061 float page_scale_factor, | 1061 float page_scale_factor, |
1062 float maximum_animation_contents_scale, | 1062 float maximum_animation_contents_scale, |
1063 bool animating_transform_to_screen, | 1063 bool animating_transform_to_screen, |
1064 float* contents_scale_x, | 1064 float* contents_scale_x, |
1065 float* contents_scale_y, | 1065 float* contents_scale_y, |
1066 gfx::Size* content_bounds) { | 1066 gfx::Size* content_bounds) { |
1067 // Base LayerImpl has all of its content scales and content bounds pushed | 1067 if (layer_tree_impl()->settings().impl_side_painting) { |
danakj
2014/05/15 15:15:31
Why did you need this? The bounds == content_bound
| |
1068 // from its Layer during commit and just reuses those values as-is. | 1068 *contents_scale_x = 1.f; |
1069 *contents_scale_x = this->contents_scale_x(); | 1069 *contents_scale_y = 1.f; |
1070 *contents_scale_y = this->contents_scale_y(); | 1070 *content_bounds = bounds(); |
1071 *content_bounds = this->content_bounds(); | 1071 } else { |
1072 // Base LayerImpl has all of its content scales and content bounds pushed | |
1073 // from its Layer during commit and just reuses those values as-is. | |
1074 *contents_scale_x = this->contents_scale_x(); | |
1075 *contents_scale_y = this->contents_scale_y(); | |
1076 *content_bounds = this->content_bounds(); | |
1077 } | |
1072 } | 1078 } |
1073 | |
1074 void LayerImpl::SetScrollOffsetDelegate( | 1079 void LayerImpl::SetScrollOffsetDelegate( |
1075 LayerScrollOffsetDelegate* scroll_offset_delegate) { | 1080 LayerScrollOffsetDelegate* scroll_offset_delegate) { |
1076 // Having both a scroll parent and a scroll offset delegate is unsupported. | 1081 // Having both a scroll parent and a scroll offset delegate is unsupported. |
1077 DCHECK(!scroll_parent_); | 1082 DCHECK(!scroll_parent_); |
1078 if (!scroll_offset_delegate && scroll_offset_delegate_) { | 1083 if (!scroll_offset_delegate && scroll_offset_delegate_) { |
1079 scroll_delta_ = | 1084 scroll_delta_ = |
1080 scroll_offset_delegate_->GetTotalScrollOffset() - scroll_offset_; | 1085 scroll_offset_delegate_->GetTotalScrollOffset() - scroll_offset_; |
1081 } | 1086 } |
1082 gfx::Vector2dF total_offset = TotalScrollOffset(); | 1087 gfx::Vector2dF total_offset = TotalScrollOffset(); |
1083 scroll_offset_delegate_ = scroll_offset_delegate; | 1088 scroll_offset_delegate_ = scroll_offset_delegate; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1510 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1515 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1511 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1516 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1512 AsValueInto(state.get()); | 1517 AsValueInto(state.get()); |
1513 return state.PassAs<base::Value>(); | 1518 return state.PassAs<base::Value>(); |
1514 } | 1519 } |
1515 | 1520 |
1516 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1521 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1517 benchmark->RunOnLayer(this); | 1522 benchmark->RunOnLayer(this); |
1518 } | 1523 } |
1519 } // namespace cc | 1524 } // namespace cc |
OLD | NEW |