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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
11 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
12 #include "ui/gl/gl_gl_api_implementation.h" | 12 #include "ui/gl/gl_gl_api_implementation.h" |
13 #include "ui/gl/gl_wgl_api_implementation.h" | 13 #include "ui/gl/gl_wgl_api_implementation.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gl { |
16 | 16 |
17 namespace { | 17 namespace { |
18 const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = { | 18 const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = { |
19 sizeof(kPixelFormatDescriptor), // Size of structure. | 19 sizeof(kPixelFormatDescriptor), // Size of structure. |
20 1, // Default version. | 20 1, // Default version. |
21 PFD_DRAW_TO_WINDOW | // Window drawing support. | 21 PFD_DRAW_TO_WINDOW | // Window drawing support. |
22 PFD_SUPPORT_OPENGL | // OpenGL support. | 22 PFD_SUPPORT_OPENGL | // OpenGL support. |
23 PFD_DOUBLEBUFFER, // Double buffering support (not stereo). | 23 PFD_DOUBLEBUFFER, // Double buffering support (not stereo). |
24 PFD_TYPE_RGBA, // RGBA color mode (not indexed). | 24 PFD_TYPE_RGBA, // RGBA color mode (not indexed). |
25 24, // 24 bit color mode. | 25 24, // 24 bit color mode. |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 size_.SetSize(1, 1); | 330 size_.SetSize(1, 1); |
331 } | 331 } |
332 | 332 |
333 PbufferGLSurfaceWGL::~PbufferGLSurfaceWGL() { | 333 PbufferGLSurfaceWGL::~PbufferGLSurfaceWGL() { |
334 Destroy(); | 334 Destroy(); |
335 } | 335 } |
336 | 336 |
337 bool PbufferGLSurfaceWGL::Initialize(GLSurface::Format format) { | 337 bool PbufferGLSurfaceWGL::Initialize(GLSurface::Format format) { |
338 DCHECK(!device_context_); | 338 DCHECK(!device_context_); |
339 | 339 |
340 if (!gfx::g_driver_wgl.fn.wglCreatePbufferARBFn) { | 340 if (!gl::g_driver_wgl.fn.wglCreatePbufferARBFn) { |
341 LOG(ERROR) << "wglCreatePbufferARB not available."; | 341 LOG(ERROR) << "wglCreatePbufferARB not available."; |
342 Destroy(); | 342 Destroy(); |
343 return false; | 343 return false; |
344 } | 344 } |
345 | 345 |
346 const int kNoAttributes[] = { 0 }; | 346 const int kNoAttributes[] = { 0 }; |
347 pbuffer_ = wglCreatePbufferARB(g_display->device_context(), | 347 pbuffer_ = wglCreatePbufferARB(g_display->device_context(), |
348 g_display->pixel_format(), | 348 g_display->pixel_format(), |
349 size_.width(), size_.height(), | 349 size_.width(), size_.height(), |
350 kNoAttributes); | 350 kNoAttributes); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } | 387 } |
388 | 388 |
389 gfx::Size PbufferGLSurfaceWGL::GetSize() { | 389 gfx::Size PbufferGLSurfaceWGL::GetSize() { |
390 return size_; | 390 return size_; |
391 } | 391 } |
392 | 392 |
393 void* PbufferGLSurfaceWGL::GetHandle() { | 393 void* PbufferGLSurfaceWGL::GetHandle() { |
394 return device_context_; | 394 return device_context_; |
395 } | 395 } |
396 | 396 |
397 } // namespace gfx | 397 } // namespace gl |
OLD | NEW |