| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <EGL/egl.h> | 5 #include <EGL/egl.h> |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #if defined(OS_LINUX) | 8 #if defined(OS_LINUX) |
| 9 #include "app/x11_util.h" | 9 #include "app/x11_util.h" |
| 10 #define EGL_HAS_PBUFFERS 1 | 10 #define EGL_HAS_PBUFFERS 1 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 bool NativeViewEGLContext::SwapBuffers() { | 239 bool NativeViewEGLContext::SwapBuffers() { |
| 240 if (!eglSwapBuffers(g_display, surface_)) { | 240 if (!eglSwapBuffers(g_display, surface_)) { |
| 241 VLOG(1) << "eglSwapBuffers failed with error " | 241 VLOG(1) << "eglSwapBuffers failed with error " |
| 242 << GetLastEGLErrorString(); | 242 << GetLastEGLErrorString(); |
| 243 return false; | 243 return false; |
| 244 } | 244 } |
| 245 | 245 |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 void NativeViewEGLContext::SetSize(gfx::Size size) { |
| 250 HWND hwnd = static_cast<HWND>(window_); |
| 251 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
| 252 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
| 253 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); |
| 254 } |
| 255 |
| 249 gfx::Size NativeViewEGLContext::GetSize() { | 256 gfx::Size NativeViewEGLContext::GetSize() { |
| 250 #if defined(OS_WIN) | 257 #if defined(OS_WIN) |
| 251 RECT rect; | 258 RECT rect; |
| 252 if (!GetClientRect(static_cast<HWND>(window_), &rect)) { | 259 if (!GetClientRect(static_cast<HWND>(window_), &rect)) { |
| 253 DCHECK(false) << "GetClientRect failed."; | 260 DCHECK(false) << "GetClientRect failed."; |
| 254 return gfx::Size(); | 261 return gfx::Size(); |
| 255 } | 262 } |
| 256 | 263 |
| 257 return gfx::Size(rect.right - rect.left, rect.bottom - rect.top); | 264 return gfx::Size(rect.right - rect.left, rect.bottom - rect.top); |
| 258 #else | 265 #else |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 void SecondaryEGLContext::SetSwapInterval(int interval) { | 414 void SecondaryEGLContext::SetSwapInterval(int interval) { |
| 408 DCHECK(IsCurrent()); | 415 DCHECK(IsCurrent()); |
| 409 NOTREACHED() << "Attempt to call SetSwapInterval on a SecondaryEGLContext."; | 416 NOTREACHED() << "Attempt to call SetSwapInterval on a SecondaryEGLContext."; |
| 410 } | 417 } |
| 411 | 418 |
| 412 EGLSurface SecondaryEGLContext::GetSurface() { | 419 EGLSurface SecondaryEGLContext::GetSurface() { |
| 413 return surface_; | 420 return surface_; |
| 414 } | 421 } |
| 415 | 422 |
| 416 } // namespace gfx | 423 } // namespace gfx |
| OLD | NEW |