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

Side by Side Diff: tools/gpu/gl/glx/CreatePlatformGLContext_glx.cpp

Issue 1815823002: Move SkGLContext and some GrGLInterface implementations to skgputest module (Closed) Base URL: https://chromium.googlesource.com/skia.git@debugobject
Patch Set: rebase, readd null interface to main lib 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
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 #include "gl/SkGLContext.h" 8 #include "gl/GLContext.h"
9 9
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
11 #include <GL/glx.h> 11 #include <GL/glx.h>
12 #include <GL/glu.h> 12 #include <GL/glu.h>
13 13
14 namespace { 14 namespace {
15 15
16 /* Note: Skia requires glx 1.3 or newer */ 16 /* Note: Skia requires glx 1.3 or newer */
17 17
18 /* This struct is taken from a mesa demo. Please update as required */ 18 /* This struct is taken from a mesa demo. Please update as required */
(...skipping 18 matching lines...) Expand all
37 {0, 0} /* end of list */ 37 {0, 0} /* end of list */
38 }; 38 };
39 #define NUM_GL_VERSIONS SK_ARRAY_COUNT(gl_versions) 39 #define NUM_GL_VERSIONS SK_ARRAY_COUNT(gl_versions)
40 40
41 static bool ctxErrorOccurred = false; 41 static bool ctxErrorOccurred = false;
42 static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) { 42 static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) {
43 ctxErrorOccurred = true; 43 ctxErrorOccurred = true;
44 return 0; 44 return 0;
45 } 45 }
46 46
47 class GLXGLContext : public SkGLContext { 47 class GLXGLContext : public sk_gpu_test::GLContext {
48 public: 48 public:
49 GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareList); 49 GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareList);
50 ~GLXGLContext() override; 50 ~GLXGLContext() override;
51 51
52 private: 52 private:
53 void destroyGLContext(); 53 void destroyGLContext();
54 54
55 void onPlatformMakeCurrent() const override; 55 void onPlatformMakeCurrent() const override;
56 void onPlatformSwapBuffers() const override; 56 void onPlatformSwapBuffers() const override;
57 GrGLFuncPtr onPlatformGetProcAddress(const char*) const override; 57 GrGLFuncPtr onPlatformGetProcAddress(const char*) const override;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 325
326 void GLXGLContext::onPlatformSwapBuffers() const { 326 void GLXGLContext::onPlatformSwapBuffers() const {
327 glXSwapBuffers(fDisplay, fGlxPixmap); 327 glXSwapBuffers(fDisplay, fGlxPixmap);
328 } 328 }
329 329
330 GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const { 330 GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const {
331 return glXGetProcAddress(reinterpret_cast<const GLubyte*>(procName)); 331 return glXGetProcAddress(reinterpret_cast<const GLubyte*>(procName));
332 } 332 }
333 333
334 } // anonymous namespace 334 } // anonymous namespace
335 335
336 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI, SkGLContext* s hareContext) { 336 namespace sk_gpu_test {
337 GLXGLContext* glxShareContext = reinterpret_cast<GLXGLContext*>(shareContext ); 337 GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareCo ntext) {
338 GLXGLContext *glxShareContext = reinterpret_cast<GLXGLContext *>(shareContex t);
338 GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI, glxShareContext); 339 GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI, glxShareContext);
339 if (!ctx->isValid()) { 340 if (!ctx->isValid()) {
340 delete ctx; 341 delete ctx;
341 return nullptr; 342 return nullptr;
342 } 343 }
343 return ctx; 344 return ctx;
344 } 345 }
346 } // namespace sk_gpu_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698