Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/debug/GrGLCreateDebugInterface.cpp ('k') | src/gpu/gl/iOS/SkNativeGLContext_iOS.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "gl/GrGLInterface.h" 9 #include "gl/GrGLInterface.h"
10 #include "gl/GrGLAssembleInterface.h" 10 #include "gl/GrGLAssembleInterface.h"
11 #include <dlfcn.h> 11 #include <dlfcn.h>
12 12
13 class GLLoader { 13 class GLLoader {
14 public: 14 public:
15 GLLoader() { 15 GLLoader() {
16 fLibrary = dlopen( 16 fLibrary = dlopen(
17 "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/li bGL.dylib", 17 "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/li bGL.dylib",
18 RTLD_LAZY); 18 RTLD_LAZY);
19 } 19 }
20 20
21 ~GLLoader() { 21 ~GLLoader() {
22 if (NULL != fLibrary) { 22 if (fLibrary) {
23 dlclose(fLibrary); 23 dlclose(fLibrary);
24 } 24 }
25 } 25 }
26 26
27 void* handle() const { 27 void* handle() const {
28 return NULL == fLibrary ? RTLD_DEFAULT : fLibrary; 28 return NULL == fLibrary ? RTLD_DEFAULT : fLibrary;
29 } 29 }
30 30
31 private: 31 private:
32 void* fLibrary; 32 void* fLibrary;
33 }; 33 };
34 34
35 class GLProcGetter { 35 class GLProcGetter {
36 public: 36 public:
37 GLProcGetter() {} 37 GLProcGetter() {}
38 38
39 GrGLFuncPtr getProc(const char name[]) const { 39 GrGLFuncPtr getProc(const char name[]) const {
40 return (GrGLFuncPtr) dlsym(fLoader.handle(), name); 40 return (GrGLFuncPtr) dlsym(fLoader.handle(), name);
41 } 41 }
42 42
43 private: 43 private:
44 GLLoader fLoader; 44 GLLoader fLoader;
45 }; 45 };
46 46
47 static GrGLFuncPtr ios_get_gl_proc(void* ctx, const char name[]) { 47 static GrGLFuncPtr ios_get_gl_proc(void* ctx, const char name[]) {
48 SkASSERT(NULL != ctx); 48 SkASSERT(ctx);
49 const GLProcGetter* getter = (const GLProcGetter*) ctx; 49 const GLProcGetter* getter = (const GLProcGetter*) ctx;
50 return getter->getProc(name); 50 return getter->getProc(name);
51 } 51 }
52 52
53 const GrGLInterface* GrGLCreateNativeInterface() { 53 const GrGLInterface* GrGLCreateNativeInterface() {
54 GLProcGetter getter; 54 GLProcGetter getter;
55 return GrGLAssembleGLESInterface(&getter, ios_get_gl_proc); 55 return GrGLAssembleGLESInterface(&getter, ios_get_gl_proc);
56 } 56 }
OLDNEW
« no previous file with comments | « src/gpu/gl/debug/GrGLCreateDebugInterface.cpp ('k') | src/gpu/gl/iOS/SkNativeGLContext_iOS.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698