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" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 NativeViewGLSurfaceWGL::NativeViewGLSurfaceWGL(gfx::AcceleratedWidget window) | 186 NativeViewGLSurfaceWGL::NativeViewGLSurfaceWGL(gfx::AcceleratedWidget window) |
187 : window_(window), child_window_(NULL), device_context_(NULL) { | 187 : window_(window), child_window_(NULL), device_context_(NULL) { |
188 DCHECK(window); | 188 DCHECK(window); |
189 } | 189 } |
190 | 190 |
191 NativeViewGLSurfaceWGL::~NativeViewGLSurfaceWGL() { | 191 NativeViewGLSurfaceWGL::~NativeViewGLSurfaceWGL() { |
192 Destroy(); | 192 Destroy(); |
193 } | 193 } |
194 | 194 |
195 bool NativeViewGLSurfaceWGL::Initialize(GLSurface::Format format) { | 195 bool NativeViewGLSurfaceWGL::Initialize(GLSurfaceFormat format) { |
196 DCHECK(!device_context_); | 196 DCHECK(!device_context_); |
197 | 197 |
198 RECT rect; | 198 RECT rect; |
199 if (!GetClientRect(window_, &rect)) { | 199 if (!GetClientRect(window_, &rect)) { |
200 LOG(ERROR) << "GetClientRect failed.\n"; | 200 LOG(ERROR) << "GetClientRect failed.\n"; |
201 Destroy(); | 201 Destroy(); |
202 return false; | 202 return false; |
203 } | 203 } |
204 | 204 |
205 // Create a child window. WGL has problems using a window handle owned by | 205 // Create a child window. WGL has problems using a window handle owned by |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // Some implementations of Pbuffer do not support having a 0 size. For such | 327 // Some implementations of Pbuffer do not support having a 0 size. For such |
328 // cases use a (1, 1) surface. | 328 // cases use a (1, 1) surface. |
329 if (size_.GetArea() == 0) | 329 if (size_.GetArea() == 0) |
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(GLSurfaceFormat format) { |
338 DCHECK(!device_context_); | 338 DCHECK(!device_context_); |
339 | 339 |
340 if (!g_driver_wgl.fn.wglCreatePbufferARBFn) { | 340 if (!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(), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 gl | 397 } // namespace gl |
OLD | NEW |