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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 class LayerImplTest { | 49 class LayerImplTest { |
50 public: | 50 public: |
51 LayerImplTest(); | 51 LayerImplTest(); |
52 ~LayerImplTest(); | 52 ~LayerImplTest(); |
53 | 53 |
54 template <typename T> | 54 template <typename T> |
55 T* AddChildToRoot() { | 55 T* AddChildToRoot() { |
56 scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2); | 56 scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2); |
57 T* ptr = layer.get(); | 57 T* ptr = layer.get(); |
58 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); | 58 root_layer_impl_->AddChild(layer.Pass()); |
59 return ptr; | 59 return ptr; |
60 } | 60 } |
61 | 61 |
62 template <typename T, typename A> | 62 template <typename T, typename A> |
63 T* AddChildToRoot(const A& a) { | 63 T* AddChildToRoot(const A& a) { |
64 scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2, a); | 64 scoped_ptr<T> layer = T::Create(host_->host_impl()->active_tree(), 2, a); |
65 T* ptr = layer.get(); | 65 T* ptr = layer.get(); |
66 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); | 66 root_layer_impl_->AddChild(layer.Pass()); |
67 return ptr; | 67 return ptr; |
68 } | 68 } |
69 | 69 |
70 template <typename T, typename A, typename B> | 70 template <typename T, typename A, typename B> |
71 T* AddChildToRoot(const A& a, const B& b) { | 71 T* AddChildToRoot(const A& a, const B& b) { |
72 scoped_ptr<T> layer = | 72 scoped_ptr<T> layer = |
73 T::Create(host_->host_impl()->active_tree(), 2, a, b); | 73 T::Create(host_->host_impl()->active_tree(), 2, a, b); |
74 T* ptr = layer.get(); | 74 T* ptr = layer.get(); |
75 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); | 75 root_layer_impl_->AddChild(layer.Pass()); |
76 return ptr; | 76 return ptr; |
77 } | 77 } |
78 | 78 |
79 template <typename T, typename A, typename B, typename C, typename D> | 79 template <typename T, typename A, typename B, typename C, typename D> |
80 T* AddChildToRoot(const A& a, const B& b, const C& c, const D& d) { | 80 T* AddChildToRoot(const A& a, const B& b, const C& c, const D& d) { |
81 scoped_ptr<T> layer = | 81 scoped_ptr<T> layer = |
82 T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d); | 82 T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d); |
83 T* ptr = layer.get(); | 83 T* ptr = layer.get(); |
84 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); | 84 root_layer_impl_->AddChild(layer.Pass()); |
85 return ptr; | 85 return ptr; |
86 } | 86 } |
87 | 87 |
88 template <typename T, | 88 template <typename T, |
89 typename A, | 89 typename A, |
90 typename B, | 90 typename B, |
91 typename C, | 91 typename C, |
92 typename D, | 92 typename D, |
93 typename E> | 93 typename E> |
94 T* AddChildToRoot(const A& a, | 94 T* AddChildToRoot(const A& a, |
95 const B& b, | 95 const B& b, |
96 const C& c, | 96 const C& c, |
97 const D& d, | 97 const D& d, |
98 const E& e) { | 98 const E& e) { |
99 scoped_ptr<T> layer = | 99 scoped_ptr<T> layer = |
100 T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d, e); | 100 T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d, e); |
101 T* ptr = layer.get(); | 101 T* ptr = layer.get(); |
102 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); | 102 root_layer_impl_->AddChild(layer.Pass()); |
103 return ptr; | 103 return ptr; |
104 } | 104 } |
105 | 105 |
106 void CalcDrawProps(const gfx::Size& viewport_size); | 106 void CalcDrawProps(const gfx::Size& viewport_size); |
107 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, | 107 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, |
108 const gfx::Rect& occluded); | 108 const gfx::Rect& occluded); |
109 void AppendQuadsForPassWithOcclusion(LayerImpl* layer_impl, | 109 void AppendQuadsForPassWithOcclusion(LayerImpl* layer_impl, |
110 const RenderPassId& id, | 110 const RenderPassId& id, |
111 const gfx::Rect& occluded); | 111 const gfx::Rect& occluded); |
112 void AppendSurfaceQuadsWithOcclusion(RenderSurfaceImpl* surface_impl, | 112 void AppendSurfaceQuadsWithOcclusion(RenderSurfaceImpl* surface_impl, |
(...skipping 15 matching lines...) Expand all Loading... |
128 scoped_ptr<FakeLayerTreeHost> host_; | 128 scoped_ptr<FakeLayerTreeHost> host_; |
129 scoped_ptr<LayerImpl> root_layer_impl_; | 129 scoped_ptr<LayerImpl> root_layer_impl_; |
130 scoped_ptr<RenderPass> render_pass_; | 130 scoped_ptr<RenderPass> render_pass_; |
131 MockOcclusionTracker<LayerImpl> occlusion_tracker_; | 131 MockOcclusionTracker<LayerImpl> occlusion_tracker_; |
132 }; | 132 }; |
133 }; | 133 }; |
134 | 134 |
135 } // namespace cc | 135 } // namespace cc |
136 | 136 |
137 #endif // CC_TEST_LAYER_TEST_COMMON_H_ | 137 #endif // CC_TEST_LAYER_TEST_COMMON_H_ |
OLD | NEW |