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 13 matching lines...) Expand all Loading... |
24 // Interface for EGL surface. | 24 // Interface for EGL surface. |
25 class GL_EXPORT GLSurfaceEGL : public GLSurface { | 25 class GL_EXPORT GLSurfaceEGL : public GLSurface { |
26 public: | 26 public: |
27 GLSurfaceEGL(); | 27 GLSurfaceEGL(); |
28 | 28 |
29 // Implement GLSurface. | 29 // Implement GLSurface. |
30 virtual EGLDisplay GetDisplay() OVERRIDE; | 30 virtual EGLDisplay GetDisplay() OVERRIDE; |
31 | 31 |
32 static bool InitializeOneOff(); | 32 static bool InitializeOneOff(); |
33 static EGLDisplay GetHardwareDisplay(); | 33 static EGLDisplay GetHardwareDisplay(); |
34 static EGLDisplay GetSoftwareDisplay(); | |
35 static EGLNativeDisplayType GetNativeDisplay(); | 34 static EGLNativeDisplayType GetNativeDisplay(); |
36 | 35 |
37 // These aren't particularly tied to surfaces, but since we already | 36 // These aren't particularly tied to surfaces, but since we already |
38 // have the static InitializeOneOff here, it's easiest to reuse its | 37 // have the static InitializeOneOff here, it's easiest to reuse its |
39 // initialization guards. | 38 // initialization guards. |
40 static const char* GetEGLExtensions(); | 39 static const char* GetEGLExtensions(); |
41 static bool HasEGLExtension(const char* name); | 40 static bool HasEGLExtension(const char* name); |
42 static bool IsCreateContextRobustnessSupported(); | 41 static bool IsCreateContextRobustnessSupported(); |
43 | 42 |
44 protected: | 43 protected: |
45 virtual ~GLSurfaceEGL(); | 44 virtual ~GLSurfaceEGL(); |
46 | 45 |
47 bool software_; | |
48 | |
49 private: | 46 private: |
50 DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); | 47 DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); |
51 }; | 48 }; |
52 | 49 |
53 // Encapsulates an EGL surface bound to a view. | 50 // Encapsulates an EGL surface bound to a view. |
54 class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL { | 51 class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL { |
55 public: | 52 public: |
56 NativeViewGLSurfaceEGL(bool software, gfx::AcceleratedWidget window); | 53 explicit NativeViewGLSurfaceEGL(gfx::AcceleratedWidget window); |
57 | 54 |
58 // Implement GLSurface. | 55 // Implement GLSurface. |
59 virtual EGLConfig GetConfig() OVERRIDE; | 56 virtual EGLConfig GetConfig() OVERRIDE; |
60 virtual bool Initialize() OVERRIDE; | 57 virtual bool Initialize() OVERRIDE; |
61 virtual void Destroy() OVERRIDE; | 58 virtual void Destroy() OVERRIDE; |
62 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 59 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
63 virtual bool Recreate() OVERRIDE; | 60 virtual bool Recreate() OVERRIDE; |
64 virtual bool IsOffscreen() OVERRIDE; | 61 virtual bool IsOffscreen() OVERRIDE; |
65 virtual bool SwapBuffers() OVERRIDE; | 62 virtual bool SwapBuffers() OVERRIDE; |
66 virtual gfx::Size GetSize() OVERRIDE; | 63 virtual gfx::Size GetSize() OVERRIDE; |
(...skipping 16 matching lines...) Expand all Loading... |
83 EGLConfig config_; | 80 EGLConfig config_; |
84 | 81 |
85 scoped_ptr<VSyncProvider> vsync_provider_; | 82 scoped_ptr<VSyncProvider> vsync_provider_; |
86 | 83 |
87 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); | 84 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); |
88 }; | 85 }; |
89 | 86 |
90 // Encapsulates a pbuffer EGL surface. | 87 // Encapsulates a pbuffer EGL surface. |
91 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { | 88 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { |
92 public: | 89 public: |
93 PbufferGLSurfaceEGL(bool software, const gfx::Size& size); | 90 explicit PbufferGLSurfaceEGL(const gfx::Size& size); |
94 | 91 |
95 // Implement GLSurface. | 92 // Implement GLSurface. |
96 virtual EGLConfig GetConfig() OVERRIDE; | 93 virtual EGLConfig GetConfig() OVERRIDE; |
97 virtual bool Initialize() OVERRIDE; | 94 virtual bool Initialize() OVERRIDE; |
98 virtual void Destroy() OVERRIDE; | 95 virtual void Destroy() OVERRIDE; |
99 virtual bool IsOffscreen() OVERRIDE; | 96 virtual bool IsOffscreen() OVERRIDE; |
100 virtual bool SwapBuffers() OVERRIDE; | 97 virtual bool SwapBuffers() OVERRIDE; |
101 virtual gfx::Size GetSize() OVERRIDE; | 98 virtual gfx::Size GetSize() OVERRIDE; |
102 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 99 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
103 virtual EGLSurface GetHandle() OVERRIDE; | 100 virtual EGLSurface GetHandle() OVERRIDE; |
104 virtual void* GetShareHandle() OVERRIDE; | 101 virtual void* GetShareHandle() OVERRIDE; |
105 | 102 |
106 protected: | 103 protected: |
107 virtual ~PbufferGLSurfaceEGL(); | 104 virtual ~PbufferGLSurfaceEGL(); |
108 | 105 |
109 private: | 106 private: |
110 gfx::Size size_; | 107 gfx::Size size_; |
111 EGLSurface surface_; | 108 EGLSurface surface_; |
112 | 109 |
113 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); | 110 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); |
114 }; | 111 }; |
115 | 112 |
116 } // namespace gfx | 113 } // namespace gfx |
117 | 114 |
118 #endif // UI_GL_GL_SURFACE_EGL_H_ | 115 #endif // UI_GL_GL_SURFACE_EGL_H_ |
OLD | NEW |