2012-03-28 16:19:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
#ifndef SkANGLEGLContext_DEFINED
|
|
|
|
#define SkANGLEGLContext_DEFINED
|
|
|
|
|
|
|
|
#if SK_ANGLE
|
|
|
|
|
2013-02-28 20:16:25 +00:00
|
|
|
#include "SkGLContextHelper.h"
|
2012-03-28 16:19:11 +00:00
|
|
|
|
|
|
|
#include <GLES2/gl2.h>
|
|
|
|
#include <EGL/egl.h>
|
|
|
|
|
2013-02-28 20:16:25 +00:00
|
|
|
class SkANGLEGLContext : public SkGLContextHelper {
|
2012-03-28 16:19:11 +00:00
|
|
|
public:
|
|
|
|
SkANGLEGLContext();
|
|
|
|
|
|
|
|
virtual ~SkANGLEGLContext();
|
|
|
|
|
|
|
|
virtual void makeCurrent() const SK_OVERRIDE;
|
2013-10-09 18:25:38 +00:00
|
|
|
virtual void swapBuffers() const SK_OVERRIDE;
|
2012-03-28 16:19:11 +00:00
|
|
|
|
|
|
|
class AutoContextRestore {
|
|
|
|
public:
|
|
|
|
AutoContextRestore();
|
|
|
|
~AutoContextRestore();
|
|
|
|
|
|
|
|
private:
|
2012-04-02 15:04:16 +00:00
|
|
|
EGLContext fOldEGLContext;
|
|
|
|
EGLDisplay fOldDisplay;
|
|
|
|
EGLSurface fOldSurface;
|
2012-03-28 16:19:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
|
|
|
|
virtual void destroyGLContext() SK_OVERRIDE;
|
|
|
|
|
|
|
|
private:
|
2012-04-02 15:04:16 +00:00
|
|
|
EGLContext fContext;
|
|
|
|
EGLDisplay fDisplay;
|
|
|
|
EGLSurface fSurface;
|
2012-03-28 16:19:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|