| 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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 float contents_scale_y) { | 1034 float contents_scale_y) { |
| 1035 if (this->contents_scale_x() == contents_scale_x && | 1035 if (this->contents_scale_x() == contents_scale_x && |
| 1036 this->contents_scale_y() == contents_scale_y) | 1036 this->contents_scale_y() == contents_scale_y) |
| 1037 return; | 1037 return; |
| 1038 | 1038 |
| 1039 draw_properties_.contents_scale_x = contents_scale_x; | 1039 draw_properties_.contents_scale_x = contents_scale_x; |
| 1040 draw_properties_.contents_scale_y = contents_scale_y; | 1040 draw_properties_.contents_scale_y = contents_scale_y; |
| 1041 NoteLayerPropertyChanged(); | 1041 NoteLayerPropertyChanged(); |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 void LayerImpl::CalculateContentsScale(float ideal_contents_scale, | |
| 1045 float device_scale_factor, | |
| 1046 float page_scale_factor, | |
| 1047 float maximum_animation_contents_scale, | |
| 1048 bool animating_transform_to_screen, | |
| 1049 float* contents_scale_x, | |
| 1050 float* contents_scale_y, | |
| 1051 gfx::Size* content_bounds) { | |
| 1052 // Base LayerImpl has all of its content scales and content bounds pushed | |
| 1053 // from its Layer during commit and just reuses those values as-is. | |
| 1054 *contents_scale_x = this->contents_scale_x(); | |
| 1055 *contents_scale_y = this->contents_scale_y(); | |
| 1056 *content_bounds = this->content_bounds(); | |
| 1057 } | |
| 1058 | |
| 1059 void LayerImpl::SetScrollOffsetDelegate( | 1044 void LayerImpl::SetScrollOffsetDelegate( |
| 1060 ScrollOffsetDelegate* scroll_offset_delegate) { | 1045 ScrollOffsetDelegate* scroll_offset_delegate) { |
| 1061 // Having both a scroll parent and a scroll offset delegate is unsupported. | 1046 // Having both a scroll parent and a scroll offset delegate is unsupported. |
| 1062 DCHECK(!scroll_parent_); | 1047 DCHECK(!scroll_parent_); |
| 1063 if (!scroll_offset_delegate && scroll_offset_delegate_) { | 1048 if (!scroll_offset_delegate && scroll_offset_delegate_) { |
| 1064 scroll_delta_ = | 1049 scroll_delta_ = |
| 1065 scroll_offset_delegate_->GetTotalScrollOffset() - scroll_offset_; | 1050 scroll_offset_delegate_->GetTotalScrollOffset() - scroll_offset_; |
| 1066 } | 1051 } |
| 1067 gfx::Vector2dF total_offset = TotalScrollOffset(); | 1052 gfx::Vector2dF total_offset = TotalScrollOffset(); |
| 1068 scroll_offset_delegate_ = scroll_offset_delegate; | 1053 scroll_offset_delegate_ = scroll_offset_delegate; |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1482 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
| 1498 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1483 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 1499 AsValueInto(state.get()); | 1484 AsValueInto(state.get()); |
| 1500 return state.PassAs<base::Value>(); | 1485 return state.PassAs<base::Value>(); |
| 1501 } | 1486 } |
| 1502 | 1487 |
| 1503 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1488 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1504 benchmark->RunOnLayer(this); | 1489 benchmark->RunOnLayer(this); |
| 1505 } | 1490 } |
| 1506 } // namespace cc | 1491 } // namespace cc |
| OLD | NEW |