| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 extern "C" { | 5 extern "C" { | 
| 6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> | 
| 7 } | 7 } | 
| 8 | 8 | 
| 9 #include "ui/gl/gl_surface_glx.h" | 9 #include "ui/gl/gl_surface_glx.h" | 
| 10 | 10 | 
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 494   glXWaitGL(); | 494   glXWaitGL(); | 
| 495   XResizeWindow(g_display, window_, size.width(), size.height()); | 495   XResizeWindow(g_display, window_, size.width(), size.height()); | 
| 496   glXWaitX(); | 496   glXWaitX(); | 
| 497   return true; | 497   return true; | 
| 498 } | 498 } | 
| 499 | 499 | 
| 500 bool NativeViewGLSurfaceGLX::IsOffscreen() { | 500 bool NativeViewGLSurfaceGLX::IsOffscreen() { | 
| 501   return false; | 501   return false; | 
| 502 } | 502 } | 
| 503 | 503 | 
| 504 bool NativeViewGLSurfaceGLX::SwapBuffers() { | 504 gfx::SwapResult NativeViewGLSurfaceGLX::SwapBuffers() { | 
| 505   TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", | 505   TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", | 
| 506       "width", GetSize().width(), | 506       "width", GetSize().width(), | 
| 507       "height", GetSize().height()); | 507       "height", GetSize().height()); | 
| 508 | 508 | 
| 509   glXSwapBuffers(g_display, GetDrawableHandle()); | 509   glXSwapBuffers(g_display, GetDrawableHandle()); | 
| 510   return true; | 510   return gfx::SwapResult::SWAP_ACK; | 
| 511 } | 511 } | 
| 512 | 512 | 
| 513 gfx::Size NativeViewGLSurfaceGLX::GetSize() { | 513 gfx::Size NativeViewGLSurfaceGLX::GetSize() { | 
| 514   return size_; | 514   return size_; | 
| 515 } | 515 } | 
| 516 | 516 | 
| 517 void* NativeViewGLSurfaceGLX::GetHandle() { | 517 void* NativeViewGLSurfaceGLX::GetHandle() { | 
| 518   return reinterpret_cast<void*>(GetDrawableHandle()); | 518   return reinterpret_cast<void*>(GetDrawableHandle()); | 
| 519 } | 519 } | 
| 520 | 520 | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 579       } | 579       } | 
| 580     } | 580     } | 
| 581     if (found) { | 581     if (found) { | 
| 582       config_ = configs.get()[i]; | 582       config_ = configs.get()[i]; | 
| 583     } | 583     } | 
| 584   } | 584   } | 
| 585 | 585 | 
| 586   return config_; | 586   return config_; | 
| 587 } | 587 } | 
| 588 | 588 | 
| 589 bool NativeViewGLSurfaceGLX::PostSubBuffer( | 589 gfx::SwapResult NativeViewGLSurfaceGLX::PostSubBuffer( | 
| 590     int x, int y, int width, int height) { | 590     int x, int y, int width, int height) { | 
| 591   DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); | 591   DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); | 
| 592   glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); | 592   glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); | 
| 593   return true; | 593   return gfx::SwapResult::SWAP_ACK; | 
| 594 } | 594 } | 
| 595 | 595 | 
| 596 VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { | 596 VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { | 
| 597   return vsync_provider_.get(); | 597   return vsync_provider_.get(); | 
| 598 } | 598 } | 
| 599 | 599 | 
| 600 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { | 600 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { | 
| 601   Destroy(); | 601   Destroy(); | 
| 602 } | 602 } | 
| 603 | 603 | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 666     pbuffer_ = 0; | 666     pbuffer_ = 0; | 
| 667   } | 667   } | 
| 668 | 668 | 
| 669   config_ = NULL; | 669   config_ = NULL; | 
| 670 } | 670 } | 
| 671 | 671 | 
| 672 bool PbufferGLSurfaceGLX::IsOffscreen() { | 672 bool PbufferGLSurfaceGLX::IsOffscreen() { | 
| 673   return true; | 673   return true; | 
| 674 } | 674 } | 
| 675 | 675 | 
| 676 bool PbufferGLSurfaceGLX::SwapBuffers() { | 676 gfx::SwapResult PbufferGLSurfaceGLX::SwapBuffers() { | 
| 677   NOTREACHED() << "Attempted to call SwapBuffers on a pbuffer."; | 677   NOTREACHED() << "Attempted to call SwapBuffers on a pbuffer."; | 
| 678   return false; | 678   return gfx::SwapResult::SWAP_FAILED; | 
| 679 } | 679 } | 
| 680 | 680 | 
| 681 gfx::Size PbufferGLSurfaceGLX::GetSize() { | 681 gfx::Size PbufferGLSurfaceGLX::GetSize() { | 
| 682   return size_; | 682   return size_; | 
| 683 } | 683 } | 
| 684 | 684 | 
| 685 void* PbufferGLSurfaceGLX::GetHandle() { | 685 void* PbufferGLSurfaceGLX::GetHandle() { | 
| 686   return reinterpret_cast<void*>(pbuffer_); | 686   return reinterpret_cast<void*>(pbuffer_); | 
| 687 } | 687 } | 
| 688 | 688 | 
| 689 void* PbufferGLSurfaceGLX::GetConfig() { | 689 void* PbufferGLSurfaceGLX::GetConfig() { | 
| 690   return config_; | 690   return config_; | 
| 691 } | 691 } | 
| 692 | 692 | 
| 693 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { | 693 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { | 
| 694   Destroy(); | 694   Destroy(); | 
| 695 } | 695 } | 
| 696 | 696 | 
| 697 }  // namespace gfx | 697 }  // namespace gfx | 
| OLD | NEW | 
|---|