OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { | 77 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { |
78 child->set_parent(this); | 78 child->set_parent(this); |
79 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); | 79 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); |
80 children_.push_back(child.Pass()); | 80 children_.push_back(child.Pass()); |
81 layer_tree_impl()->set_needs_update_draw_properties(); | 81 layer_tree_impl()->set_needs_update_draw_properties(); |
82 } | 82 } |
83 | 83 |
84 scoped_ptr<LayerImpl> LayerImpl::RemoveChild(LayerImpl* child) { | 84 scoped_ptr<LayerImpl> LayerImpl::RemoveChild(LayerImpl* child) { |
85 for (ScopedPtrVector<LayerImpl>::iterator it = children_.begin(); | 85 for (OwnedLayerImplList::iterator it = children_.begin(); |
86 it != children_.end(); | 86 it != children_.end(); |
87 ++it) { | 87 ++it) { |
88 if (*it == child) { | 88 if (*it == child) { |
89 scoped_ptr<LayerImpl> ret = children_.take(it); | 89 scoped_ptr<LayerImpl> ret = children_.take(it); |
90 children_.erase(it); | 90 children_.erase(it); |
91 layer_tree_impl()->set_needs_update_draw_properties(); | 91 layer_tree_impl()->set_needs_update_draw_properties(); |
92 return ret.Pass(); | 92 return ret.Pass(); |
93 } | 93 } |
94 } | 94 } |
95 return scoped_ptr<LayerImpl>(); | 95 return scoped_ptr<LayerImpl>(); |
96 } | 96 } |
97 | 97 |
98 void LayerImpl::ClearChildList() { | 98 void LayerImpl::ClearChildList() { |
99 if (children_.empty()) | 99 if (children_.empty()) |
100 return; | 100 return; |
101 | 101 |
102 children_.clear(); | 102 children_.clear(); |
103 layer_tree_impl()->set_needs_update_draw_properties(); | 103 layer_tree_impl()->set_needs_update_draw_properties(); |
104 } | 104 } |
105 | 105 |
106 void LayerImpl::CreateRenderSurface() { | 106 void LayerImpl::CreateRenderSurface() { |
107 DCHECK(!draw_properties_.render_surface); | 107 DCHECK(!draw_properties_.render_surface); |
108 draw_properties_.render_surface = | 108 draw_properties_.render_surface = |
109 make_scoped_ptr(new RenderSurfaceImpl(this)); | 109 make_scoped_ptr(new RenderSurfaceImpl(this)); |
110 draw_properties_.render_target = this; | 110 draw_properties_.render_target = this; |
111 } | 111 } |
112 | 112 |
| 113 void LayerImpl::ClearRenderSurface() { |
| 114 draw_properties_.render_surface.reset(); |
| 115 } |
| 116 |
113 scoped_ptr<SharedQuadState> LayerImpl::CreateSharedQuadState() const { | 117 scoped_ptr<SharedQuadState> LayerImpl::CreateSharedQuadState() const { |
114 scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); | 118 scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); |
115 state->SetAll(draw_properties_.target_space_transform, | 119 state->SetAll(draw_properties_.target_space_transform, |
116 draw_properties_.content_bounds, | 120 draw_properties_.content_bounds, |
117 draw_properties_.visible_content_rect, | 121 draw_properties_.visible_content_rect, |
118 draw_properties_.clip_rect, | 122 draw_properties_.clip_rect, |
119 draw_properties_.is_clipped, | 123 draw_properties_.is_clipped, |
120 draw_properties_.opacity); | 124 draw_properties_.opacity); |
121 return state.Pass(); | 125 return state.Pass(); |
122 } | 126 } |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 dict->Set("layer_quad", MathUtil::AsValue(layer_quad).release()); | 966 dict->Set("layer_quad", MathUtil::AsValue(layer_quad).release()); |
963 } | 967 } |
964 | 968 |
965 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 969 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
966 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 970 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
967 AsValueInto(state.get()); | 971 AsValueInto(state.get()); |
968 return state.PassAs<base::Value>(); | 972 return state.PassAs<base::Value>(); |
969 } | 973 } |
970 | 974 |
971 } // namespace cc | 975 } // namespace cc |
OLD | NEW |