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/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 template <typename T, typename A, typename B, typename C, typename D> | 69 template <typename T, typename A, typename B, typename C, typename D> |
70 T* AddChildToRoot(const A& a, const B& b, const C& c, const D& d) { | 70 T* AddChildToRoot(const A& a, const B& b, const C& c, const D& d) { |
71 scoped_ptr<T> layer = | 71 scoped_ptr<T> layer = |
72 T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d); | 72 T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d); |
73 T* ptr = layer.get(); | 73 T* ptr = layer.get(); |
74 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); | 74 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); |
75 return ptr; | 75 return ptr; |
76 } | 76 } |
77 | 77 |
| 78 template <typename T, |
| 79 typename A, |
| 80 typename B, |
| 81 typename C, |
| 82 typename D, |
| 83 typename E> |
| 84 T* AddChildToRoot(const A& a, |
| 85 const B& b, |
| 86 const C& c, |
| 87 const D& d, |
| 88 const E& e) { |
| 89 scoped_ptr<T> layer = |
| 90 T::Create(host_->host_impl()->active_tree(), 2, a, b, c, d, e); |
| 91 T* ptr = layer.get(); |
| 92 root_layer_impl_->AddChild(layer.template PassAs<LayerImpl>()); |
| 93 return ptr; |
| 94 } |
| 95 |
78 void CalcDrawProps(const gfx::Size& viewport_size); | 96 void CalcDrawProps(const gfx::Size& viewport_size); |
79 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, | 97 void AppendQuadsWithOcclusion(LayerImpl* layer_impl, |
80 const gfx::Rect& occluded); | 98 const gfx::Rect& occluded); |
81 | 99 |
82 OutputSurface* output_surface() const { | 100 OutputSurface* output_surface() const { |
83 return host_->host_impl()->output_surface(); | 101 return host_->host_impl()->output_surface(); |
84 } | 102 } |
85 ResourceProvider* resource_provider() const { | 103 ResourceProvider* resource_provider() const { |
86 return host_->host_impl()->resource_provider(); | 104 return host_->host_impl()->resource_provider(); |
87 } | 105 } |
88 FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); } | 106 FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); } |
89 Proxy* proxy() const { return host_->host_impl()->proxy(); } | 107 Proxy* proxy() const { return host_->host_impl()->proxy(); } |
90 const QuadList& quad_list() const { return quad_culler_.quad_list(); } | 108 const QuadList& quad_list() const { return quad_culler_.quad_list(); } |
91 | 109 |
92 private: | 110 private: |
93 scoped_ptr<FakeLayerTreeHost> host_; | 111 scoped_ptr<FakeLayerTreeHost> host_; |
94 scoped_ptr<LayerImpl> root_layer_impl_; | 112 scoped_ptr<LayerImpl> root_layer_impl_; |
95 MockQuadCuller quad_culler_; | 113 MockQuadCuller quad_culler_; |
96 }; | 114 }; |
97 }; | 115 }; |
98 | 116 |
99 } // namespace cc | 117 } // namespace cc |
100 | 118 |
101 #endif // CC_TEST_LAYER_TEST_COMMON_H_ | 119 #endif // CC_TEST_LAYER_TEST_COMMON_H_ |
OLD | NEW |