5f3a65123c7de168c65a002027286b8f4045ff0c
[gecko.git] / GLManager.h
blob5f3a65123c7de168c65a002027286b8f4045ff0c
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef MOZILLA_GFX_GLMANAGER_H
7 #define MOZILLA_GFX_GLMANAGER_H
9 #include "mozilla/gfx/Types.h" // for SurfaceFormat
10 #include "LayerManagerOGLProgram.h"
12 namespace mozilla {
13 namespace gl {
14 class GLContext;
17 namespace layers {
19 class LayerManager;
21 /**
22 * Minimal interface to allow widgets to draw using OpenGL. Abstracts
23 * LayerManagerOGL and CompositorOGL. Call CreateGLManager with either a
24 * LayerManagerOGL or a LayerManagerComposite backed by a CompositorOGL.
26 class GLManager
28 public:
29 static GLManager* CreateGLManager(LayerManager* aManager);
31 virtual ~GLManager() {}
33 virtual gl::GLContext* gl() const = 0;
34 virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) = 0;
35 virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) = 0;
37 ShaderProgramOGL* GetProgram(gfx::SurfaceFormat aFormat) {
38 return GetProgram(ShaderProgramFromSurfaceFormat(aFormat));
44 #endif