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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 hide_layer_and_subtree_(false), | 64 hide_layer_and_subtree_(false), |
65 force_render_surface_(false), | 65 force_render_surface_(false), |
66 is_container_for_fixed_position_layers_(false), | 66 is_container_for_fixed_position_layers_(false), |
67 is_3d_sorted_(false), | 67 is_3d_sorted_(false), |
68 background_color_(0), | 68 background_color_(0), |
69 opacity_(1.0), | 69 opacity_(1.0), |
70 blend_mode_(SkXfermode::kSrcOver_Mode), | 70 blend_mode_(SkXfermode::kSrcOver_Mode), |
71 draw_depth_(0.f), | 71 draw_depth_(0.f), |
72 needs_push_properties_(false), | 72 needs_push_properties_(false), |
73 num_dependents_need_push_properties_(0), | 73 num_dependents_need_push_properties_(0), |
74 current_draw_mode_(DRAW_MODE_NONE) { | 74 current_draw_mode_(DRAW_MODE_NONE), |
75 initialized_tile_rect_(gfx::Rect()) { | |
reveman
2014/04/11 18:11:34
no need for this. default ctor does the same.
sohanjg
2014/04/14 10:16:11
Done.
| |
75 DCHECK_GT(layer_id_, 0); | 76 DCHECK_GT(layer_id_, 0); |
76 DCHECK(layer_tree_impl_); | 77 DCHECK(layer_tree_impl_); |
77 layer_tree_impl_->RegisterLayer(this); | 78 layer_tree_impl_->RegisterLayer(this); |
78 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); | 79 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); |
79 layer_animation_controller_ = | 80 layer_animation_controller_ = |
80 registrar->GetAnimationControllerForId(layer_id_); | 81 registrar->GetAnimationControllerForId(layer_id_); |
81 layer_animation_controller_->AddValueObserver(this); | 82 layer_animation_controller_->AddValueObserver(this); |
82 if (IsActive()) | 83 if (IsActive()) |
83 layer_animation_controller_->set_value_provider(this); | 84 layer_animation_controller_->set_value_provider(this); |
84 SetNeedsPushProperties(); | 85 SetNeedsPushProperties(); |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1010 Animation* transform_animation = | 1011 Animation* transform_animation = |
1011 layer_animation_controller_->GetAnimation(Animation::Transform); | 1012 layer_animation_controller_->GetAnimation(Animation::Transform); |
1012 return transform_animation && transform_animation->is_impl_only(); | 1013 return transform_animation && transform_animation->is_impl_only(); |
1013 } | 1014 } |
1014 | 1015 |
1015 void LayerImpl::SetUpdateRect(const gfx::RectF& update_rect) { | 1016 void LayerImpl::SetUpdateRect(const gfx::RectF& update_rect) { |
1016 update_rect_ = update_rect; | 1017 update_rect_ = update_rect; |
1017 SetNeedsPushProperties(); | 1018 SetNeedsPushProperties(); |
1018 } | 1019 } |
1019 | 1020 |
1021 void LayerImpl::SetInitializedTileRect(gfx::Rect initialized_tile_rect) { | |
reveman
2014/04/11 18:11:34
pass by const reference instead
| |
1022 if (!this) | |
reveman
2014/04/11 18:11:34
heh, nope.
sohanjg
2014/04/14 10:16:11
Done.
| |
1023 return; | |
1024 initialized_tile_rect_ = | |
1025 gfx::UnionRects(initialized_tile_rect_, initialized_tile_rect); | |
reveman
2014/04/11 18:11:34
don't call this function "SetRect" and then do a u
sohanjg
2014/04/14 10:16:11
Done.
| |
1026 } | |
1027 | |
1020 void LayerImpl::SetContentBounds(const gfx::Size& content_bounds) { | 1028 void LayerImpl::SetContentBounds(const gfx::Size& content_bounds) { |
1021 if (this->content_bounds() == content_bounds) | 1029 if (this->content_bounds() == content_bounds) |
1022 return; | 1030 return; |
1023 | 1031 |
1024 draw_properties_.content_bounds = content_bounds; | 1032 draw_properties_.content_bounds = content_bounds; |
1025 NoteLayerPropertyChanged(); | 1033 NoteLayerPropertyChanged(); |
1026 } | 1034 } |
1027 | 1035 |
1028 void LayerImpl::SetContentsScale(float contents_scale_x, | 1036 void LayerImpl::SetContentsScale(float contents_scale_x, |
1029 float contents_scale_y) { | 1037 float contents_scale_y) { |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1500 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1508 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1501 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1509 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1502 AsValueInto(state.get()); | 1510 AsValueInto(state.get()); |
1503 return state.PassAs<base::Value>(); | 1511 return state.PassAs<base::Value>(); |
1504 } | 1512 } |
1505 | 1513 |
1506 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1514 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1507 benchmark->RunOnLayer(this); | 1515 benchmark->RunOnLayer(this); |
1508 } | 1516 } |
1509 } // namespace cc | 1517 } // namespace cc |
OLD | NEW |