OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 5 #ifndef UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
6 #define UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 6 #define UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
7 | 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/native_library.h" |
8 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
9 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
11 | 13 |
12 class SkCanvas; | 14 class SkCanvas; |
13 | 15 |
14 namespace gfx { | 16 namespace gfx { |
15 class Screen; | 17 class Screen; |
16 class VSyncProvider; | 18 class VSyncProvider; |
17 | 19 |
(...skipping 26 matching lines...) Expand all Loading... |
44 // modes (See comments bellow for descriptions). | 46 // modes (See comments bellow for descriptions). |
45 class GFX_EXPORT SurfaceFactoryOzone { | 47 class GFX_EXPORT SurfaceFactoryOzone { |
46 public: | 48 public: |
47 // Describes the state of the hardware after initialization. | 49 // Describes the state of the hardware after initialization. |
48 enum HardwareState { | 50 enum HardwareState { |
49 UNINITIALIZED, | 51 UNINITIALIZED, |
50 INITIALIZED, | 52 INITIALIZED, |
51 FAILED, | 53 FAILED, |
52 }; | 54 }; |
53 | 55 |
| 56 typedef void*(*GLGetProcAddressProc)(const char* name); |
| 57 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
| 58 typedef base::Callback<void(GLGetProcAddressProc)> |
| 59 SetGLGetProcAddressProcCallback; |
| 60 |
54 SurfaceFactoryOzone(); | 61 SurfaceFactoryOzone(); |
55 virtual ~SurfaceFactoryOzone(); | 62 virtual ~SurfaceFactoryOzone(); |
56 | 63 |
57 // Returns the instance | 64 // Returns the instance |
58 static SurfaceFactoryOzone* GetInstance(); | 65 static SurfaceFactoryOzone* GetInstance(); |
59 | 66 |
60 // Returns a display spec as in |CreateDisplayFromSpec| for the default | 67 // Returns a display spec as in |CreateDisplayFromSpec| for the default |
61 // native surface. | 68 // native surface. |
62 virtual const char* DefaultDisplaySpec(); | 69 virtual const char* DefaultDisplaySpec(); |
63 | 70 |
(...skipping 20 matching lines...) Expand all Loading... |
84 // The returned AcceleratedWidget is an opaque token that must realized | 91 // The returned AcceleratedWidget is an opaque token that must realized |
85 // before it can be used to create a GL surface. | 92 // before it can be used to create a GL surface. |
86 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 93 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
87 | 94 |
88 // Realizes an AcceleratedWidget so that the returned AcceleratedWidget | 95 // Realizes an AcceleratedWidget so that the returned AcceleratedWidget |
89 // can be used to to create a GLSurface. This method may only be called in | 96 // can be used to to create a GLSurface. This method may only be called in |
90 // a process that has a valid GL context. | 97 // a process that has a valid GL context. |
91 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( | 98 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( |
92 gfx::AcceleratedWidget w) = 0; | 99 gfx::AcceleratedWidget w) = 0; |
93 | 100 |
94 // Sets up GL bindings for the native surface. | 101 // Sets up GL bindings for the native surface. Takes two callback parameters |
95 virtual bool LoadEGLGLES2Bindings() = 0; | 102 // that allow Ozone to register the GL bindings. |
| 103 virtual bool LoadEGLGLES2Bindings( |
| 104 AddGLLibraryCallback add_gl_library, |
| 105 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0; |
96 | 106 |
97 // If possible attempts to resize the given AcceleratedWidget instance and if | 107 // If possible attempts to resize the given AcceleratedWidget instance and if |
98 // a resize action was performed returns true, otherwise false (native | 108 // a resize action was performed returns true, otherwise false (native |
99 // hardware may only support a single fixed size). | 109 // hardware may only support a single fixed size). |
100 virtual bool AttemptToResizeAcceleratedWidget( | 110 virtual bool AttemptToResizeAcceleratedWidget( |
101 gfx::AcceleratedWidget w, | 111 gfx::AcceleratedWidget w, |
102 const gfx::Rect& bounds) = 0; | 112 const gfx::Rect& bounds) = 0; |
103 | 113 |
104 // Called after the appropriate GL swap buffers command. Used if extra work | 114 // Called after the appropriate GL swap buffers command. Used if extra work |
105 // is needed to perform the actual buffer swap. | 115 // is needed to perform the actual buffer swap. |
(...skipping 22 matching lines...) Expand all Loading... |
128 // Create a default SufaceFactoryOzone implementation useful for tests. | 138 // Create a default SufaceFactoryOzone implementation useful for tests. |
129 static SurfaceFactoryOzone* CreateTestHelper(); | 139 static SurfaceFactoryOzone* CreateTestHelper(); |
130 | 140 |
131 private: | 141 private: |
132 static SurfaceFactoryOzone* impl_; // not owned | 142 static SurfaceFactoryOzone* impl_; // not owned |
133 }; | 143 }; |
134 | 144 |
135 } // namespace gfx | 145 } // namespace gfx |
136 | 146 |
137 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 147 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
OLD | NEW |