| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 glXWaitGL(); | 533 glXWaitGL(); |
| 534 XResizeWindow(g_display, window_, size.width(), size.height()); | 534 XResizeWindow(g_display, window_, size.width(), size.height()); |
| 535 glXWaitX(); | 535 glXWaitX(); |
| 536 return true; | 536 return true; |
| 537 } | 537 } |
| 538 | 538 |
| 539 bool NativeViewGLSurfaceGLX::IsOffscreen() { | 539 bool NativeViewGLSurfaceGLX::IsOffscreen() { |
| 540 return false; | 540 return false; |
| 541 } | 541 } |
| 542 | 542 |
| 543 bool NativeViewGLSurfaceGLX::SwapBuffers() { | 543 gfx::SwapResult NativeViewGLSurfaceGLX::SwapBuffers() { |
| 544 TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", | 544 TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", |
| 545 "width", GetSize().width(), | 545 "width", GetSize().width(), |
| 546 "height", GetSize().height()); | 546 "height", GetSize().height()); |
| 547 | 547 |
| 548 glXSwapBuffers(g_display, GetDrawableHandle()); | 548 glXSwapBuffers(g_display, GetDrawableHandle()); |
| 549 return true; | 549 return gfx::SwapResult::SWAP_ACK; |
| 550 } | 550 } |
| 551 | 551 |
| 552 gfx::Size NativeViewGLSurfaceGLX::GetSize() { | 552 gfx::Size NativeViewGLSurfaceGLX::GetSize() { |
| 553 return size_; | 553 return size_; |
| 554 } | 554 } |
| 555 | 555 |
| 556 void* NativeViewGLSurfaceGLX::GetHandle() { | 556 void* NativeViewGLSurfaceGLX::GetHandle() { |
| 557 return reinterpret_cast<void*>(GetDrawableHandle()); | 557 return reinterpret_cast<void*>(GetDrawableHandle()); |
| 558 } | 558 } |
| 559 | 559 |
| 560 bool NativeViewGLSurfaceGLX::SupportsPostSubBuffer() { | 560 bool NativeViewGLSurfaceGLX::SupportsPostSubBuffer() { |
| 561 return gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer; | 561 return gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer; |
| 562 } | 562 } |
| 563 | 563 |
| 564 void* NativeViewGLSurfaceGLX::GetConfig() { | 564 void* NativeViewGLSurfaceGLX::GetConfig() { |
| 565 if (!config_) | 565 if (!config_) |
| 566 config_ = GLSurfaceGLX::GetConfig(window_); | 566 config_ = GLSurfaceGLX::GetConfig(window_); |
| 567 return config_; | 567 return config_; |
| 568 } | 568 } |
| 569 | 569 |
| 570 bool NativeViewGLSurfaceGLX::PostSubBuffer( | 570 gfx::SwapResult NativeViewGLSurfaceGLX::PostSubBuffer(int x, |
| 571 int x, int y, int width, int height) { | 571 int y, |
| 572 int width, |
| 573 int height) { |
| 572 DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); | 574 DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); |
| 573 glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); | 575 glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); |
| 574 return true; | 576 return gfx::SwapResult::SWAP_ACK; |
| 575 } | 577 } |
| 576 | 578 |
| 577 VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { | 579 VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { |
| 578 return vsync_provider_.get(); | 580 return vsync_provider_.get(); |
| 579 } | 581 } |
| 580 | 582 |
| 581 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { | 583 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { |
| 582 Destroy(); | 584 Destroy(); |
| 583 } | 585 } |
| 584 | 586 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 610 if (window_) { | 612 if (window_) { |
| 611 XDestroyWindow(g_display, window_); | 613 XDestroyWindow(g_display, window_); |
| 612 window_ = 0; | 614 window_ = 0; |
| 613 } | 615 } |
| 614 } | 616 } |
| 615 | 617 |
| 616 bool UnmappedNativeViewGLSurfaceGLX::IsOffscreen() { | 618 bool UnmappedNativeViewGLSurfaceGLX::IsOffscreen() { |
| 617 return true; | 619 return true; |
| 618 } | 620 } |
| 619 | 621 |
| 620 bool UnmappedNativeViewGLSurfaceGLX::SwapBuffers() { | 622 gfx::SwapResult UnmappedNativeViewGLSurfaceGLX::SwapBuffers() { |
| 621 NOTREACHED() << "Attempted to call SwapBuffers on an unmapped window."; | 623 NOTREACHED() << "Attempted to call SwapBuffers on an unmapped window."; |
| 622 return false; | 624 return gfx::SwapResult::SWAP_FAILED; |
| 623 } | 625 } |
| 624 | 626 |
| 625 gfx::Size UnmappedNativeViewGLSurfaceGLX::GetSize() { | 627 gfx::Size UnmappedNativeViewGLSurfaceGLX::GetSize() { |
| 626 return size_; | 628 return size_; |
| 627 } | 629 } |
| 628 | 630 |
| 629 void* UnmappedNativeViewGLSurfaceGLX::GetHandle() { | 631 void* UnmappedNativeViewGLSurfaceGLX::GetHandle() { |
| 630 return reinterpret_cast<void*>(window_); | 632 return reinterpret_cast<void*>(window_); |
| 631 } | 633 } |
| 632 | 634 |
| 633 void* UnmappedNativeViewGLSurfaceGLX::GetConfig() { | 635 void* UnmappedNativeViewGLSurfaceGLX::GetConfig() { |
| 634 if (!config_) | 636 if (!config_) |
| 635 config_ = GLSurfaceGLX::GetConfig(window_); | 637 config_ = GLSurfaceGLX::GetConfig(window_); |
| 636 return config_; | 638 return config_; |
| 637 } | 639 } |
| 638 | 640 |
| 639 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { | 641 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { |
| 640 Destroy(); | 642 Destroy(); |
| 641 } | 643 } |
| 642 | 644 |
| 643 } // namespace gfx | 645 } // namespace gfx |
| OLD | NEW |