blob: dc82ad331c6a489e1c4570cce91074afecc1ecb7 [file] [log] [blame]
[email protected]ab9327c2012-05-02 02:38:081// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]4bedba72010-04-20 22:08:542// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]c9e2cbbb2012-05-12 21:17:275#ifndef UI_GL_GL_CONTEXT_OSMESA_H_
6#define UI_GL_GL_CONTEXT_OSMESA_H_
[email protected]4bedba72010-04-20 22:08:547
[email protected]c9e2cbbb2012-05-12 21:17:278#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "ui/gl/gl_context.h"
[email protected]4bedba72010-04-20 22:08:5411
[email protected]c9e2cbbb2012-05-12 21:17:2712typedef struct osmesa_context* OSMesaContext;
[email protected]5a6db6c2010-04-22 18:32:0613
14namespace gfx {
[email protected]4bedba72010-04-20 22:08:5415
[email protected]7196e012011-06-16 20:54:5316class GLShareGroup;
[email protected]f62a5ab2011-05-23 20:34:1517class GLSurface;
18
[email protected]4bedba72010-04-20 22:08:5419// Encapsulates an OSMesa OpenGL context that uses software rendering.
[email protected]1e9c0c82013-06-06 14:59:2420class GLContextOSMesa : public GLContextReal {
[email protected]4bedba72010-04-20 22:08:5421 public:
[email protected]7196e012011-06-16 20:54:5322 explicit GLContextOSMesa(GLShareGroup* share_group);
[email protected]4bedba72010-04-20 22:08:5423
[email protected]4bedba72010-04-20 22:08:5424 // Implement GLContext.
dcheng08038792014-10-21 10:53:2625 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;
bajones81068dd2014-12-11 02:00:5932 void OnSetSwapInterval(int interval) override;
[email protected]4bedba72010-04-20 22:08:5433
[email protected]ab9327c2012-05-02 02:38:0834 protected:
dcheng08038792014-10-21 10:53:2635 ~GLContextOSMesa() override;
[email protected]ab9327c2012-05-02 02:38:0836
[email protected]4bedba72010-04-20 22:08:5437 private:
[email protected]4bedba72010-04-20 22:08:5438 OSMesaContext context_;
hendrikw62d69132015-04-30 21:25:4939 bool is_released_;
[email protected]4bedba72010-04-20 22:08:5440
[email protected]ad7bbbd62011-04-22 23:04:3741 DISALLOW_COPY_AND_ASSIGN(GLContextOSMesa);
[email protected]4bedba72010-04-20 22:08:5442};
43
[email protected]5a6db6c2010-04-22 18:32:0644} // namespace gfx
[email protected]4bedba72010-04-20 22:08:5445
[email protected]c9e2cbbb2012-05-12 21:17:2746#endif // UI_GL_GL_CONTEXT_OSMESA_H_