Chromium Code Reviews| Index: ui/gl/gl_surface_glx.cc |
| diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc |
| index b349e7c9e56bb19498ad680274ec826c2c8b305e..4fb33f3091fa4f59bacd535f1ac0d214e8d81fde 100644 |
| --- a/ui/gl/gl_surface_glx.cc |
| +++ b/ui/gl/gl_surface_glx.cc |
| @@ -451,10 +451,19 @@ bool NativeViewGLSurfaceGLX::Initialize() { |
| else if (g_glx_sgi_video_sync_supported) |
| vsync_provider_.reset(new SGIVideoSyncVSyncProvider(window_)); |
| + glx_window_ = glXCreateWindow( |
| + g_display, |
| + static_cast<GLXFBConfig>(GetConfig()), |
| + window_, |
| + NULL); |
|
Ken Russell (switch to Gerrit)
2012/12/06 21:41:20
You should test the return value here and fail ini
ccameron
2012/12/06 22:18:10
Ah -- I thought that all GLX errors were asynchron
|
| return true; |
| } |
| void NativeViewGLSurfaceGLX::Destroy() { |
| + if (glx_window_) { |
| + glXDestroyWindow(g_display, glx_window_); |
| + glx_window_ = 0; |
| + } |
| } |
| bool NativeViewGLSurfaceGLX::Resize(const gfx::Size& size) { |
| @@ -472,7 +481,7 @@ bool NativeViewGLSurfaceGLX::IsOffscreen() { |
| } |
| bool NativeViewGLSurfaceGLX::SwapBuffers() { |
| - glXSwapBuffers(g_display, window_); |
| + glXSwapBuffers(g_display, glx_window_); |
| // For latency_tests.cc: |
| UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); |
| return true; |
| @@ -483,7 +492,7 @@ gfx::Size NativeViewGLSurfaceGLX::GetSize() { |
| } |
| void* NativeViewGLSurfaceGLX::GetHandle() { |
| - return reinterpret_cast<void*>(window_); |
| + return reinterpret_cast<void*>(glx_window_); |
| } |
| std::string NativeViewGLSurfaceGLX::GetExtensions() { |
| @@ -512,10 +521,10 @@ void* NativeViewGLSurfaceGLX::GetConfig() { |
| XWindowAttributes attributes; |
| if (!XGetWindowAttributes( |
| g_display, |
| - reinterpret_cast<GLXDrawable>(GetHandle()), |
| + window_, |
| &attributes)) { |
| LOG(ERROR) << "XGetWindowAttributes failed for window " << |
| - reinterpret_cast<GLXDrawable>(GetHandle()) << "."; |
| + window_ << "."; |
| return NULL; |
| } |
| @@ -559,7 +568,7 @@ void* NativeViewGLSurfaceGLX::GetConfig() { |
| bool NativeViewGLSurfaceGLX::PostSubBuffer( |
| int x, int y, int width, int height) { |
| DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); |
| - glXCopySubBufferMESA(g_display, window_, x, y, width, height); |
| + glXCopySubBufferMESA(g_display, glx_window_, x, y, width, height); |
| return true; |
| } |