| 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_wgl.h" | 5 #include "ui/gl/gl_surface_wgl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
| 10 #include "ui/gl/gl_gl_api_implementation.h" |
| 11 #include "ui/gl/gl_wgl_api_implementation.h" |
| 10 | 12 |
| 11 namespace gfx { | 13 namespace gfx { |
| 12 | 14 |
| 13 namespace { | 15 namespace { |
| 14 const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = { | 16 const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = { |
| 15 sizeof(kPixelFormatDescriptor), // Size of structure. | 17 sizeof(kPixelFormatDescriptor), // Size of structure. |
| 16 1, // Default version. | 18 1, // Default version. |
| 17 PFD_DRAW_TO_WINDOW | // Window drawing support. | 19 PFD_DRAW_TO_WINDOW | // Window drawing support. |
| 18 PFD_SUPPORT_OPENGL | // OpenGL support. | 20 PFD_SUPPORT_OPENGL | // OpenGL support. |
| 19 PFD_DOUBLEBUFFER, // Double buffering support (not stereo). | 21 PFD_DOUBLEBUFFER, // Double buffering support (not stereo). |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 pbuffer_(NULL) { | 301 pbuffer_(NULL) { |
| 300 } | 302 } |
| 301 | 303 |
| 302 PbufferGLSurfaceWGL::~PbufferGLSurfaceWGL() { | 304 PbufferGLSurfaceWGL::~PbufferGLSurfaceWGL() { |
| 303 Destroy(); | 305 Destroy(); |
| 304 } | 306 } |
| 305 | 307 |
| 306 bool PbufferGLSurfaceWGL::Initialize() { | 308 bool PbufferGLSurfaceWGL::Initialize() { |
| 307 DCHECK(!device_context_); | 309 DCHECK(!device_context_); |
| 308 | 310 |
| 309 if (!wglCreatePbufferARB) { | 311 if (!gfx::g_driver_wgl.fn.wglCreatePbufferARBFn) { |
| 310 LOG(ERROR) << "wglCreatePbufferARB not available."; | 312 LOG(ERROR) << "wglCreatePbufferARB not available."; |
| 311 Destroy(); | 313 Destroy(); |
| 312 return false; | 314 return false; |
| 313 } | 315 } |
| 314 | 316 |
| 315 const int kNoAttributes[] = { 0 }; | 317 const int kNoAttributes[] = { 0 }; |
| 316 pbuffer_ = wglCreatePbufferARB(g_display->device_context(), | 318 pbuffer_ = wglCreatePbufferARB(g_display->device_context(), |
| 317 g_display->pixel_format(), | 319 g_display->pixel_format(), |
| 318 size_.width(), size_.height(), | 320 size_.width(), size_.height(), |
| 319 kNoAttributes); | 321 kNoAttributes); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 359 |
| 358 gfx::Size PbufferGLSurfaceWGL::GetSize() { | 360 gfx::Size PbufferGLSurfaceWGL::GetSize() { |
| 359 return size_; | 361 return size_; |
| 360 } | 362 } |
| 361 | 363 |
| 362 void* PbufferGLSurfaceWGL::GetHandle() { | 364 void* PbufferGLSurfaceWGL::GetHandle() { |
| 363 return device_context_; | 365 return device_context_; |
| 364 } | 366 } |
| 365 | 367 |
| 366 } // namespace gfx | 368 } // namespace gfx |
| OLD | NEW |