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

Side by Side Diff: src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 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
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 (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 nullptr == 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(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/GrGLCreateNativeInterface_iOS.cpp ('k') | src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698