Add GLFW support for GrGLCreateNativeInterface

This file lets us use Skia's GPU backend with GLFW.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1827153003
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot

Review URL: https://codereview.chromium.org/1827153003
This commit is contained in:
abarth 2016-03-28 11:34:27 -07:00 committed by Commit bot
parent df801aac5f
commit 7fb19bc229
2 changed files with 28 additions and 0 deletions

View File

@ -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

View File

@ -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);
}