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 gfx::SwapResult NativeViewGLSurfaceGLX::SwapBuffers() { | 543 bool 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 gfx::SwapResult::SWAP_ACK; | 549 return true; |
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 gfx::SwapResult NativeViewGLSurfaceGLX::PostSubBuffer(int x, | 570 bool NativeViewGLSurfaceGLX::PostSubBuffer( |
571 int y, | 571 int x, int y, int width, int height) { |
572 int width, | |
573 int height) { | |
574 DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); | 572 DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); |
575 glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); | 573 glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); |
576 return gfx::SwapResult::SWAP_ACK; | 574 return true; |
577 } | 575 } |
578 | 576 |
579 VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { | 577 VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { |
580 return vsync_provider_.get(); | 578 return vsync_provider_.get(); |
581 } | 579 } |
582 | 580 |
583 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { | 581 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { |
584 Destroy(); | 582 Destroy(); |
585 } | 583 } |
586 | 584 |
(...skipping 25 matching lines...) Expand all Loading... |
612 if (window_) { | 610 if (window_) { |
613 XDestroyWindow(g_display, window_); | 611 XDestroyWindow(g_display, window_); |
614 window_ = 0; | 612 window_ = 0; |
615 } | 613 } |
616 } | 614 } |
617 | 615 |
618 bool UnmappedNativeViewGLSurfaceGLX::IsOffscreen() { | 616 bool UnmappedNativeViewGLSurfaceGLX::IsOffscreen() { |
619 return true; | 617 return true; |
620 } | 618 } |
621 | 619 |
622 gfx::SwapResult UnmappedNativeViewGLSurfaceGLX::SwapBuffers() { | 620 bool UnmappedNativeViewGLSurfaceGLX::SwapBuffers() { |
623 NOTREACHED() << "Attempted to call SwapBuffers on an unmapped window."; | 621 NOTREACHED() << "Attempted to call SwapBuffers on an unmapped window."; |
624 return gfx::SwapResult::SWAP_FAILED; | 622 return false; |
625 } | 623 } |
626 | 624 |
627 gfx::Size UnmappedNativeViewGLSurfaceGLX::GetSize() { | 625 gfx::Size UnmappedNativeViewGLSurfaceGLX::GetSize() { |
628 return size_; | 626 return size_; |
629 } | 627 } |
630 | 628 |
631 void* UnmappedNativeViewGLSurfaceGLX::GetHandle() { | 629 void* UnmappedNativeViewGLSurfaceGLX::GetHandle() { |
632 return reinterpret_cast<void*>(window_); | 630 return reinterpret_cast<void*>(window_); |
633 } | 631 } |
634 | 632 |
635 void* UnmappedNativeViewGLSurfaceGLX::GetConfig() { | 633 void* UnmappedNativeViewGLSurfaceGLX::GetConfig() { |
636 if (!config_) | 634 if (!config_) |
637 config_ = GLSurfaceGLX::GetConfig(window_); | 635 config_ = GLSurfaceGLX::GetConfig(window_); |
638 return config_; | 636 return config_; |
639 } | 637 } |
640 | 638 |
641 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { | 639 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { |
642 Destroy(); | 640 Destroy(); |
643 } | 641 } |
644 | 642 |
645 } // namespace gfx | 643 } // namespace gfx |
OLD | NEW |