| 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_osmesa.h" | 5 #include "ui/gl/gl_surface_osmesa.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
| 11 #include "third_party/mesa/src/include/GL/osmesa.h" | 11 #include "third_party/mesa/src/include/GL/osmesa.h" |
| 12 #include "ui/gl/gl_bindings.h" | 12 #include "ui/gl/gl_bindings.h" |
| 13 #include "ui/gl/gl_context.h" | 13 #include "ui/gl/gl_context.h" |
| 14 #include "ui/gl/scoped_make_current.h" | 14 #include "ui/gl/scoped_make_current.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gl { |
| 17 | 17 |
| 18 GLSurfaceOSMesa::GLSurfaceOSMesa(GLSurface::Format format, | 18 GLSurfaceOSMesa::GLSurfaceOSMesa(GLSurface::Format format, |
| 19 const gfx::Size& size) | 19 const gfx::Size& size) |
| 20 : size_(size), | 20 : size_(size), |
| 21 format_(format) { | 21 format_(format) { |
| 22 // Implementations of OSMesa surface do not support having a 0 size. In such | 22 // Implementations of OSMesa surface do not support having a 0 size. In such |
| 23 // cases use a (1, 1) surface. | 23 // cases use a (1, 1) surface. |
| 24 if (size_.GetArea() == 0) | 24 if (size_.GetArea() == 0) |
| 25 size_.SetSize(1, 1); | 25 size_.SetSize(1, 1); |
| 26 } | 26 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 gfx::SwapResult GLSurfaceOSMesaHeadless::SwapBuffers() { | 108 gfx::SwapResult GLSurfaceOSMesaHeadless::SwapBuffers() { |
| 109 return gfx::SwapResult::SWAP_ACK; | 109 return gfx::SwapResult::SWAP_ACK; |
| 110 } | 110 } |
| 111 | 111 |
| 112 GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless() | 112 GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless() |
| 113 : GLSurfaceOSMesa(SURFACE_OSMESA_BGRA, gfx::Size(1, 1)) { | 113 : GLSurfaceOSMesa(SURFACE_OSMESA_BGRA, gfx::Size(1, 1)) { |
| 114 } | 114 } |
| 115 | 115 |
| 116 GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); } | 116 GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); } |
| 117 | 117 |
| 118 } // namespace gfx | 118 } // namespace gl |
| OLD | NEW |