diff options
Diffstat (limited to 'src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp')
-rw-r--r-- | src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp index 8006d498aa..7933757186 100644 --- a/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp +++ b/src/gpu/gl/glx/SkCreatePlatformGLContext_glx.cpp @@ -48,12 +48,14 @@ class GLXGLContext : public SkGLContext { public: GLXGLContext(GrGLStandard forcedGpuAPI); ~GLXGLContext() override; - void makeCurrent() const override; - void swapBuffers() const override; private: void destroyGLContext(); + void onPlatformMakeCurrent() const override; + void onPlatformSwapBuffers() const override; + GrGLFuncPtr onPlatformGetProcAddress(const char*) const override; + GLXContext fContext; Display* fDisplay; Pixmap fPixmap; @@ -267,27 +269,29 @@ GLXGLContext::GLXGLContext(GrGLStandard forcedGpuAPI) return; } - fGL.reset(GrGLCreateNativeInterface()); - if (NULL == fGL.get()) { + SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface()); + if (NULL == gl.get()) { SkDebugf("Failed to create gl interface"); this->destroyGLContext(); return; } - if (!fGL->validate()) { + if (!gl->validate()) { SkDebugf("Failed to validate gl interface"); this->destroyGLContext(); return; } + + this->init(gl.detach()); } GLXGLContext::~GLXGLContext() { + this->teardown(); this->destroyGLContext(); } void GLXGLContext::destroyGLContext() { - fGL.reset(NULL); if (fDisplay) { glXMakeCurrent(fDisplay, 0, 0); @@ -311,16 +315,20 @@ void GLXGLContext::destroyGLContext() { } } -void GLXGLContext::makeCurrent() const { +void GLXGLContext::onPlatformMakeCurrent() const { if (!glXMakeCurrent(fDisplay, fGlxPixmap, fContext)) { SkDebugf("Could not set the context.\n"); } } -void GLXGLContext::swapBuffers() const { +void GLXGLContext::onPlatformSwapBuffers() const { glXSwapBuffers(fDisplay, fGlxPixmap); } +GrGLFuncPtr GLXGLContext::onPlatformGetProcAddress(const char* procName) const { + return glXGetProcAddress(reinterpret_cast<const GLubyte*>(procName)); +} + } // anonymous namespace SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI) { |