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/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 SetNeedsPushProperties(); | 201 SetNeedsPushProperties(); |
202 } | 202 } |
203 | 203 |
204 void LayerImpl::SetClipChildren(std::set<LayerImpl*>* children) { | 204 void LayerImpl::SetClipChildren(std::set<LayerImpl*>* children) { |
205 if (clip_children_.get() == children) | 205 if (clip_children_.get() == children) |
206 return; | 206 return; |
207 clip_children_.reset(children); | 207 clip_children_.reset(children); |
208 SetNeedsPushProperties(); | 208 SetNeedsPushProperties(); |
209 } | 209 } |
210 | 210 |
| 211 void LayerImpl::SetTransformTreeIndex(int index) { |
| 212 transform_tree_index_ = index; |
| 213 SetNeedsPushProperties(); |
| 214 } |
| 215 |
| 216 void LayerImpl::SetClipTreeIndex(int index) { |
| 217 clip_tree_index_ = index; |
| 218 SetNeedsPushProperties(); |
| 219 } |
| 220 |
| 221 void LayerImpl::SetOpacityTreeIndex(int index) { |
| 222 opacity_tree_index_ = index; |
| 223 SetNeedsPushProperties(); |
| 224 } |
| 225 |
211 void LayerImpl::PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests) { | 226 void LayerImpl::PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests) { |
212 if (requests->empty()) | 227 if (requests->empty()) |
213 return; | 228 return; |
214 DCHECK(render_surface()); | 229 DCHECK(render_surface()); |
215 bool was_empty = copy_requests_.empty(); | 230 bool was_empty = copy_requests_.empty(); |
216 copy_requests_.insert_and_take(copy_requests_.end(), requests); | 231 copy_requests_.insert_and_take(copy_requests_.end(), requests); |
217 requests->clear(); | 232 requests->clear(); |
218 | 233 |
219 if (was_empty && layer_tree_impl()->IsActiveTree()) | 234 if (was_empty && layer_tree_impl()->IsActiveTree()) |
220 layer_tree_impl()->AddLayerWithCopyOutputRequest(this); | 235 layer_tree_impl()->AddLayerWithCopyOutputRequest(this); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 560 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
546 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 561 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
547 | 562 |
548 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_); | 563 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_); |
549 | 564 |
550 layer->PushScrollOffset(nullptr); | 565 layer->PushScrollOffset(nullptr); |
551 | 566 |
552 layer->Set3dSortingContextId(sorting_context_id_); | 567 layer->Set3dSortingContextId(sorting_context_id_); |
553 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); | 568 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); |
554 | 569 |
555 layer->set_transform_tree_index(transform_tree_index_); | 570 layer->SetTransformTreeIndex(transform_tree_index_); |
556 layer->set_opacity_tree_index(opacity_tree_index_); | 571 layer->SetClipTreeIndex(clip_tree_index_); |
557 layer->set_clip_tree_index(clip_tree_index_); | 572 layer->SetOpacityTreeIndex(opacity_tree_index_); |
558 layer->set_offset_to_transform_parent(offset_to_transform_parent_); | 573 layer->set_offset_to_transform_parent(offset_to_transform_parent_); |
559 | 574 |
560 LayerImpl* scroll_parent = nullptr; | 575 LayerImpl* scroll_parent = nullptr; |
561 if (scroll_parent_) { | 576 if (scroll_parent_) { |
562 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 577 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
563 DCHECK(scroll_parent); | 578 DCHECK(scroll_parent); |
564 } | 579 } |
565 | 580 |
566 layer->SetScrollParent(scroll_parent); | 581 layer->SetScrollParent(scroll_parent); |
567 if (scroll_children_) { | 582 if (scroll_children_) { |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 gfx::Transform scaled_draw_transform = | 1656 gfx::Transform scaled_draw_transform = |
1642 draw_properties_.target_space_transform; | 1657 draw_properties_.target_space_transform; |
1643 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); | 1658 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); |
1644 gfx::Size scaled_content_bounds = | 1659 gfx::Size scaled_content_bounds = |
1645 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); | 1660 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); |
1646 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, | 1661 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, |
1647 gfx::Rect(scaled_content_bounds)); | 1662 gfx::Rect(scaled_content_bounds)); |
1648 } | 1663 } |
1649 | 1664 |
1650 } // namespace cc | 1665 } // namespace cc |
OLD | NEW |