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 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #else | 26 #else |
27 typedef struct _XDisplay* EGLNativeDisplayType; | 27 typedef struct _XDisplay* EGLNativeDisplayType; |
28 #endif | 28 #endif |
29 | 29 |
30 namespace gfx { | 30 namespace gfx { |
31 | 31 |
32 // Interface for EGL surface. | 32 // Interface for EGL surface. |
33 class GL_EXPORT GLSurfaceEGL : public GLSurface { | 33 class GL_EXPORT GLSurfaceEGL : public GLSurface { |
34 public: | 34 public: |
35 GLSurfaceEGL(); | 35 GLSurfaceEGL(); |
36 virtual ~GLSurfaceEGL(); | |
37 | 36 |
38 // Implement GLSurface. | 37 // Implement GLSurface. |
39 virtual EGLDisplay GetDisplay() OVERRIDE; | 38 virtual EGLDisplay GetDisplay() OVERRIDE; |
40 | 39 |
41 static bool InitializeOneOff(); | 40 static bool InitializeOneOff(); |
42 static EGLDisplay GetHardwareDisplay(); | 41 static EGLDisplay GetHardwareDisplay(); |
43 static EGLDisplay GetSoftwareDisplay(); | 42 static EGLDisplay GetSoftwareDisplay(); |
44 static EGLNativeDisplayType GetNativeDisplay(); | 43 static EGLNativeDisplayType GetNativeDisplay(); |
45 | 44 |
46 protected: | 45 protected: |
| 46 virtual ~GLSurfaceEGL(); |
| 47 |
47 bool software_; | 48 bool software_; |
48 | 49 |
49 private: | 50 private: |
50 DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); | 51 DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); |
51 }; | 52 }; |
52 | 53 |
53 // Encapsulates an EGL surface bound to a view. | 54 // Encapsulates an EGL surface bound to a view. |
54 class NativeViewGLSurfaceEGL : public GLSurfaceEGL { | 55 class NativeViewGLSurfaceEGL : public GLSurfaceEGL { |
55 public: | 56 public: |
56 NativeViewGLSurfaceEGL(bool software, gfx::AcceleratedWidget window); | 57 NativeViewGLSurfaceEGL(bool software, gfx::AcceleratedWidget window); |
57 virtual ~NativeViewGLSurfaceEGL(); | |
58 | 58 |
59 // Implement GLSurface. | 59 // Implement GLSurface. |
60 virtual EGLConfig GetConfig() OVERRIDE; | 60 virtual EGLConfig GetConfig() OVERRIDE; |
61 virtual bool Initialize() OVERRIDE; | 61 virtual bool Initialize() OVERRIDE; |
62 virtual void Destroy() OVERRIDE; | 62 virtual void Destroy() OVERRIDE; |
63 virtual bool IsOffscreen() OVERRIDE; | 63 virtual bool IsOffscreen() OVERRIDE; |
64 virtual bool SwapBuffers() OVERRIDE; | 64 virtual bool SwapBuffers() OVERRIDE; |
65 virtual gfx::Size GetSize() OVERRIDE; | 65 virtual gfx::Size GetSize() OVERRIDE; |
66 virtual EGLSurface GetHandle() OVERRIDE; | 66 virtual EGLSurface GetHandle() OVERRIDE; |
67 virtual std::string GetExtensions() OVERRIDE; | 67 virtual std::string GetExtensions() OVERRIDE; |
68 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 68 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
69 | 69 |
70 protected: | 70 protected: |
| 71 virtual ~NativeViewGLSurfaceEGL(); |
71 void SetHandle(EGLSurface surface); | 72 void SetHandle(EGLSurface surface); |
72 | 73 |
73 private: | 74 private: |
74 gfx::AcceleratedWidget window_; | 75 gfx::AcceleratedWidget window_; |
75 EGLSurface surface_; | 76 EGLSurface surface_; |
76 bool supports_post_sub_buffer_; | 77 bool supports_post_sub_buffer_; |
77 EGLConfig config_; | 78 EGLConfig config_; |
78 | 79 |
79 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); | 80 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); |
80 }; | 81 }; |
81 | 82 |
82 // Encapsulates a pbuffer EGL surface. | 83 // Encapsulates a pbuffer EGL surface. |
83 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { | 84 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { |
84 public: | 85 public: |
85 PbufferGLSurfaceEGL(bool software, const gfx::Size& size); | 86 PbufferGLSurfaceEGL(bool software, const gfx::Size& size); |
86 virtual ~PbufferGLSurfaceEGL(); | |
87 | 87 |
88 // Implement GLSurface. | 88 // Implement GLSurface. |
89 virtual EGLConfig GetConfig() OVERRIDE; | 89 virtual EGLConfig GetConfig() OVERRIDE; |
90 virtual bool Initialize() OVERRIDE; | 90 virtual bool Initialize() OVERRIDE; |
91 virtual void Destroy() OVERRIDE; | 91 virtual void Destroy() OVERRIDE; |
92 virtual bool IsOffscreen() OVERRIDE; | 92 virtual bool IsOffscreen() OVERRIDE; |
93 virtual bool SwapBuffers() OVERRIDE; | 93 virtual bool SwapBuffers() OVERRIDE; |
94 virtual gfx::Size GetSize() OVERRIDE; | 94 virtual gfx::Size GetSize() OVERRIDE; |
95 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 95 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
96 virtual EGLSurface GetHandle() OVERRIDE; | 96 virtual EGLSurface GetHandle() OVERRIDE; |
97 virtual void* GetShareHandle() OVERRIDE; | 97 virtual void* GetShareHandle() OVERRIDE; |
98 | 98 |
| 99 protected: |
| 100 virtual ~PbufferGLSurfaceEGL(); |
| 101 |
99 private: | 102 private: |
100 gfx::Size size_; | 103 gfx::Size size_; |
101 EGLSurface surface_; | 104 EGLSurface surface_; |
102 | 105 |
103 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); | 106 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceEGL); |
104 }; | 107 }; |
105 | 108 |
106 } // namespace gfx | 109 } // namespace gfx |
107 | 110 |
108 #endif // UI_GL_GL_SURFACE_EGL_H_ | 111 #endif // UI_GL_GL_SURFACE_EGL_H_ |
OLD | NEW |