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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 should_flatten_transform_(true), | 55 should_flatten_transform_(true), |
56 layer_property_changed_(false), | 56 layer_property_changed_(false), |
57 masks_to_bounds_(false), | 57 masks_to_bounds_(false), |
58 contents_opaque_(false), | 58 contents_opaque_(false), |
59 is_root_for_isolated_group_(false), | 59 is_root_for_isolated_group_(false), |
60 use_parent_backface_visibility_(false), | 60 use_parent_backface_visibility_(false), |
61 draw_checkerboard_for_missing_tiles_(false), | 61 draw_checkerboard_for_missing_tiles_(false), |
62 draws_content_(false), | 62 draws_content_(false), |
63 hide_layer_and_subtree_(false), | 63 hide_layer_and_subtree_(false), |
64 force_render_surface_(false), | 64 force_render_surface_(false), |
65 transform_is_invertible_(true), | |
65 is_container_for_fixed_position_layers_(false), | 66 is_container_for_fixed_position_layers_(false), |
66 is_3d_sorted_(false), | 67 is_3d_sorted_(false), |
67 background_color_(0), | 68 background_color_(0), |
68 opacity_(1.0), | 69 opacity_(1.0), |
69 blend_mode_(SkXfermode::kSrcOver_Mode), | 70 blend_mode_(SkXfermode::kSrcOver_Mode), |
70 draw_depth_(0.f), | 71 draw_depth_(0.f), |
71 needs_push_properties_(false), | 72 needs_push_properties_(false), |
72 num_dependents_need_push_properties_(0), | 73 num_dependents_need_push_properties_(0), |
73 current_draw_mode_(DRAW_MODE_NONE) { | 74 current_draw_mode_(DRAW_MODE_NONE) { |
74 DCHECK_GT(layer_id_, 0); | 75 DCHECK_GT(layer_id_, 0); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
510 layer->SetOpacity(opacity_); | 511 layer->SetOpacity(opacity_); |
511 layer->SetBlendMode(blend_mode_); | 512 layer->SetBlendMode(blend_mode_); |
512 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); | 513 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); |
513 layer->SetPosition(position_); | 514 layer->SetPosition(position_); |
514 layer->SetIsContainerForFixedPositionLayers( | 515 layer->SetIsContainerForFixedPositionLayers( |
515 is_container_for_fixed_position_layers_); | 516 is_container_for_fixed_position_layers_); |
516 layer->SetPositionConstraint(position_constraint_); | 517 layer->SetPositionConstraint(position_constraint_); |
517 layer->SetShouldFlattenTransform(should_flatten_transform_); | 518 layer->SetShouldFlattenTransform(should_flatten_transform_); |
518 layer->SetIs3dSorted(is_3d_sorted_); | 519 layer->SetIs3dSorted(is_3d_sorted_); |
519 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 520 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
520 layer->SetTransform(transform_); | 521 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); |
521 | 522 |
522 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id() | 523 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id() |
523 : Layer::INVALID_ID); | 524 : Layer::INVALID_ID); |
524 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 525 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
525 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 526 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
526 layer->SetScrollOffsetAndDelta( | 527 layer->SetScrollOffsetAndDelta( |
527 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); | 528 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); |
528 layer->SetSentScrollDelta(gfx::Vector2d()); | 529 layer->SetSentScrollDelta(gfx::Vector2d()); |
529 | 530 |
530 LayerImpl* scroll_parent = NULL; | 531 LayerImpl* scroll_parent = NULL; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 | 989 |
989 is_3d_sorted_ = sorted; | 990 is_3d_sorted_ = sorted; |
990 NoteLayerPropertyChangedForSubtree(); | 991 NoteLayerPropertyChangedForSubtree(); |
991 } | 992 } |
992 | 993 |
993 void LayerImpl::SetTransform(const gfx::Transform& transform) { | 994 void LayerImpl::SetTransform(const gfx::Transform& transform) { |
994 if (transform_ == transform) | 995 if (transform_ == transform) |
995 return; | 996 return; |
996 | 997 |
997 transform_ = transform; | 998 transform_ = transform; |
999 transform_is_invertible_ = transform_.IsInvertible(); | |
998 NoteLayerPropertyChangedForSubtree(); | 1000 NoteLayerPropertyChangedForSubtree(); |
999 } | 1001 } |
1000 | 1002 |
1003 void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform, | |
1004 bool transform_is_invertible) { | |
1005 if (transform_ == transform) { | |
1006 if (transform_is_invertible_ != transform_is_invertible) { | |
1007 DLOG(ERROR) << "Can't change invertibility if transform is unchanged"; | |
ajuma
2014/03/28 18:49:07
How about a DCHECK instead of a DLOG?
avallee
2014/04/15 18:53:25
Done.
| |
1008 } | |
1009 return; | |
1010 } | |
1011 transform_ = transform; | |
1012 transform_is_invertible_ = transform_is_invertible; | |
1013 NoteLayerPropertyChangedForSubtree(); | |
1014 } | |
1015 | |
1001 bool LayerImpl::TransformIsAnimating() const { | 1016 bool LayerImpl::TransformIsAnimating() const { |
1002 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); | 1017 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
1003 } | 1018 } |
1004 | 1019 |
1005 bool LayerImpl::TransformIsAnimatingOnImplOnly() const { | 1020 bool LayerImpl::TransformIsAnimatingOnImplOnly() const { |
1006 Animation* transform_animation = | 1021 Animation* transform_animation = |
1007 layer_animation_controller_->GetAnimation(Animation::Transform); | 1022 layer_animation_controller_->GetAnimation(Animation::Transform); |
1008 return transform_animation && transform_animation->is_impl_only(); | 1023 return transform_animation && transform_animation->is_impl_only(); |
1009 } | 1024 } |
1010 | 1025 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1490 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1505 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1491 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1506 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1492 AsValueInto(state.get()); | 1507 AsValueInto(state.get()); |
1493 return state.PassAs<base::Value>(); | 1508 return state.PassAs<base::Value>(); |
1494 } | 1509 } |
1495 | 1510 |
1496 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1511 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1497 benchmark->RunOnLayer(this); | 1512 benchmark->RunOnLayer(this); |
1498 } | 1513 } |
1499 } // namespace cc | 1514 } // namespace cc |
OLD | NEW |