aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/gl/angle/SkANGLEGLContext.h
blob: 6705248f25d7984b336a50fadc725801d1276cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

/*
 * 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

#include "gl/SkGLContext.h"

class SkANGLEGLContext : public SkGLContext {
public:
    ~SkANGLEGLContext() SK_OVERRIDE;
    void makeCurrent() const SK_OVERRIDE;
    void swapBuffers() const SK_OVERRIDE;

    static SkANGLEGLContext* Create(GrGLStandard forcedGpuAPI) {
        if (kGL_GrGLStandard == forcedGpuAPI) {
            return NULL;
        }
        SkANGLEGLContext* ctx = SkNEW(SkANGLEGLContext);
        if (!ctx->isValid()) {
            SkDELETE(ctx);
            return NULL;
        }
        return ctx;
    }

    // The param is an EGLNativeDisplayType and the return is an EGLDispay.
    static void* GetD3DEGLDisplay(void* nativeDisplay);

private:
    SkANGLEGLContext();
    void destroyGLContext();

    void* fContext;
    void* fDisplay;
    void* fSurface;
};

#endif

#endif