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