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 #ifndef CC_TEST_LAYER_TEST_COMMON_H_ | 5 #ifndef CC_TEST_LAYER_TEST_COMMON_H_ |
6 #define CC_TEST_LAYER_TEST_COMMON_H_ | 6 #define CC_TEST_LAYER_TEST_COMMON_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 template <typename T> | 64 template <typename T> |
65 T* AddChild(LayerImpl* parent) { | 65 T* AddChild(LayerImpl* parent) { |
66 scoped_ptr<T> layer = | 66 scoped_ptr<T> layer = |
67 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); | 67 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); |
68 T* ptr = layer.get(); | 68 T* ptr = layer.get(); |
69 parent->AddChild(std::move(layer)); | 69 parent->AddChild(std::move(layer)); |
70 return ptr; | 70 return ptr; |
71 } | 71 } |
72 | 72 |
| 73 template <typename T> |
| 74 T* AddReplicaLayer(LayerImpl* origin) { |
| 75 scoped_ptr<T> layer = |
| 76 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); |
| 77 T* ptr = layer.get(); |
| 78 origin->SetReplicaLayer(layer.Pass()); |
| 79 return ptr; |
| 80 } |
| 81 |
73 template <typename T, typename A> | 82 template <typename T, typename A> |
74 T* AddChildToRoot(const A& a) { | 83 T* AddChildToRoot(const A& a) { |
75 scoped_ptr<T> layer = | 84 scoped_ptr<T> layer = |
76 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++, a); | 85 T::Create(host_->host_impl()->active_tree(), layer_impl_id_++, a); |
77 T* ptr = layer.get(); | 86 T* ptr = layer.get(); |
78 root_layer_impl_->AddChild(std::move(layer)); | 87 root_layer_impl_->AddChild(std::move(layer)); |
79 return ptr; | 88 return ptr; |
80 } | 89 } |
81 | 90 |
82 template <typename T, typename A, typename B> | 91 template <typename T, typename A, typename B> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 scoped_ptr<FakeLayerTreeHost> host_; | 154 scoped_ptr<FakeLayerTreeHost> host_; |
146 scoped_ptr<LayerImpl> root_layer_impl_; | 155 scoped_ptr<LayerImpl> root_layer_impl_; |
147 scoped_ptr<RenderPass> render_pass_; | 156 scoped_ptr<RenderPass> render_pass_; |
148 int layer_impl_id_; | 157 int layer_impl_id_; |
149 }; | 158 }; |
150 }; | 159 }; |
151 | 160 |
152 } // namespace cc | 161 } // namespace cc |
153 | 162 |
154 #endif // CC_TEST_LAYER_TEST_COMMON_H_ | 163 #endif // CC_TEST_LAYER_TEST_COMMON_H_ |
OLD | NEW |