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 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // Get default EGL display for GLSurfaceEGL (differs by platform). | 23 // Get default EGL display for GLSurfaceEGL (differs by platform). |
24 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay(); | 24 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay(); |
25 | 25 |
26 // Interface for EGL surface. | 26 // Interface for EGL surface. |
27 class GL_EXPORT GLSurfaceEGL : public GLSurface { | 27 class GL_EXPORT GLSurfaceEGL : public GLSurface { |
28 public: | 28 public: |
29 GLSurfaceEGL(); | 29 GLSurfaceEGL(); |
30 | 30 |
31 // Implement GLSurface. | 31 // Implement GLSurface. |
32 virtual EGLDisplay GetDisplay() OVERRIDE; | 32 virtual EGLDisplay GetDisplay() override; |
33 | 33 |
34 static bool InitializeOneOff(); | 34 static bool InitializeOneOff(); |
35 static EGLDisplay GetHardwareDisplay(); | 35 static EGLDisplay GetHardwareDisplay(); |
36 static EGLNativeDisplayType GetNativeDisplay(); | 36 static EGLNativeDisplayType GetNativeDisplay(); |
37 | 37 |
38 // These aren't particularly tied to surfaces, but since we already | 38 // These aren't particularly tied to surfaces, but since we already |
39 // have the static InitializeOneOff here, it's easiest to reuse its | 39 // have the static InitializeOneOff here, it's easiest to reuse its |
40 // initialization guards. | 40 // initialization guards. |
41 static const char* GetEGLExtensions(); | 41 static const char* GetEGLExtensions(); |
42 static bool HasEGLExtension(const char* name); | 42 static bool HasEGLExtension(const char* name); |
(...skipping 10 matching lines...) Expand all Loading... |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); | 54 DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); |
55 }; | 55 }; |
56 | 56 |
57 // Encapsulates an EGL surface bound to a view. | 57 // Encapsulates an EGL surface bound to a view. |
58 class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL { | 58 class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL { |
59 public: | 59 public: |
60 explicit NativeViewGLSurfaceEGL(EGLNativeWindowType window); | 60 explicit NativeViewGLSurfaceEGL(EGLNativeWindowType window); |
61 | 61 |
62 // Implement GLSurface. | 62 // Implement GLSurface. |
63 virtual EGLConfig GetConfig() OVERRIDE; | 63 virtual EGLConfig GetConfig() override; |
64 virtual bool Initialize() OVERRIDE; | 64 virtual bool Initialize() override; |
65 virtual void Destroy() OVERRIDE; | 65 virtual void Destroy() override; |
66 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 66 virtual bool Resize(const gfx::Size& size) override; |
67 virtual bool Recreate() OVERRIDE; | 67 virtual bool Recreate() override; |
68 virtual bool IsOffscreen() OVERRIDE; | 68 virtual bool IsOffscreen() override; |
69 virtual bool SwapBuffers() OVERRIDE; | 69 virtual bool SwapBuffers() override; |
70 virtual gfx::Size GetSize() OVERRIDE; | 70 virtual gfx::Size GetSize() override; |
71 virtual EGLSurface GetHandle() OVERRIDE; | 71 virtual EGLSurface GetHandle() override; |
72 virtual bool SupportsPostSubBuffer() OVERRIDE; | 72 virtual bool SupportsPostSubBuffer() override; |
73 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 73 virtual bool PostSubBuffer(int x, int y, int width, int height) override; |
74 virtual VSyncProvider* GetVSyncProvider() OVERRIDE; | 74 virtual VSyncProvider* GetVSyncProvider() override; |
75 | 75 |
76 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. | 76 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. |
77 // Takes ownership of the VSyncProvider. | 77 // Takes ownership of the VSyncProvider. |
78 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); | 78 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); |
79 | 79 |
80 protected: | 80 protected: |
81 virtual ~NativeViewGLSurfaceEGL(); | 81 virtual ~NativeViewGLSurfaceEGL(); |
82 | 82 |
83 EGLNativeWindowType window_; | 83 EGLNativeWindowType window_; |
84 | 84 |
85 private: | 85 private: |
86 EGLSurface surface_; | 86 EGLSurface surface_; |
87 bool supports_post_sub_buffer_; | 87 bool supports_post_sub_buffer_; |
88 EGLConfig config_; | 88 EGLConfig config_; |
89 gfx::Size size_; | 89 gfx::Size size_; |
90 | 90 |
91 scoped_ptr<VSyncProvider> vsync_provider_; | 91 scoped_ptr<VSyncProvider> vsync_provider_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); | 93 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); |
94 }; | 94 }; |
95 | 95 |
96 // Encapsulates a pbuffer EGL surface. | 96 // Encapsulates a pbuffer EGL surface. |
97 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { | 97 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { |
98 public: | 98 public: |
99 explicit PbufferGLSurfaceEGL(const gfx::Size& size); | 99 explicit PbufferGLSurfaceEGL(const gfx::Size& size); |
100 | 100 |
101 // Implement GLSurface. | 101 // Implement GLSurface. |
102 virtual EGLConfig GetConfig() OVERRIDE; | 102 virtual EGLConfig GetConfig() override; |
103 virtual bool Initialize() OVERRIDE; | 103 virtual bool Initialize() override; |
104 virtual void Destroy() OVERRIDE; | 104 virtual void Destroy() override; |
105 virtual bool IsOffscreen() OVERRIDE; | 105 virtual bool IsOffscreen() override; |
106 virtual bool SwapBuffers() OVERRIDE; | 106 virtual bool SwapBuffers() override; |
107 virtual gfx::Size GetSize() OVERRIDE; | 107 virtual gfx::Size GetSize() override; |
108 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 108 virtual bool Resize(const gfx::Size& size) override; |
109 virtual EGLSurface GetHandle() OVERRIDE; | 109 virtual EGLSurface GetHandle() override; |
110 virtual void* GetShareHandle() OVERRIDE; | 110 virtual void* GetShareHandle() override; |
111 | 111 |
112 protected: | 112 protected: |
113 virtual ~PbufferGLSurfaceEGL(); | 113 virtual ~PbufferGLSurfaceEGL(); |
114 | 114 |
115 private: | 115 private: |
116 gfx::Size size_; | 116 gfx::Size size_; |
117 EGLSurface surface_; | 117 EGLSurface surface_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); | 119 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); |
120 }; | 120 }; |
121 | 121 |
122 // SurfacelessEGL is used as Offscreen surface when platform supports | 122 // SurfacelessEGL is used as Offscreen surface when platform supports |
123 // KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the | 123 // KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the |
124 // need to create a dummy EGLsurface in case we render to client API targets. | 124 // need to create a dummy EGLsurface in case we render to client API targets. |
125 class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL { | 125 class GL_EXPORT SurfacelessEGL : public GLSurfaceEGL { |
126 public: | 126 public: |
127 explicit SurfacelessEGL(const gfx::Size& size); | 127 explicit SurfacelessEGL(const gfx::Size& size); |
128 | 128 |
129 // Implement GLSurface. | 129 // Implement GLSurface. |
130 virtual EGLConfig GetConfig() OVERRIDE; | 130 virtual EGLConfig GetConfig() override; |
131 virtual bool Initialize() OVERRIDE; | 131 virtual bool Initialize() override; |
132 virtual void Destroy() OVERRIDE; | 132 virtual void Destroy() override; |
133 virtual bool IsOffscreen() OVERRIDE; | 133 virtual bool IsOffscreen() override; |
134 virtual bool SwapBuffers() OVERRIDE; | 134 virtual bool SwapBuffers() override; |
135 virtual gfx::Size GetSize() OVERRIDE; | 135 virtual gfx::Size GetSize() override; |
136 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 136 virtual bool Resize(const gfx::Size& size) override; |
137 virtual EGLSurface GetHandle() OVERRIDE; | 137 virtual EGLSurface GetHandle() override; |
138 virtual void* GetShareHandle() OVERRIDE; | 138 virtual void* GetShareHandle() override; |
139 | 139 |
140 protected: | 140 protected: |
141 virtual ~SurfacelessEGL(); | 141 virtual ~SurfacelessEGL(); |
142 | 142 |
143 private: | 143 private: |
144 gfx::Size size_; | 144 gfx::Size size_; |
145 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); | 145 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); |
146 }; | 146 }; |
147 | 147 |
148 } // namespace gfx | 148 } // namespace gfx |
149 | 149 |
150 #endif // UI_GL_GL_SURFACE_EGL_H_ | 150 #endif // UI_GL_GL_SURFACE_EGL_H_ |
OLD | NEW |