| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 is_affected_by_page_scale_(true), | 81 is_affected_by_page_scale_(true), |
| 82 was_ever_ready_since_last_transform_animation_(true), | 82 was_ever_ready_since_last_transform_animation_(true), |
| 83 background_color_(0), | 83 background_color_(0), |
| 84 opacity_(1.0), | 84 opacity_(1.0), |
| 85 blend_mode_(SkXfermode::kSrcOver_Mode), | 85 blend_mode_(SkXfermode::kSrcOver_Mode), |
| 86 draw_blend_mode_(SkXfermode::kSrcOver_Mode), | 86 draw_blend_mode_(SkXfermode::kSrcOver_Mode), |
| 87 num_descendants_that_draw_content_(0), | 87 num_descendants_that_draw_content_(0), |
| 88 transform_tree_index_(-1), | 88 transform_tree_index_(-1), |
| 89 effect_tree_index_(-1), | 89 effect_tree_index_(-1), |
| 90 clip_tree_index_(-1), | 90 clip_tree_index_(-1), |
| 91 scroll_tree_index_(-1), |
| 91 draw_depth_(0.f), | 92 draw_depth_(0.f), |
| 92 needs_push_properties_(false), | 93 needs_push_properties_(false), |
| 93 num_dependents_need_push_properties_(0), | 94 num_dependents_need_push_properties_(0), |
| 94 sorting_context_id_(0), | 95 sorting_context_id_(0), |
| 95 current_draw_mode_(DRAW_MODE_NONE), | 96 current_draw_mode_(DRAW_MODE_NONE), |
| 96 element_id_(0), | 97 element_id_(0), |
| 97 mutable_properties_(MutableProperty::kNone), | 98 mutable_properties_(MutableProperty::kNone), |
| 98 force_render_surface_(false), | 99 force_render_surface_(false), |
| 99 frame_timing_requests_dirty_(false), | 100 frame_timing_requests_dirty_(false), |
| 100 visited_(false), | 101 visited_(false), |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 void LayerImpl::SetClipTreeIndex(int index) { | 271 void LayerImpl::SetClipTreeIndex(int index) { |
| 271 clip_tree_index_ = index; | 272 clip_tree_index_ = index; |
| 272 SetNeedsPushProperties(); | 273 SetNeedsPushProperties(); |
| 273 } | 274 } |
| 274 | 275 |
| 275 void LayerImpl::SetEffectTreeIndex(int index) { | 276 void LayerImpl::SetEffectTreeIndex(int index) { |
| 276 effect_tree_index_ = index; | 277 effect_tree_index_ = index; |
| 277 SetNeedsPushProperties(); | 278 SetNeedsPushProperties(); |
| 278 } | 279 } |
| 279 | 280 |
| 281 void LayerImpl::SetScrollTreeIndex(int index) { |
| 282 scroll_tree_index_ = index; |
| 283 SetNeedsPushProperties(); |
| 284 } |
| 285 |
| 280 void LayerImpl::PassCopyRequests( | 286 void LayerImpl::PassCopyRequests( |
| 281 std::vector<scoped_ptr<CopyOutputRequest>>* requests) { | 287 std::vector<scoped_ptr<CopyOutputRequest>>* requests) { |
| 282 // In the case that a layer still has a copy request, this means that there's | 288 // In the case that a layer still has a copy request, this means that there's |
| 283 // a commit to the active tree without a draw. This only happens in some | 289 // a commit to the active tree without a draw. This only happens in some |
| 284 // edge cases during lost context or visibility changes, so don't try to | 290 // edge cases during lost context or visibility changes, so don't try to |
| 285 // handle preserving these output requests (and their surface). | 291 // handle preserving these output requests (and their surface). |
| 286 if (!copy_requests_.empty()) { | 292 if (!copy_requests_.empty()) { |
| 287 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); | 293 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); |
| 288 // Destroying these will abort them. | 294 // Destroying these will abort them. |
| 289 copy_requests_.clear(); | 295 copy_requests_.clear(); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_); | 656 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_); |
| 651 | 657 |
| 652 layer->PushScrollOffset(nullptr); | 658 layer->PushScrollOffset(nullptr); |
| 653 | 659 |
| 654 layer->Set3dSortingContextId(sorting_context_id_); | 660 layer->Set3dSortingContextId(sorting_context_id_); |
| 655 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); | 661 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); |
| 656 | 662 |
| 657 layer->SetTransformTreeIndex(transform_tree_index_); | 663 layer->SetTransformTreeIndex(transform_tree_index_); |
| 658 layer->SetClipTreeIndex(clip_tree_index_); | 664 layer->SetClipTreeIndex(clip_tree_index_); |
| 659 layer->SetEffectTreeIndex(effect_tree_index_); | 665 layer->SetEffectTreeIndex(effect_tree_index_); |
| 666 layer->SetScrollTreeIndex(scroll_tree_index_); |
| 660 layer->set_offset_to_transform_parent(offset_to_transform_parent_); | 667 layer->set_offset_to_transform_parent(offset_to_transform_parent_); |
| 661 | 668 |
| 662 LayerImpl* scroll_parent = nullptr; | 669 LayerImpl* scroll_parent = nullptr; |
| 663 if (scroll_parent_) { | 670 if (scroll_parent_) { |
| 664 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 671 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
| 665 DCHECK(scroll_parent); | 672 DCHECK(scroll_parent); |
| 666 } | 673 } |
| 667 | 674 |
| 668 layer->SetScrollParent(scroll_parent); | 675 layer->SetScrollParent(scroll_parent); |
| 669 if (scroll_children_) { | 676 if (scroll_children_) { |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 .layer_transforms_should_scale_layer_contents) { | 1957 .layer_transforms_should_scale_layer_contents) { |
| 1951 return default_scale; | 1958 return default_scale; |
| 1952 } | 1959 } |
| 1953 | 1960 |
| 1954 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1961 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1955 DrawTransform(), default_scale); | 1962 DrawTransform(), default_scale); |
| 1956 return std::max(transform_scales.x(), transform_scales.y()); | 1963 return std::max(transform_scales.x(), transform_scales.y()); |
| 1957 } | 1964 } |
| 1958 | 1965 |
| 1959 } // namespace cc | 1966 } // namespace cc |
| OLD | NEW |