| 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> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 10 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
| 11 #include "ui/gl/gl_gl_api_implementation.h" | 12 #include "ui/gl/gl_gl_api_implementation.h" |
| 12 #include "ui/gl/gl_wgl_api_implementation.h" | 13 #include "ui/gl/gl_wgl_api_implementation.h" |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = { | 18 const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = { |
| 18 sizeof(kPixelFormatDescriptor), // Size of structure. | 19 sizeof(kPixelFormatDescriptor), // Size of structure. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void* GLSurfaceWGL::GetDisplay() { | 157 void* GLSurfaceWGL::GetDisplay() { |
| 157 return GetDisplayDC(); | 158 return GetDisplayDC(); |
| 158 } | 159 } |
| 159 | 160 |
| 160 bool GLSurfaceWGL::InitializeOneOff() { | 161 bool GLSurfaceWGL::InitializeOneOff() { |
| 161 static bool initialized = false; | 162 static bool initialized = false; |
| 162 if (initialized) | 163 if (initialized) |
| 163 return true; | 164 return true; |
| 164 | 165 |
| 165 DCHECK(g_display == NULL); | 166 DCHECK(g_display == NULL); |
| 166 scoped_ptr<DisplayWGL> wgl_display(new DisplayWGL); | 167 std::unique_ptr<DisplayWGL> wgl_display(new DisplayWGL); |
| 167 if (!wgl_display->Init()) | 168 if (!wgl_display->Init()) |
| 168 return false; | 169 return false; |
| 169 | 170 |
| 170 g_display = wgl_display.release(); | 171 g_display = wgl_display.release(); |
| 171 initialized = true; | 172 initialized = true; |
| 172 return true; | 173 return true; |
| 173 } | 174 } |
| 174 | 175 |
| 175 void GLSurfaceWGL::InitializeOneOffForTesting() { | 176 void GLSurfaceWGL::InitializeOneOffForTesting() { |
| 176 if (g_display == NULL) { | 177 if (g_display == NULL) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 360 |
| 360 gfx::Size PbufferGLSurfaceWGL::GetSize() { | 361 gfx::Size PbufferGLSurfaceWGL::GetSize() { |
| 361 return size_; | 362 return size_; |
| 362 } | 363 } |
| 363 | 364 |
| 364 void* PbufferGLSurfaceWGL::GetHandle() { | 365 void* PbufferGLSurfaceWGL::GetHandle() { |
| 365 return device_context_; | 366 return device_context_; |
| 366 } | 367 } |
| 367 | 368 |
| 368 } // namespace gfx | 369 } // namespace gfx |
| OLD | NEW |