| 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_EGL_H_ | 5 #ifndef UI_GL_GL_SURFACE_EGL_H_ |
| 6 #define UI_GL_GL_SURFACE_EGL_H_ | 6 #define UI_GL_GL_SURFACE_EGL_H_ |
| 7 | 7 |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 public: | 73 public: |
| 74 explicit NativeViewGLSurfaceEGL(EGLNativeWindowType window); | 74 explicit NativeViewGLSurfaceEGL(EGLNativeWindowType window); |
| 75 | 75 |
| 76 // Implement GLSurface. | 76 // Implement GLSurface. |
| 77 EGLConfig GetConfig() override; | 77 EGLConfig GetConfig() override; |
| 78 bool Initialize() override; | 78 bool Initialize() override; |
| 79 void Destroy() override; | 79 void Destroy() override; |
| 80 bool Resize(const gfx::Size& size) override; | 80 bool Resize(const gfx::Size& size) override; |
| 81 bool Recreate() override; | 81 bool Recreate() override; |
| 82 bool IsOffscreen() override; | 82 bool IsOffscreen() override; |
| 83 gfx::SwapResult SwapBuffers() override; | 83 bool SwapBuffers() override; |
| 84 gfx::Size GetSize() override; | 84 gfx::Size GetSize() override; |
| 85 EGLSurface GetHandle() override; | 85 EGLSurface GetHandle() override; |
| 86 bool SupportsPostSubBuffer() override; | 86 bool SupportsPostSubBuffer() override; |
| 87 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 87 bool PostSubBuffer(int x, int y, int width, int height) override; |
| 88 VSyncProvider* GetVSyncProvider() override; | 88 VSyncProvider* GetVSyncProvider() override; |
| 89 | 89 |
| 90 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. | 90 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. |
| 91 // Takes ownership of the VSyncProvider. | 91 // Takes ownership of the VSyncProvider. |
| 92 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); | 92 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); |
| 93 | 93 |
| 94 protected: | 94 protected: |
| 95 ~NativeViewGLSurfaceEGL() override; | 95 ~NativeViewGLSurfaceEGL() override; |
| 96 | 96 |
| 97 EGLNativeWindowType window_; | 97 EGLNativeWindowType window_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 123 // Encapsulates a pbuffer EGL surface. | 123 // Encapsulates a pbuffer EGL surface. |
| 124 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { | 124 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { |
| 125 public: | 125 public: |
| 126 explicit PbufferGLSurfaceEGL(const gfx::Size& size); | 126 explicit PbufferGLSurfaceEGL(const gfx::Size& size); |
| 127 | 127 |
| 128 // Implement GLSurface. | 128 // Implement GLSurface. |
| 129 EGLConfig GetConfig() override; | 129 EGLConfig GetConfig() override; |
| 130 bool Initialize() override; | 130 bool Initialize() override; |
| 131 void Destroy() override; | 131 void Destroy() override; |
| 132 bool IsOffscreen() override; | 132 bool IsOffscreen() override; |
| 133 gfx::SwapResult SwapBuffers() override; | 133 bool SwapBuffers() override; |
| 134 gfx::Size GetSize() override; | 134 gfx::Size GetSize() override; |
| 135 bool Resize(const gfx::Size& size) override; | 135 bool Resize(const gfx::Size& size) override; |
| 136 EGLSurface GetHandle() override; | 136 EGLSurface GetHandle() override; |
| 137 void* GetShareHandle() override; | 137 void* GetShareHandle() override; |
| 138 | 138 |
| 139 protected: | 139 protected: |
| 140 ~PbufferGLSurfaceEGL() override; | 140 ~PbufferGLSurfaceEGL() override; |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 gfx::Size size_; | 143 gfx::Size size_; |
| 144 EGLSurface surface_; | 144 EGLSurface surface_; |
| 145 | 145 |
| 146 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); | 146 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 // SurfacelessEGL is used as Offscreen surface when platform supports | 149 // SurfacelessEGL is used as Offscreen surface when platform supports |
| 150 // KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the | 150 // KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the |
| 151 // need to create a dummy EGLsurface in case we render to client API targets. | 151 // need to create a dummy EGLsurface in case we render to client API targets. |
| 152 class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL { | 152 class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL { |
| 153 public: | 153 public: |
| 154 explicit SurfacelessEGL(const gfx::Size& size); | 154 explicit SurfacelessEGL(const gfx::Size& size); |
| 155 | 155 |
| 156 // Implement GLSurface. | 156 // Implement GLSurface. |
| 157 EGLConfig GetConfig() override; | 157 EGLConfig GetConfig() override; |
| 158 bool Initialize() override; | 158 bool Initialize() override; |
| 159 void Destroy() override; | 159 void Destroy() override; |
| 160 bool IsOffscreen() override; | 160 bool IsOffscreen() override; |
| 161 bool IsSurfaceless() const override; | 161 bool IsSurfaceless() const override; |
| 162 gfx::SwapResult SwapBuffers() override; | 162 bool SwapBuffers() override; |
| 163 gfx::Size GetSize() override; | 163 gfx::Size GetSize() override; |
| 164 bool Resize(const gfx::Size& size) override; | 164 bool Resize(const gfx::Size& size) override; |
| 165 EGLSurface GetHandle() override; | 165 EGLSurface GetHandle() override; |
| 166 void* GetShareHandle() override; | 166 void* GetShareHandle() override; |
| 167 | 167 |
| 168 protected: | 168 protected: |
| 169 ~SurfacelessEGL() override; | 169 ~SurfacelessEGL() override; |
| 170 | 170 |
| 171 private: | 171 private: |
| 172 gfx::Size size_; | 172 gfx::Size size_; |
| 173 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); | 173 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 } // namespace gfx | 176 } // namespace gfx |
| 177 | 177 |
| 178 #endif // UI_GL_GL_SURFACE_EGL_H_ | 178 #endif // UI_GL_GL_SURFACE_EGL_H_ |
| OLD | NEW |