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 #include "ui/gl/gl_surface_glx.h" | 5 #include "ui/gl/gl_surface_glx.h" |
6 | 6 |
7 extern "C" { | 7 extern "C" { |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 } | 9 } |
10 #include <memory> | 10 #include <memory> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 found = true; | 108 found = true; |
109 break; | 109 break; |
110 } | 110 } |
111 } | 111 } |
112 if (found) { | 112 if (found) { |
113 return configs.get()[i]; | 113 return configs.get()[i]; |
114 } | 114 } |
115 return nullptr; | 115 return nullptr; |
116 } | 116 } |
117 | 117 |
118 class OMLSyncControlVSyncProvider : public gl::SyncControlVSyncProvider { | 118 class OMLSyncControlVSyncProvider : public SyncControlVSyncProvider { |
119 public: | 119 public: |
120 explicit OMLSyncControlVSyncProvider(GLXWindow glx_window) | 120 explicit OMLSyncControlVSyncProvider(GLXWindow glx_window) |
121 : SyncControlVSyncProvider(), | 121 : SyncControlVSyncProvider(), |
122 glx_window_(glx_window) { | 122 glx_window_(glx_window) { |
123 } | 123 } |
124 | 124 |
125 ~OMLSyncControlVSyncProvider() override {} | 125 ~OMLSyncControlVSyncProvider() override {} |
126 | 126 |
127 protected: | 127 protected: |
128 bool GetSyncValues(int64_t* system_time, | 128 bool GetSyncValues(int64_t* system_time, |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 547 |
548 gfx::Size NativeViewGLSurfaceGLX::GetSize() { | 548 gfx::Size NativeViewGLSurfaceGLX::GetSize() { |
549 return size_; | 549 return size_; |
550 } | 550 } |
551 | 551 |
552 void* NativeViewGLSurfaceGLX::GetHandle() { | 552 void* NativeViewGLSurfaceGLX::GetHandle() { |
553 return reinterpret_cast<void*>(GetDrawableHandle()); | 553 return reinterpret_cast<void*>(GetDrawableHandle()); |
554 } | 554 } |
555 | 555 |
556 bool NativeViewGLSurfaceGLX::SupportsPostSubBuffer() { | 556 bool NativeViewGLSurfaceGLX::SupportsPostSubBuffer() { |
557 return gl::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer; | 557 return g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer; |
558 } | 558 } |
559 | 559 |
560 void* NativeViewGLSurfaceGLX::GetConfig() { | 560 void* NativeViewGLSurfaceGLX::GetConfig() { |
561 if (!config_) | 561 if (!config_) |
562 config_ = GetConfigForWindow(g_display, window_); | 562 config_ = GetConfigForWindow(g_display, window_); |
563 return config_; | 563 return config_; |
564 } | 564 } |
565 | 565 |
566 gfx::SwapResult NativeViewGLSurfaceGLX::PostSubBuffer(int x, | 566 gfx::SwapResult NativeViewGLSurfaceGLX::PostSubBuffer(int x, |
567 int y, | 567 int y, |
568 int width, | 568 int width, |
569 int height) { | 569 int height) { |
570 DCHECK(gl::g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); | 570 DCHECK(g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); |
571 glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); | 571 glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); |
572 return gfx::SwapResult::SWAP_ACK; | 572 return gfx::SwapResult::SWAP_ACK; |
573 } | 573 } |
574 | 574 |
575 gfx::VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { | 575 gfx::VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() { |
576 return vsync_provider_.get(); | 576 return vsync_provider_.get(); |
577 } | 577 } |
578 | 578 |
579 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { | 579 NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() { |
580 Destroy(); | 580 Destroy(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 if (!config_) | 639 if (!config_) |
640 config_ = GetConfigForWindow(g_display, window_); | 640 config_ = GetConfigForWindow(g_display, window_); |
641 return config_; | 641 return config_; |
642 } | 642 } |
643 | 643 |
644 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { | 644 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { |
645 Destroy(); | 645 Destroy(); |
646 } | 646 } |
647 | 647 |
648 } // namespace gl | 648 } // namespace gl |
OLD | NEW |