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

Side by Side Diff: tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp

Issue 1815823002: Move SkGLContext and some GrGLInterface implementations to skgputest module (Closed) Base URL: https://chromium.googlesource.com/skia.git@debugobject
Patch Set: fix windows and android? Created 4 years, 8 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 | « tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm ('k') | tools/gpu/gl/mesa/GLContext_mesa.h » ('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 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
3 * 4 *
4 * 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
5 * found in the LICENSE file. 6 * found in the LICENSE file.
6 */ 7 */
7 #include "SkTypes.h" 8 #include "SkTypes.h"
8 #if defined(SK_BUILD_FOR_MAC)
9 9
10 #include "gl/SkGLContext.h" 10 #include "gl/GLContext.h"
11 #include "AvailabilityMacros.h" 11 #include "AvailabilityMacros.h"
12 12
13 #include <OpenGL/OpenGL.h> 13 #include <OpenGL/OpenGL.h>
14 #include <dlfcn.h> 14 #include <dlfcn.h>
15 15
16 namespace { 16 namespace {
17 class MacGLContext : public SkGLContext { 17 class MacGLContext : public sk_gpu_test::GLContext {
18 public: 18 public:
19 MacGLContext(); 19 MacGLContext();
20 ~MacGLContext() override; 20 ~MacGLContext() override;
21 21
22 private: 22 private:
23 void destroyGLContext(); 23 void destroyGLContext();
24 24
25 void onPlatformMakeCurrent() const override; 25 void onPlatformMakeCurrent() const override;
26 void onPlatformSwapBuffers() const override; 26 void onPlatformSwapBuffers() const override;
27 GrGLFuncPtr onPlatformGetProcAddress(const char*) const override; 27 GrGLFuncPtr onPlatformGetProcAddress(const char*) const override;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 void MacGLContext::onPlatformSwapBuffers() const { 101 void MacGLContext::onPlatformSwapBuffers() const {
102 CGLFlushDrawable(fContext); 102 CGLFlushDrawable(fContext);
103 } 103 }
104 104
105 GrGLFuncPtr MacGLContext::onPlatformGetProcAddress(const char* procName) const { 105 GrGLFuncPtr MacGLContext::onPlatformGetProcAddress(const char* procName) const {
106 return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName)); 106 return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName));
107 } 107 }
108 108
109 } // anonymous namespace 109 } // anonymous namespace
110 110
111 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI, SkGLContext* s hareContext) { 111 namespace sk_gpu_test {
112 GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext* shareCo ntext) {
112 SkASSERT(!shareContext); 113 SkASSERT(!shareContext);
113 if (shareContext) { 114 if (shareContext) {
114 return nullptr; 115 return nullptr;
115 } 116 }
116 117
117 if (kGLES_GrGLStandard == forcedGpuAPI) { 118 if (kGLES_GrGLStandard == forcedGpuAPI) {
118 return nullptr; 119 return nullptr;
119 } 120 }
120 MacGLContext* ctx = new MacGLContext; 121 MacGLContext* ctx = new MacGLContext;
121 if (!ctx->isValid()) { 122 if (!ctx->isValid()) {
122 delete ctx; 123 delete ctx;
123 return nullptr; 124 return nullptr;
124 } 125 }
125 return ctx; 126 return ctx;
126 } 127 }
127 128 } // namespace sk_gpu_test
128 #endif//defined(SK_BUILD_FOR_MAC)
OLDNEW
« no previous file with comments | « tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm ('k') | tools/gpu/gl/mesa/GLContext_mesa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698