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

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: 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
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 "gl/SkGLContext.h" 8 #include "gl/GLContext.h"
8 9
9 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
10 #include <GL/glx.h> 11 #include <GL/glx.h>
11 #include <GL/glu.h> 12 #include <GL/glu.h>
12 13
13 namespace { 14 namespace {
14 15
15 /* Note: Skia requires glx 1.3 or newer */ 16 /* Note: Skia requires glx 1.3 or newer */
16 17
17 /* 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
36 {0, 0} /* end of list */ 37 {0, 0} /* end of list */
37 }; 38 };
38 #define NUM_GL_VERSIONS SK_ARRAY_COUNT(gl_versions) 39 #define NUM_GL_VERSIONS SK_ARRAY_COUNT(gl_versions)
39 40
40 static bool ctxErrorOccurred = false; 41 static bool ctxErrorOccurred = false;
41 static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) { 42 static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) {
42 ctxErrorOccurred = true; 43 ctxErrorOccurred = true;
43 return 0; 44 return 0;
44 } 45 }
45 46
46 class GLXGLContext : public SkGLContext { 47 class GLXGLContext : public sk_gpu_test::GLContext {
47 public: 48 public:
48 GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareList); 49 GLXGLContext(GrGLStandard forcedGpuAPI, GLXGLContext* shareList);
49 ~GLXGLContext() override; 50 ~GLXGLContext() override;
50 51
51 private: 52 private:
52 void destroyGLContext(); 53 void destroyGLContext();
53 54
54 void onPlatformMakeCurrent() const override; 55 void onPlatformMakeCurrent() const override;
55 void onPlatformSwapBuffers() const override; 56 void onPlatformSwapBuffers() const override;
56 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
323 } 324 }
324 325
325 void GLXGLContext::onPlatformSwapBuffers() const { 326 void GLXGLContext::onPlatformSwapBuffers() const {
326 glXSwapBuffers(fDisplay, fGlxPixmap); 327 glXSwapBuffers(fDisplay, fGlxPixmap);
327 } 328 }
328 329
329 GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const { 330 GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const {
330 return glXGetProcAddress(reinterpret_cast<const GLubyte*>(procName)); 331 return glXGetProcAddress(reinterpret_cast<const GLubyte*>(procName));
331 } 332 }
332 333
333 } // anonymous namespace 334 } // anonymous namespace
334 335
335 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI, SkGLContext* s hareContext) { 336 namespace sk_gpu_test {
336 GLXGLContext* glxShareContext = reinterpret_cast<GLXGLContext*>(shareContext ); 337 GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareCo ntext) {
338 GLXGLContext *glxShareContext = reinterpret_cast<GLXGLContext *>(shareContex t);
337 GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI, glxShareContext); 339 GLXGLContext *ctx = new GLXGLContext(forcedGpuAPI, glxShareContext);
338 if (!ctx->isValid()) { 340 if (!ctx->isValid()) {
339 delete ctx; 341 delete ctx;
340 return nullptr; 342 return nullptr;
341 } 343 }
342 return ctx; 344 return ctx;
343 } 345 }
346 } // namespace sk_gpu_test
OLDNEW
« no previous file with comments | « tools/gpu/gl/egl/CreatePlatformGLContext_egl.cpp ('k') | tools/gpu/gl/iOS/CreatePlatformGLContext_iOS.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698