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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 size_ = new_size; | 88 size_ = new_size; |
89 | 89 |
90 return true; | 90 return true; |
91 } | 91 } |
92 | 92 |
93 bool GLSurfaceOSMesa::IsOffscreen() { | 93 bool GLSurfaceOSMesa::IsOffscreen() { |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
97 bool GLSurfaceOSMesa::SwapBuffers() { | 97 gfx::SwapResult GLSurfaceOSMesa::SwapBuffers() { |
98 NOTREACHED() << "Should not call SwapBuffers on an GLSurfaceOSMesa."; | 98 NOTREACHED() << "Should not call SwapBuffers on an GLSurfaceOSMesa."; |
99 return false; | 99 return gfx::SwapResult::SWAP_FAILED; |
100 } | 100 } |
101 | 101 |
102 gfx::Size GLSurfaceOSMesa::GetSize() { | 102 gfx::Size GLSurfaceOSMesa::GetSize() { |
103 return size_; | 103 return size_; |
104 } | 104 } |
105 | 105 |
106 void* GLSurfaceOSMesa::GetHandle() { | 106 void* GLSurfaceOSMesa::GetHandle() { |
107 return buffer_.get(); | 107 return buffer_.get(); |
108 } | 108 } |
109 | 109 |
110 unsigned GLSurfaceOSMesa::GetFormat() { | 110 unsigned GLSurfaceOSMesa::GetFormat() { |
111 return format_; | 111 return format_; |
112 } | 112 } |
113 | 113 |
114 GLSurfaceOSMesa::~GLSurfaceOSMesa() { | 114 GLSurfaceOSMesa::~GLSurfaceOSMesa() { |
115 Destroy(); | 115 Destroy(); |
116 } | 116 } |
117 | 117 |
118 bool GLSurfaceOSMesaHeadless::IsOffscreen() { return false; } | 118 bool GLSurfaceOSMesaHeadless::IsOffscreen() { return false; } |
119 | 119 |
120 bool GLSurfaceOSMesaHeadless::SwapBuffers() { return true; } | 120 gfx::SwapResult GLSurfaceOSMesaHeadless::SwapBuffers() { |
| 121 return gfx::SwapResult::SWAP_ACK; |
| 122 } |
121 | 123 |
122 GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless( | 124 GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless( |
123 const gfx::SurfaceConfiguration requested_configuration) | 125 const gfx::SurfaceConfiguration requested_configuration) |
124 : GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, | 126 : GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, |
125 gfx::Size(1, 1), | 127 gfx::Size(1, 1), |
126 requested_configuration) { | 128 requested_configuration) { |
127 } | 129 } |
128 | 130 |
129 void* GLSurfaceOSMesaHeadless::GetConfig() { | 131 void* GLSurfaceOSMesaHeadless::GetConfig() { |
130 // TODO(iansf): Possibly choose a configuration in a manner similar to | 132 // TODO(iansf): Possibly choose a configuration in a manner similar to |
131 // NativeViewGLSurfaceEGL::GetConfig, using the gfx::SurfaceConfiguration | 133 // NativeViewGLSurfaceEGL::GetConfig, using the gfx::SurfaceConfiguration |
132 // returned by GLSurface::GetSurfaceConfiguration. | 134 // returned by GLSurface::GetSurfaceConfiguration. |
133 NOTIMPLEMENTED(); | 135 NOTIMPLEMENTED(); |
134 return NULL; | 136 return NULL; |
135 } | 137 } |
136 | 138 |
137 GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); } | 139 GLSurfaceOSMesaHeadless::~GLSurfaceOSMesaHeadless() { Destroy(); } |
138 | 140 |
139 } // namespace gfx | 141 } // namespace gfx |
OLD | NEW |