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_OUTPUT_OUTPUT_SURFACE_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // 2. Passed to the compositor thread and bound to a client via BindToClient. | 39 // 2. Passed to the compositor thread and bound to a client via BindToClient. |
40 // From here on, it will only be used on the compositor thread. | 40 // From here on, it will only be used on the compositor thread. |
41 // 3. If the 3D context is lost, then the compositor will delete the output | 41 // 3. If the 3D context is lost, then the compositor will delete the output |
42 // surface (on the compositor thread) and go back to step 1. | 42 // surface (on the compositor thread) and go back to step 1. |
43 class CC_EXPORT OutputSurface { | 43 class CC_EXPORT OutputSurface { |
44 public: | 44 public: |
45 enum { | 45 enum { |
46 DEFAULT_MAX_FRAMES_PENDING = 2 | 46 DEFAULT_MAX_FRAMES_PENDING = 2 |
47 }; | 47 }; |
48 | 48 |
49 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider); | 49 explicit OutputSurface( |
| 50 const scoped_refptr<ContextProvider>& context_provider); |
50 | 51 |
51 explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device); | 52 explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device); |
52 | 53 |
53 OutputSurface(scoped_refptr<ContextProvider> context_provider, | 54 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, |
54 scoped_ptr<SoftwareOutputDevice> software_device); | 55 scoped_ptr<SoftwareOutputDevice> software_device); |
55 | 56 |
56 virtual ~OutputSurface(); | 57 virtual ~OutputSurface(); |
57 | 58 |
58 struct Capabilities { | 59 struct Capabilities { |
59 Capabilities() | 60 Capabilities() |
60 : delegated_rendering(false), | 61 : delegated_rendering(false), |
61 max_frames_pending(0), | 62 max_frames_pending(0), |
62 deferred_gl_initialization(false), | 63 deferred_gl_initialization(false), |
63 draw_and_swap_full_viewport_every_frame(false), | 64 draw_and_swap_full_viewport_every_frame(false), |
(...skipping 14 matching lines...) Expand all Loading... |
78 const Capabilities& capabilities() const { | 79 const Capabilities& capabilities() const { |
79 return capabilities_; | 80 return capabilities_; |
80 } | 81 } |
81 | 82 |
82 virtual bool HasExternalStencilTest() const; | 83 virtual bool HasExternalStencilTest() const; |
83 | 84 |
84 // Obtain the 3d context or the software device associated with this output | 85 // Obtain the 3d context or the software device associated with this output |
85 // surface. Either of these may return a null pointer, but not both. | 86 // surface. Either of these may return a null pointer, but not both. |
86 // In the event of a lost context, the entire output surface should be | 87 // In the event of a lost context, the entire output surface should be |
87 // recreated. | 88 // recreated. |
88 scoped_refptr<ContextProvider> context_provider() const { | 89 ContextProvider* context_provider() const { return context_provider_.get(); } |
89 return context_provider_.get(); | |
90 } | |
91 SoftwareOutputDevice* software_device() const { | 90 SoftwareOutputDevice* software_device() const { |
92 return software_device_.get(); | 91 return software_device_.get(); |
93 } | 92 } |
94 | 93 |
95 // Called by the compositor on the compositor thread. This is a place where | 94 // Called by the compositor on the compositor thread. This is a place where |
96 // thread-specific data for the output surface can be initialized, since from | 95 // thread-specific data for the output surface can be initialized, since from |
97 // this point on the output surface will only be used on the compositor | 96 // this point on the output surface will only be used on the compositor |
98 // thread. | 97 // thread. |
99 virtual bool BindToClient(OutputSurfaceClient* client); | 98 virtual bool BindToClient(OutputSurfaceClient* client); |
100 | 99 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 bool external_stencil_test_enabled_; | 176 bool external_stencil_test_enabled_; |
178 | 177 |
179 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 178 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
180 | 179 |
181 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 180 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
182 }; | 181 }; |
183 | 182 |
184 } // namespace cc | 183 } // namespace cc |
185 | 184 |
186 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 185 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |