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

Side by Side Diff: src/gpu/gl/mac/GrGLCreateNativeInterface_mac.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/iOS/SkNativeGLContext_iOS.mm ('k') | src/gpu/gl/mac/SkNativeGLContext_mac.cpp » ('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 2011 Google Inc. 3 * Copyright 2011 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 9
10 #include "gl/GrGLInterface.h" 10 #include "gl/GrGLInterface.h"
11 #include "gl/GrGLAssembleInterface.h" 11 #include "gl/GrGLAssembleInterface.h"
12 12
13 #include <dlfcn.h> 13 #include <dlfcn.h>
14 14
15 class GLLoader { 15 class GLLoader {
16 public: 16 public:
17 GLLoader() { 17 GLLoader() {
18 fLibrary = dlopen( 18 fLibrary = dlopen(
19 "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libr aries/libGL.dylib", 19 "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libr aries/libGL.dylib",
20 RTLD_LAZY); 20 RTLD_LAZY);
21 } 21 }
22 22
23 ~GLLoader() { 23 ~GLLoader() {
24 if (NULL != fLibrary) { 24 if (fLibrary) {
25 dlclose(fLibrary); 25 dlclose(fLibrary);
26 } 26 }
27 } 27 }
28 28
29 void* handle() const { 29 void* handle() const {
30 return NULL == fLibrary ? RTLD_DEFAULT : fLibrary; 30 return NULL == fLibrary ? RTLD_DEFAULT : fLibrary;
31 } 31 }
32 32
33 private: 33 private:
34 void* fLibrary; 34 void* fLibrary;
35 }; 35 };
36 36
37 class GLProcGetter { 37 class GLProcGetter {
38 public: 38 public:
39 GLProcGetter() {} 39 GLProcGetter() {}
40 40
41 GrGLFuncPtr getProc(const char name[]) const { 41 GrGLFuncPtr getProc(const char name[]) const {
42 return (GrGLFuncPtr) dlsym(fLoader.handle(), name); 42 return (GrGLFuncPtr) dlsym(fLoader.handle(), name);
43 } 43 }
44 44
45 private: 45 private:
46 GLLoader fLoader; 46 GLLoader fLoader;
47 }; 47 };
48 48
49 static GrGLFuncPtr mac_get_gl_proc(void* ctx, const char name[]) { 49 static GrGLFuncPtr mac_get_gl_proc(void* ctx, const char name[]) {
50 SkASSERT(NULL != ctx); 50 SkASSERT(ctx);
51 const GLProcGetter* getter = (const GLProcGetter*) ctx; 51 const GLProcGetter* getter = (const GLProcGetter*) ctx;
52 return getter->getProc(name); 52 return getter->getProc(name);
53 } 53 }
54 54
55 const GrGLInterface* GrGLCreateNativeInterface() { 55 const GrGLInterface* GrGLCreateNativeInterface() {
56 GLProcGetter getter; 56 GLProcGetter getter;
57 return GrGLAssembleGLInterface(&getter, mac_get_gl_proc); 57 return GrGLAssembleGLInterface(&getter, mac_get_gl_proc);
58 } 58 }
OLDNEW
« no previous file with comments | « src/gpu/gl/iOS/SkNativeGLContext_iOS.mm ('k') | src/gpu/gl/mac/SkNativeGLContext_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698