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/ganesh/gl/ios/GrGLMakeIOSInterface.h" 11 #include "include/gpu/ganesh/gl/GrGLAssembleInterface.h" 12 #include "include/gpu/ganesh/gl/GrGLInterface.h" 13 #include "include/private/base/SkTemplates.h" 14 15 #include <dlfcn.h> 16 #include <memory> 17 18 namespace GrGLInterfaces { MakeIOS()19sk_sp<const GrGLInterface> MakeIOS() { 20 static const char kPath[] = 21 "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"; 22 std::unique_ptr<void, SkFunctionObject<dlclose>> lib(dlopen(kPath, RTLD_LAZY)); 23 return GrGLMakeAssembledGLESInterface(lib.get(), [](void* ctx, const char* name) { 24 return (GrGLFuncPtr)dlsym(ctx ? ctx : RTLD_DEFAULT, name); }); 25 } 26 27 } // namespace GrGLInterfaces 28 29 #if !defined(SK_DISABLE_LEGACY_GL_MAKE_NATIVE_INTERFACE) GrGLMakeNativeInterface()30sk_sp<const GrGLInterface> GrGLMakeNativeInterface() { 31 return GrGLInterfaces::MakeIOS(); 32 } 33 #endif 34 35 #endif // SK_BUILD_FOR_IOS 36