diff options
Diffstat (limited to 'src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp')
-rw-r--r-- | src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp b/src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp new file mode 100644 index 0000000000..3873510499 --- /dev/null +++ b/src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2016 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 <GLFW/glfw3.h> + +static GrGLFuncPtr glfw_get(void* ctx, const char name[]) { + SkASSERT(nullptr == ctx); + SkASSERT(glfwGetCurrentContext()); + return glfwGetProcAddress(name); +} + +sk_sp<const GrGLInterface> GrGLMakeNativeInterface() { + if (nullptr == glfwGetCurrentContext()) { + return nullptr; + } + + return GrGLAssembleInterface(nullptr, glfw_get); +} + +const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); } |