[email protected] | ab9327c | 2012-05-02 02:38:08 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 5 | #ifndef UI_GL_GL_CONTEXT_OSMESA_H_ |
6 | #define UI_GL_GL_CONTEXT_OSMESA_H_ | ||||
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 7 | |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 8 | #include "base/basictypes.h" |
9 | #include "base/compiler_specific.h" | ||||
10 | #include "ui/gl/gl_context.h" | ||||
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 11 | |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 12 | typedef struct osmesa_context* OSMesaContext; |
[email protected] | 5a6db6c | 2010-04-22 18:32:06 | [diff] [blame] | 13 | |
14 | namespace gfx { | ||||
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 15 | |
[email protected] | 7196e01 | 2011-06-16 20:54:53 | [diff] [blame] | 16 | class GLShareGroup; |
[email protected] | f62a5ab | 2011-05-23 20:34:15 | [diff] [blame] | 17 | class GLSurface; |
18 | |||||
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 19 | // Encapsulates an OSMesa OpenGL context that uses software rendering. |
[email protected] | 1e9c0c8 | 2013-06-06 14:59:24 | [diff] [blame] | 20 | class GLContextOSMesa : public GLContextReal { |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 21 | public: |
[email protected] | 7196e01 | 2011-06-16 20:54:53 | [diff] [blame] | 22 | explicit GLContextOSMesa(GLShareGroup* share_group); |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 23 | |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 24 | // Implement GLContext. |
dcheng | 0803879 | 2014-10-21 10:53:26 | [diff] [blame] | 25 | bool Initialize(GLSurface* compatible_surface, |
26 | GpuPreference gpu_preference) override; | ||||
27 | void Destroy() override; | ||||
28 | bool MakeCurrent(GLSurface* surface) override; | ||||
29 | void ReleaseCurrent(GLSurface* surface) override; | ||||
30 | bool IsCurrent(GLSurface* surface) override; | ||||
31 | void* GetHandle() override; | ||||
bajones | 81068dd | 2014-12-11 02:00:59 | [diff] [blame] | 32 | void OnSetSwapInterval(int interval) override; |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 33 | |
[email protected] | ab9327c | 2012-05-02 02:38:08 | [diff] [blame] | 34 | protected: |
dcheng | 0803879 | 2014-10-21 10:53:26 | [diff] [blame] | 35 | ~GLContextOSMesa() override; |
[email protected] | ab9327c | 2012-05-02 02:38:08 | [diff] [blame] | 36 | |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 37 | private: |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 38 | OSMesaContext context_; |
hendrikw | 62d6913 | 2015-04-30 21:25:49 | [diff] [blame] | 39 | bool is_released_; |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 40 | |
[email protected] | ad7bbbd6 | 2011-04-22 23:04:37 | [diff] [blame] | 41 | DISALLOW_COPY_AND_ASSIGN(GLContextOSMesa); |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 42 | }; |
43 | |||||
[email protected] | 5a6db6c | 2010-04-22 18:32:06 | [diff] [blame] | 44 | } // namespace gfx |
[email protected] | 4bedba7 | 2010-04-20 22:08:54 | [diff] [blame] | 45 | |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 46 | #endif // UI_GL_GL_CONTEXT_OSMESA_H_ |