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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 glXWaitGL(); | 489 glXWaitGL(); |
490 XResizeWindow(g_display, window_, size.width(), size.height()); | 490 XResizeWindow(g_display, window_, size.width(), size.height()); |
491 glXWaitX(); | 491 glXWaitX(); |
492 return true; | 492 return true; |
493 } | 493 } |
494 | 494 |
495 bool NativeViewGLSurfaceGLX::IsOffscreen() { | 495 bool NativeViewGLSurfaceGLX::IsOffscreen() { |
496 return false; | 496 return false; |
497 } | 497 } |
498 | 498 |
499 bool NativeViewGLSurfaceGLX::SwapBuffers() { | 499 gfx::SwapResult NativeViewGLSurfaceGLX::SwapBuffers() { |
500 TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", | 500 TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", |
501 "width", GetSize().width(), | 501 "width", GetSize().width(), |
502 "height", GetSize().height()); | 502 "height", GetSize().height()); |
503 | 503 |
504 glXSwapBuffers(g_display, GetDrawableHandle()); | 504 glXSwapBuffers(g_display, GetDrawableHandle()); |
505 return true; | 505 return gfx::SWAP_ACK; |
506 } | 506 } |
507 | 507 |
508 gfx::Size NativeViewGLSurfaceGLX::GetSize() { | 508 gfx::Size NativeViewGLSurfaceGLX::GetSize() { |
509 return size_; | 509 return size_; |
510 } | 510 } |
511 | 511 |
512 void* NativeViewGLSurfaceGLX::GetHandle() { | 512 void* NativeViewGLSurfaceGLX::GetHandle() { |
513 return reinterpret_cast<void*>(GetDrawableHandle()); | 513 return reinterpret_cast<void*>(GetDrawableHandle()); |
514 } | 514 } |
515 | 515 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 } | 569 } |
570 } | 570 } |
571 if (found) { | 571 if (found) { |
572 config_ = configs.get()[i]; | 572 config_ = configs.get()[i]; |
573 } | 573 } |
574 } | 574 } |
575 | 575 |
576 return config_; | 576 return config_; |
577 } | 577 } |
578 | 578 |
579 bool NativeViewGLSurfaceGLX::PostSubBuffer( | 579 gfx::SwapResult NativeViewGLSurfaceGLX::PostSubBuffer(int x, |
580 int x, int y, int width, int height) { | 580 int y, |
| 581 int width, |
| 582 int height) { |
581 DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); | 583 DCHECK(gfx::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); |
582 glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); | 584 glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); |
583 return true; | 585 return gfx::SWAP_ACK; |
584 } | 586 } |
585 | 587 |
586 VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { | 588 VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { |
587 return vsync_provider_.get(); | 589 return vsync_provider_.get(); |
588 } | 590 } |
589 | 591 |
590 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { | 592 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { |
591 Destroy(); | 593 Destroy(); |
592 } | 594 } |
593 | 595 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 | 657 |
656 config_ = NULL; | 658 config_ = NULL; |
657 } | 659 } |
658 | 660 |
659 bool PbufferGLSurfaceGLX::IsOffscreen() { | 661 bool PbufferGLSurfaceGLX::IsOffscreen() { |
660 return true; | 662 return true; |
661 } | 663 } |
662 | 664 |
663 bool PbufferGLSurfaceGLX::SwapBuffers() { | 665 bool PbufferGLSurfaceGLX::SwapBuffers() { |
664 NOTREACHED() << "Attempted to call SwapBuffers on a pbuffer."; | 666 NOTREACHED() << "Attempted to call SwapBuffers on a pbuffer."; |
665 return false; | 667 return gfx::SWAP_FAILED; |
666 } | 668 } |
667 | 669 |
668 gfx::Size PbufferGLSurfaceGLX::GetSize() { | 670 gfx::Size PbufferGLSurfaceGLX::GetSize() { |
669 return size_; | 671 return size_; |
670 } | 672 } |
671 | 673 |
672 void* PbufferGLSurfaceGLX::GetHandle() { | 674 void* PbufferGLSurfaceGLX::GetHandle() { |
673 return reinterpret_cast<void*>(pbuffer_); | 675 return reinterpret_cast<void*>(pbuffer_); |
674 } | 676 } |
675 | 677 |
676 void* PbufferGLSurfaceGLX::GetConfig() { | 678 void* PbufferGLSurfaceGLX::GetConfig() { |
677 return config_; | 679 return config_; |
678 } | 680 } |
679 | 681 |
680 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { | 682 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { |
681 Destroy(); | 683 Destroy(); |
682 } | 684 } |
683 | 685 |
684 } // namespace gfx | 686 } // namespace gfx |
OLD | NEW |