aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp')
-rw-r--r--src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp b/src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp
new file mode 100644
index 0000000000..3fbe037b1c
--- /dev/null
+++ b/src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "gl/GrGLInterface.h"
+#include "gl/GrGLAssembleInterface.h"
+#include "gl/GrGLUtil.h"
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+
+static GrGLFuncPtr egl_get_gl_proc(void* ctx, const char name[]) {
+ SkASSERT(nullptr == ctx);
+ GrGLFuncPtr ptr = eglGetProcAddress(name);
+ if (!ptr) {
+ if (0 == strcmp("eglQueryString", name)) {
+ return (GrGLFuncPtr)eglQueryString;
+ } else if (0 == strcmp("eglGetCurrentDisplay", name)) {
+ return (GrGLFuncPtr)eglGetCurrentDisplay;
+ }
+ }
+ return ptr;
+}
+
+sk_sp<const GrGLInterface> GrGLMakeNativeInterface() {
+ return GrGLAssembleInterface(nullptr, egl_get_gl_proc);
+}
+
+const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); }