| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/numerics/safe_math.h" | 6 #include "base/numerics/safe_math.h" |
| 7 #include "third_party/mesa/src/include/GL/osmesa.h" | 7 #include "third_party/mesa/src/include/GL/osmesa.h" |
| 8 #include "ui/gl/gl_bindings.h" | 8 #include "ui/gl/gl_bindings.h" |
| 9 #include "ui/gl/gl_context.h" | 9 #include "ui/gl/gl_context.h" |
| 10 #include "ui/gl/gl_surface_osmesa.h" | 10 #include "ui/gl/gl_surface_osmesa.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 size_ = new_size; | 78 size_ = new_size; |
| 79 | 79 |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool GLSurfaceOSMesa::IsOffscreen() { | 83 bool GLSurfaceOSMesa::IsOffscreen() { |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 gfx::SwapResult GLSurfaceOSMesa::SwapBuffers() { | 87 bool GLSurfaceOSMesa::SwapBuffers() { |
| 88 NOTREACHED() << "Should not call SwapBuffers on an GLSurfaceOSMesa."; | 88 NOTREACHED() << "Should not call SwapBuffers on an GLSurfaceOSMesa."; |
| 89 return gfx::SwapResult::SWAP_FAILED; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 gfx::Size GLSurfaceOSMesa::GetSize() { | 92 gfx::Size GLSurfaceOSMesa::GetSize() { |
| 93 return size_; | 93 return size_; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void* GLSurfaceOSMesa::GetHandle() { | 96 void* GLSurfaceOSMesa::GetHandle() { |
| 97 return buffer_.get(); | 97 return buffer_.get(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 unsigned GLSurfaceOSMesa::GetFormat() { | 100 unsigned GLSurfaceOSMesa::GetFormat() { |
| 101 return format_; | 101 return format_; |
| 102 } | 102 } |
| 103 | 103 |
| 104 GLSurfaceOSMesa::~GLSurfaceOSMesa() { | 104 GLSurfaceOSMesa::~GLSurfaceOSMesa() { |
| 105 Destroy(); | 105 Destroy(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool GLSurfaceOSMesaHeadless::IsOffscreen() { return false; } | 108 bool GLSurfaceOSMesaHeadless::IsOffscreen() { return false; } |
| 109 | 109 |
| 110 gfx::SwapResult GLSurfaceOSMesaHeadless::SwapBuffers() { | 110 bool GLSurfaceOSMesaHeadless::SwapBuffers() { return true; } |
| 111 return gfx::SwapResult::SWAP_ACK; | |
| 112 } | |
| 113 | 111 |
| 114 GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless() | 112 GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless() |
| 115 : GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, gfx::Size(1, 1)) { | 113 : GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, gfx::Size(1, 1)) { |
| 116 } | 114 } |
| 117 | 115 |
| 118 GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); } | 116 GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); } |
| 119 | 117 |
| 120 } // namespace gfx | 118 } // namespace gfx |
| OLD | NEW |