• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
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 
13 #include "gl/SkGLContext.h"
14 
15 class SkANGLEGLContext : public SkGLContext {
16 public:
17     ~SkANGLEGLContext() override;
18     void makeCurrent() const override;
19     void swapBuffers() const override;
20 
Create(GrGLStandard forcedGpuAPI)21     static SkANGLEGLContext* Create(GrGLStandard forcedGpuAPI) {
22         if (kGL_GrGLStandard == forcedGpuAPI) {
23             return NULL;
24         }
25         SkANGLEGLContext* ctx = SkNEW(SkANGLEGLContext);
26         if (!ctx->isValid()) {
27             SkDELETE(ctx);
28             return NULL;
29         }
30         return ctx;
31     }
32 
33     // The param is an EGLNativeDisplayType and the return is an EGLDispay.
34     static void* GetD3DEGLDisplay(void* nativeDisplay);
35 
36 private:
37     SkANGLEGLContext();
38     void destroyGLContext();
39 
40     void* fContext;
41     void* fDisplay;
42     void* fSurface;
43 };
44 
45 #endif
46 
47 #endif
48