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 #if defined(OS_WIN) |
| 251 HWND hwnd = static_cast<HWND>(window_); |
| 252 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
| 253 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
| 254 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); |
| 255 #endif |
| 256 } |
| 257 |
249 gfx::Size NativeViewEGLContext::GetSize() { | 258 gfx::Size NativeViewEGLContext::GetSize() { |
250 #if defined(OS_WIN) | 259 #if defined(OS_WIN) |
251 RECT rect; | 260 RECT rect; |
252 if (!GetClientRect(static_cast<HWND>(window_), &rect)) { | 261 if (!GetClientRect(static_cast<HWND>(window_), &rect)) { |
253 DCHECK(false) << "GetClientRect failed."; | 262 DCHECK(false) << "GetClientRect failed."; |
254 return gfx::Size(); | 263 return gfx::Size(); |
255 } | 264 } |
256 | 265 |
257 return gfx::Size(rect.right - rect.left, rect.bottom - rect.top); | 266 return gfx::Size(rect.right - rect.left, rect.bottom - rect.top); |
258 #else | 267 #else |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 void SecondaryEGLContext::SetSwapInterval(int interval) { | 416 void SecondaryEGLContext::SetSwapInterval(int interval) { |
408 DCHECK(IsCurrent()); | 417 DCHECK(IsCurrent()); |
409 NOTREACHED() << "Attempt to call SetSwapInterval on a SecondaryEGLContext."; | 418 NOTREACHED() << "Attempt to call SetSwapInterval on a SecondaryEGLContext."; |
410 } | 419 } |
411 | 420 |
412 EGLSurface SecondaryEGLContext::GetSurface() { | 421 EGLSurface SecondaryEGLContext::GetSurface() { |
413 return surface_; | 422 return surface_; |
414 } | 423 } |
415 | 424 |
416 } // namespace gfx | 425 } // namespace gfx |
OLD | NEW |