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 |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "ui/gfx/native_widget_types.h" | |
17 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
18 #include "ui/gfx/vsync_provider.h" | 17 #include "ui/gfx/vsync_provider.h" |
19 #include "ui/gl/gl_bindings.h" | 18 #include "ui/gl/gl_bindings.h" |
20 #include "ui/gl/gl_surface.h" | 19 #include "ui/gl/gl_surface.h" |
21 | 20 |
22 namespace gfx { | 21 namespace gfx { |
23 | 22 |
24 // Interface for EGL surface. | 23 // Interface for EGL surface. |
25 class GL_EXPORT GLSurfaceEGL : public GLSurface { | 24 class GL_EXPORT GLSurfaceEGL : public GLSurface { |
26 public: | 25 public: |
(...skipping 16 matching lines...) Expand all Loading... |
43 protected: | 42 protected: |
44 virtual ~GLSurfaceEGL(); | 43 virtual ~GLSurfaceEGL(); |
45 | 44 |
46 private: | 45 private: |
47 DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); | 46 DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); |
48 }; | 47 }; |
49 | 48 |
50 // Encapsulates an EGL surface bound to a view. | 49 // Encapsulates an EGL surface bound to a view. |
51 class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL { | 50 class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL { |
52 public: | 51 public: |
53 explicit NativeViewGLSurfaceEGL(gfx::AcceleratedWidget window); | 52 explicit NativeViewGLSurfaceEGL(EGLNativeWindowType window); |
54 | 53 |
55 // Implement GLSurface. | 54 // Implement GLSurface. |
56 virtual EGLConfig GetConfig() OVERRIDE; | 55 virtual EGLConfig GetConfig() OVERRIDE; |
57 virtual bool Initialize() OVERRIDE; | 56 virtual bool Initialize() OVERRIDE; |
58 virtual void Destroy() OVERRIDE; | 57 virtual void Destroy() OVERRIDE; |
59 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 58 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
60 virtual bool Recreate() OVERRIDE; | 59 virtual bool Recreate() OVERRIDE; |
61 virtual bool IsOffscreen() OVERRIDE; | 60 virtual bool IsOffscreen() OVERRIDE; |
62 virtual bool SwapBuffers() OVERRIDE; | 61 virtual bool SwapBuffers() OVERRIDE; |
63 virtual gfx::Size GetSize() OVERRIDE; | 62 virtual gfx::Size GetSize() OVERRIDE; |
64 virtual EGLSurface GetHandle() OVERRIDE; | 63 virtual EGLSurface GetHandle() OVERRIDE; |
65 virtual std::string GetExtensions() OVERRIDE; | 64 virtual std::string GetExtensions() OVERRIDE; |
66 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 65 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
67 virtual VSyncProvider* GetVSyncProvider() OVERRIDE; | 66 virtual VSyncProvider* GetVSyncProvider() OVERRIDE; |
68 | 67 |
69 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. | 68 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. |
70 // Takes ownership of the VSyncProvider. | 69 // Takes ownership of the VSyncProvider. |
71 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); | 70 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); |
72 | 71 |
73 protected: | 72 protected: |
74 virtual ~NativeViewGLSurfaceEGL(); | 73 virtual ~NativeViewGLSurfaceEGL(); |
75 void SetHandle(EGLSurface surface); | 74 void SetHandle(EGLSurface surface); |
76 | 75 |
77 private: | 76 private: |
78 gfx::AcceleratedWidget window_; | 77 EGLNativeWindowType window_; |
79 EGLSurface surface_; | 78 EGLSurface surface_; |
80 bool supports_post_sub_buffer_; | 79 bool supports_post_sub_buffer_; |
81 EGLConfig config_; | 80 EGLConfig config_; |
82 gfx::Size size_; | 81 gfx::Size size_; |
83 | 82 |
84 scoped_ptr<VSyncProvider> vsync_provider_; | 83 scoped_ptr<VSyncProvider> vsync_provider_; |
85 | 84 |
86 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); | 85 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); |
87 }; | 86 }; |
88 | 87 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 virtual ~SurfacelessEGL(); | 133 virtual ~SurfacelessEGL(); |
135 | 134 |
136 private: | 135 private: |
137 gfx::Size size_; | 136 gfx::Size size_; |
138 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); | 137 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); |
139 }; | 138 }; |
140 | 139 |
141 } // namespace gfx | 140 } // namespace gfx |
142 | 141 |
143 #endif // UI_GL_GL_SURFACE_EGL_H_ | 142 #endif // UI_GL_GL_SURFACE_EGL_H_ |
OLD | NEW |