diff options
-rw-r--r-- | cmake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 19a7acda9e..88877f4a3d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -93,6 +93,7 @@ remove_srcs( ../src/gpu/gl/SkCreatePlatformGLContext*.cpp # For internal testing only. ../src/gpu/gl/command_buffer/* ../src/gpu/gl/egl/* + ../src/gpu/gl/glfw/* ../src/gpu/gl/iOS/* ../src/gpu/vk/* ../src/opts/SkBitmapProcState_opts_none.cpp diff --git a/src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp b/src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp new file mode 100644 index 0000000000..e2f6e668cd --- /dev/null +++ b/src/gpu/gl/glfw/GrGLCreateNativeInterface_glfw.cpp @@ -0,0 +1,27 @@ +/* + * 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); +} + +const GrGLInterface* GrGLCreateNativeInterface() { + if (nullptr == glfwGetCurrentContext()) { + return nullptr; + } + + return GrGLAssembleInterface(nullptr, glfw_get); +} |