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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 scroll_clip_layer_(nullptr), | 51 scroll_clip_layer_(nullptr), |
52 should_scroll_on_main_thread_(false), | 52 should_scroll_on_main_thread_(false), |
53 have_wheel_event_handlers_(false), | 53 have_wheel_event_handlers_(false), |
54 have_scroll_event_handlers_(false), | 54 have_scroll_event_handlers_(false), |
55 scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE), | 55 scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE), |
56 user_scrollable_horizontal_(true), | 56 user_scrollable_horizontal_(true), |
57 user_scrollable_vertical_(true), | 57 user_scrollable_vertical_(true), |
58 stacking_order_changed_(false), | 58 stacking_order_changed_(false), |
59 double_sided_(true), | 59 double_sided_(true), |
60 should_flatten_transform_(true), | 60 should_flatten_transform_(true), |
| 61 should_flatten_transform_from_property_tree_(false), |
61 layer_property_changed_(false), | 62 layer_property_changed_(false), |
62 masks_to_bounds_(false), | 63 masks_to_bounds_(false), |
63 contents_opaque_(false), | 64 contents_opaque_(false), |
64 is_root_for_isolated_group_(false), | 65 is_root_for_isolated_group_(false), |
65 use_parent_backface_visibility_(false), | 66 use_parent_backface_visibility_(false), |
66 draw_checkerboard_for_missing_tiles_(false), | 67 draw_checkerboard_for_missing_tiles_(false), |
67 draws_content_(false), | 68 draws_content_(false), |
68 hide_layer_and_subtree_(false), | 69 hide_layer_and_subtree_(false), |
69 transform_is_invertible_(true), | 70 transform_is_invertible_(true), |
70 is_container_for_fixed_position_layers_(false), | 71 is_container_for_fixed_position_layers_(false), |
71 background_color_(0), | 72 background_color_(0), |
72 opacity_(1.0), | 73 opacity_(1.0), |
73 blend_mode_(SkXfermode::kSrcOver_Mode), | 74 blend_mode_(SkXfermode::kSrcOver_Mode), |
74 num_descendants_that_draw_content_(0), | 75 num_descendants_that_draw_content_(0), |
| 76 transform_tree_index_(-1), |
| 77 opacity_tree_index_(-1), |
| 78 clip_tree_index_(-1), |
75 draw_depth_(0.f), | 79 draw_depth_(0.f), |
76 needs_push_properties_(false), | 80 needs_push_properties_(false), |
77 num_dependents_need_push_properties_(0), | 81 num_dependents_need_push_properties_(0), |
78 sorting_context_id_(0), | 82 sorting_context_id_(0), |
79 current_draw_mode_(DRAW_MODE_NONE), | 83 current_draw_mode_(DRAW_MODE_NONE), |
80 frame_timing_requests_dirty_(false) { | 84 frame_timing_requests_dirty_(false) { |
81 DCHECK_GT(layer_id_, 0); | 85 DCHECK_GT(layer_id_, 0); |
82 DCHECK(layer_tree_impl_); | 86 DCHECK(layer_tree_impl_); |
83 layer_tree_impl_->RegisterLayer(this); | 87 layer_tree_impl_->RegisterLayer(this); |
84 AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar(); | 88 AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar(); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 526 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
523 layer->SetContentsOpaque(contents_opaque_); | 527 layer->SetContentsOpaque(contents_opaque_); |
524 layer->SetOpacity(opacity_); | 528 layer->SetOpacity(opacity_); |
525 layer->SetBlendMode(blend_mode_); | 529 layer->SetBlendMode(blend_mode_); |
526 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); | 530 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); |
527 layer->SetPosition(position_); | 531 layer->SetPosition(position_); |
528 layer->SetIsContainerForFixedPositionLayers( | 532 layer->SetIsContainerForFixedPositionLayers( |
529 is_container_for_fixed_position_layers_); | 533 is_container_for_fixed_position_layers_); |
530 layer->SetPositionConstraint(position_constraint_); | 534 layer->SetPositionConstraint(position_constraint_); |
531 layer->SetShouldFlattenTransform(should_flatten_transform_); | 535 layer->SetShouldFlattenTransform(should_flatten_transform_); |
| 536 layer->set_should_flatten_transform_from_property_tree( |
| 537 should_flatten_transform_from_property_tree_); |
532 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 538 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
533 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); | 539 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); |
534 | 540 |
535 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id() | 541 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id() |
536 : Layer::INVALID_ID); | 542 : Layer::INVALID_ID); |
537 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 543 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
538 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 544 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
539 | 545 |
540 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_); | 546 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_); |
541 | 547 |
542 layer->PushScrollOffset(nullptr); | 548 layer->PushScrollOffset(nullptr); |
543 | 549 |
544 layer->Set3dSortingContextId(sorting_context_id_); | 550 layer->Set3dSortingContextId(sorting_context_id_); |
545 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); | 551 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); |
546 | 552 |
| 553 layer->set_transform_tree_index(transform_tree_index_); |
| 554 layer->set_opacity_tree_index(opacity_tree_index_); |
| 555 layer->set_clip_tree_index(clip_tree_index_); |
| 556 layer->set_offset_to_transform_parent(offset_to_transform_parent_); |
| 557 |
547 LayerImpl* scroll_parent = nullptr; | 558 LayerImpl* scroll_parent = nullptr; |
548 if (scroll_parent_) { | 559 if (scroll_parent_) { |
549 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 560 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
550 DCHECK(scroll_parent); | 561 DCHECK(scroll_parent); |
551 } | 562 } |
552 | 563 |
553 layer->SetScrollParent(scroll_parent); | 564 layer->SetScrollParent(scroll_parent); |
554 if (scroll_children_) { | 565 if (scroll_children_) { |
555 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; | 566 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; |
556 for (std::set<LayerImpl*>::iterator it = scroll_children_->begin(); | 567 for (std::set<LayerImpl*>::iterator it = scroll_children_->begin(); |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 gfx::Transform scaled_draw_transform = | 1616 gfx::Transform scaled_draw_transform = |
1606 draw_properties_.target_space_transform; | 1617 draw_properties_.target_space_transform; |
1607 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); | 1618 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); |
1608 gfx::Size scaled_content_bounds = | 1619 gfx::Size scaled_content_bounds = |
1609 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); | 1620 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); |
1610 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, | 1621 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, |
1611 gfx::Rect(scaled_content_bounds)); | 1622 gfx::Rect(scaled_content_bounds)); |
1612 } | 1623 } |
1613 | 1624 |
1614 } // namespace cc | 1625 } // namespace cc |
OLD | NEW |