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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 278 } |
279 | 279 |
280 void* NativeViewGLSurfaceWGL::GetHandle() { | 280 void* NativeViewGLSurfaceWGL::GetHandle() { |
281 return device_context_; | 281 return device_context_; |
282 } | 282 } |
283 | 283 |
284 PbufferGLSurfaceWGL::PbufferGLSurfaceWGL(const gfx::Size& size) | 284 PbufferGLSurfaceWGL::PbufferGLSurfaceWGL(const gfx::Size& size) |
285 : size_(size), | 285 : size_(size), |
286 device_context_(NULL), | 286 device_context_(NULL), |
287 pbuffer_(NULL) { | 287 pbuffer_(NULL) { |
| 288 // Some implementations of Pbuffer do not support having a 0 size. For such |
| 289 // cases use a (1, 1) surface. |
| 290 if (size_.GetArea() == 0) |
| 291 size_.SetSize(1, 1); |
288 } | 292 } |
289 | 293 |
290 PbufferGLSurfaceWGL::~PbufferGLSurfaceWGL() { | 294 PbufferGLSurfaceWGL::~PbufferGLSurfaceWGL() { |
291 Destroy(); | 295 Destroy(); |
292 } | 296 } |
293 | 297 |
294 bool PbufferGLSurfaceWGL::Initialize() { | 298 bool PbufferGLSurfaceWGL::Initialize() { |
295 DCHECK(!device_context_); | 299 DCHECK(!device_context_); |
296 | 300 |
297 if (!gfx::g_driver_wgl.fn.wglCreatePbufferARBFn) { | 301 if (!gfx::g_driver_wgl.fn.wglCreatePbufferARBFn) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 349 |
346 gfx::Size PbufferGLSurfaceWGL::GetSize() { | 350 gfx::Size PbufferGLSurfaceWGL::GetSize() { |
347 return size_; | 351 return size_; |
348 } | 352 } |
349 | 353 |
350 void* PbufferGLSurfaceWGL::GetHandle() { | 354 void* PbufferGLSurfaceWGL::GetHandle() { |
351 return device_context_; | 355 return device_context_; |
352 } | 356 } |
353 | 357 |
354 } // namespace gfx | 358 } // namespace gfx |
OLD | NEW |