1 /* 2 * Copyright 2014 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 #include "include/core/SkTypes.h" 8 #ifdef SK_BUILD_FOR_IOS 9 10 #include "include/gpu/gl/GrGLInterface.h" 11 12 #include "include/gpu/gl/GrGLAssembleInterface.h" 13 #include "include/private/SkTemplates.h" 14 15 #include <dlfcn.h> 16 #include <memory> 17 GrGLMakeNativeInterface()18sk_sp<const GrGLInterface> GrGLMakeNativeInterface() { 19 static const char kPath[] = 20 "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"; 21 std::unique_ptr<void, SkFunctionWrapper<int(void*), dlclose>> lib(dlopen(kPath, RTLD_LAZY)); 22 return GrGLMakeAssembledGLESInterface(lib.get(), [](void* ctx, const char* name) { 23 return (GrGLFuncPtr)dlsym(ctx ? ctx : RTLD_DEFAULT, name); }); 24 } 25 GrGLCreateNativeInterface()26const GrGLInterface* GrGLCreateNativeInterface() { return GrGLMakeNativeInterface().release(); } 27 28 #endif // SK_BUILD_FOR_IOS 29