blob: 63765a0131fc16f8ac6f91c82f8e047ddd2142b0 [file] [log] [blame]
robertphillips@google.comd3b9fbb2012-03-28 16:19:11 +00001
2/*
3 * Copyright 2012 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8#ifndef SkANGLEGLContext_DEFINED
9#define SkANGLEGLContext_DEFINED
10
11#if SK_ANGLE
12
robertphillips@google.com6177e692013-02-28 20:16:25 +000013#include "SkGLContextHelper.h"
robertphillips@google.comd3b9fbb2012-03-28 16:19:11 +000014
15#include <GLES2/gl2.h>
16#include <EGL/egl.h>
17
robertphillips@google.com6177e692013-02-28 20:16:25 +000018class SkANGLEGLContext : public SkGLContextHelper {
robertphillips@google.comd3b9fbb2012-03-28 16:19:11 +000019public:
20 SkANGLEGLContext();
21
22 virtual ~SkANGLEGLContext();
23
24 virtual void makeCurrent() const SK_OVERRIDE;
25
26 class AutoContextRestore {
27 public:
28 AutoContextRestore();
29 ~AutoContextRestore();
30
31 private:
robertphillips@google.comd5c8fe62012-04-02 15:04:16 +000032 EGLContext fOldEGLContext;
33 EGLDisplay fOldDisplay;
34 EGLSurface fOldSurface;
robertphillips@google.comd3b9fbb2012-03-28 16:19:11 +000035 };
36
37protected:
38 virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
39 virtual void destroyGLContext() SK_OVERRIDE;
40
41private:
robertphillips@google.comd5c8fe62012-04-02 15:04:16 +000042 EGLContext fContext;
43 EGLDisplay fDisplay;
44 EGLSurface fSurface;
robertphillips@google.comd3b9fbb2012-03-28 16:19:11 +000045};
46
47#endif
48
49#endif