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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 public: | 61 public: |
62 explicit NativeViewGLSurfaceEGL(EGLNativeWindowType window); | 62 explicit NativeViewGLSurfaceEGL(EGLNativeWindowType window); |
63 | 63 |
64 // Implement GLSurface. | 64 // Implement GLSurface. |
65 EGLConfig GetConfig() override; | 65 EGLConfig GetConfig() override; |
66 bool Initialize() override; | 66 bool Initialize() override; |
67 void Destroy() override; | 67 void Destroy() override; |
68 bool Resize(const gfx::Size& size) override; | 68 bool Resize(const gfx::Size& size) override; |
69 bool Recreate() override; | 69 bool Recreate() override; |
70 bool IsOffscreen() override; | 70 bool IsOffscreen() override; |
71 bool SwapBuffers() override; | 71 gfx::SwapResult SwapBuffers() override; |
72 gfx::Size GetSize() override; | 72 gfx::Size GetSize() override; |
73 EGLSurface GetHandle() override; | 73 EGLSurface GetHandle() override; |
74 bool SupportsPostSubBuffer() override; | 74 bool SupportsPostSubBuffer() override; |
75 bool PostSubBuffer(int x, int y, int width, int height) override; | 75 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
76 VSyncProvider* GetVSyncProvider() override; | 76 VSyncProvider* GetVSyncProvider() override; |
77 | 77 |
78 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. | 78 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. |
79 // Takes ownership of the VSyncProvider. | 79 // Takes ownership of the VSyncProvider. |
80 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); | 80 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); |
81 | 81 |
82 protected: | 82 protected: |
83 ~NativeViewGLSurfaceEGL() override; | 83 ~NativeViewGLSurfaceEGL() override; |
84 | 84 |
85 EGLNativeWindowType window_; | 85 EGLNativeWindowType window_; |
(...skipping 25 matching lines...) Expand all Loading... |
111 // Encapsulates a pbuffer EGL surface. | 111 // Encapsulates a pbuffer EGL surface. |
112 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { | 112 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { |
113 public: | 113 public: |
114 explicit PbufferGLSurfaceEGL(const gfx::Size& size); | 114 explicit PbufferGLSurfaceEGL(const gfx::Size& size); |
115 | 115 |
116 // Implement GLSurface. | 116 // Implement GLSurface. |
117 EGLConfig GetConfig() override; | 117 EGLConfig GetConfig() override; |
118 bool Initialize() override; | 118 bool Initialize() override; |
119 void Destroy() override; | 119 void Destroy() override; |
120 bool IsOffscreen() override; | 120 bool IsOffscreen() override; |
121 bool SwapBuffers() override; | 121 gfx::SwapResult SwapBuffers() override; |
122 gfx::Size GetSize() override; | 122 gfx::Size GetSize() override; |
123 bool Resize(const gfx::Size& size) override; | 123 bool Resize(const gfx::Size& size) override; |
124 EGLSurface GetHandle() override; | 124 EGLSurface GetHandle() override; |
125 void* GetShareHandle() override; | 125 void* GetShareHandle() override; |
126 | 126 |
127 protected: | 127 protected: |
128 ~PbufferGLSurfaceEGL() override; | 128 ~PbufferGLSurfaceEGL() override; |
129 | 129 |
130 private: | 130 private: |
131 gfx::Size size_; | 131 gfx::Size size_; |
132 EGLSurface surface_; | 132 EGLSurface surface_; |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); | 134 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); |
135 }; | 135 }; |
136 | 136 |
137 // SurfacelessEGL is used as Offscreen surface when platform supports | 137 // SurfacelessEGL is used as Offscreen surface when platform supports |
138 // KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the | 138 // KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the |
139 // need to create a dummy EGLsurface in case we render to client API targets. | 139 // need to create a dummy EGLsurface in case we render to client API targets. |
140 class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL { | 140 class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL { |
141 public: | 141 public: |
142 explicit SurfacelessEGL(const gfx::Size& size); | 142 explicit SurfacelessEGL(const gfx::Size& size); |
143 | 143 |
144 // Implement GLSurface. | 144 // Implement GLSurface. |
145 EGLConfig GetConfig() override; | 145 EGLConfig GetConfig() override; |
146 bool Initialize() override; | 146 bool Initialize() override; |
147 void Destroy() override; | 147 void Destroy() override; |
148 bool IsOffscreen() override; | 148 bool IsOffscreen() override; |
149 bool IsSurfaceless() const override; | 149 bool IsSurfaceless() const override; |
150 bool SwapBuffers() override; | 150 gfx::SwapResult SwapBuffers() override; |
151 gfx::Size GetSize() override; | 151 gfx::Size GetSize() override; |
152 bool Resize(const gfx::Size& size) override; | 152 bool Resize(const gfx::Size& size) override; |
153 EGLSurface GetHandle() override; | 153 EGLSurface GetHandle() override; |
154 void* GetShareHandle() override; | 154 void* GetShareHandle() override; |
155 | 155 |
156 protected: | 156 protected: |
157 ~SurfacelessEGL() override; | 157 ~SurfacelessEGL() override; |
158 | 158 |
159 private: | 159 private: |
160 gfx::Size size_; | 160 gfx::Size size_; |
161 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); | 161 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); |
162 }; | 162 }; |
163 | 163 |
164 } // namespace gfx | 164 } // namespace gfx |
165 | 165 |
166 #endif // UI_GL_GL_SURFACE_EGL_H_ | 166 #endif // UI_GL_GL_SURFACE_EGL_H_ |
OLD | NEW |