| 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 #ifndef UI_GL_GL_SURFACE_OSMESA_H_ | 5 #ifndef UI_GL_GL_SURFACE_OSMESA_H_ |
| 6 #define UI_GL_GL_SURFACE_OSMESA_H_ | 6 #define UI_GL_GL_SURFACE_OSMESA_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 10 #include "ui/gl/gl_surface.h" | 13 #include "ui/gl/gl_surface.h" |
| 11 | 14 |
| 12 namespace gfx { | 15 namespace gfx { |
| 13 | 16 |
| 14 enum OSMesaSurfaceFormat { OSMesaSurfaceFormatBGRA, OSMesaSurfaceFormatRGBA }; | 17 enum OSMesaSurfaceFormat { OSMesaSurfaceFormatBGRA, OSMesaSurfaceFormatRGBA }; |
| 15 | 18 |
| 16 // A surface that the Mesa software renderer draws to. This is actually just a | 19 // A surface that the Mesa software renderer draws to. This is actually just a |
| 17 // buffer in system memory. GetHandle returns a pointer to the buffer. These | 20 // buffer in system memory. GetHandle returns a pointer to the buffer. These |
| (...skipping 13 matching lines...) Expand all Loading... |
| 31 gfx::Size GetSize() override; | 34 gfx::Size GetSize() override; |
| 32 void* GetHandle() override; | 35 void* GetHandle() override; |
| 33 unsigned GetFormat() override; | 36 unsigned GetFormat() override; |
| 34 | 37 |
| 35 protected: | 38 protected: |
| 36 ~GLSurfaceOSMesa() override; | 39 ~GLSurfaceOSMesa() override; |
| 37 | 40 |
| 38 private: | 41 private: |
| 39 unsigned format_; | 42 unsigned format_; |
| 40 gfx::Size size_; | 43 gfx::Size size_; |
| 41 scoped_ptr<int32[]> buffer_; | 44 scoped_ptr<int32_t[]> buffer_; |
| 42 | 45 |
| 43 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesa); | 46 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesa); |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 // A thin subclass of |GLSurfaceOSMesa| that can be used in place | 49 // A thin subclass of |GLSurfaceOSMesa| that can be used in place |
| 47 // of a native hardware-provided surface when a native surface | 50 // of a native hardware-provided surface when a native surface |
| 48 // provider is not available. | 51 // provider is not available. |
| 49 class GLSurfaceOSMesaHeadless : public GLSurfaceOSMesa { | 52 class GLSurfaceOSMesaHeadless : public GLSurfaceOSMesa { |
| 50 public: | 53 public: |
| 51 explicit GLSurfaceOSMesaHeadless(); | 54 explicit GLSurfaceOSMesaHeadless(); |
| 52 | 55 |
| 53 bool IsOffscreen() override; | 56 bool IsOffscreen() override; |
| 54 gfx::SwapResult SwapBuffers() override; | 57 gfx::SwapResult SwapBuffers() override; |
| 55 | 58 |
| 56 protected: | 59 protected: |
| 57 ~GLSurfaceOSMesaHeadless() override; | 60 ~GLSurfaceOSMesaHeadless() override; |
| 58 | 61 |
| 59 private: | 62 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesaHeadless); | 63 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesaHeadless); |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 } // namespace gfx | 66 } // namespace gfx |
| 64 | 67 |
| 65 #endif // UI_GL_GL_SURFACE_OSMESA_H_ | 68 #endif // UI_GL_GL_SURFACE_OSMESA_H_ |
| OLD | NEW |