| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ | |
| 6 #define UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "ui/gfx/overlay_transform.h" | |
| 12 #include "ui/gfx/swap_result.h" | |
| 13 #include "ui/ozone/ozone_base_export.h" | |
| 14 | |
| 15 namespace gfx { | |
| 16 class Size; | |
| 17 class VSyncProvider; | |
| 18 } | |
| 19 | |
| 20 namespace ui { | |
| 21 class NativePixmap; | |
| 22 | |
| 23 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback; | |
| 24 | |
| 25 // Holds callbacks to functions for configuring EGL on platform. | |
| 26 struct OZONE_BASE_EXPORT EglConfigCallbacks { | |
| 27 EglConfigCallbacks(); | |
| 28 EglConfigCallbacks(const EglConfigCallbacks& other); | |
| 29 ~EglConfigCallbacks(); | |
| 30 base::Callback<bool(const int32_t* attribs, | |
| 31 void** /* EGLConfig* */ configs, | |
| 32 int32_t config_size, | |
| 33 int32_t* num_configs)> | |
| 34 choose_config; | |
| 35 base::Callback< | |
| 36 bool(void* /* EGLConfig */ config, int32_t attribute, int32_t* value)> | |
| 37 get_config_attribute; | |
| 38 base::Callback<const char*()> get_last_error_string; | |
| 39 }; | |
| 40 | |
| 41 // The platform-specific part of an EGL surface. | |
| 42 // | |
| 43 // This class owns any bits that the ozone implementation needs freed when | |
| 44 // the EGL surface is destroyed. | |
| 45 class OZONE_BASE_EXPORT SurfaceOzoneEGL { | |
| 46 public: | |
| 47 virtual ~SurfaceOzoneEGL() {} | |
| 48 | |
| 49 // Returns the EGL native window for rendering onto this surface. | |
| 50 // This can be used to to create a GLSurface. | |
| 51 virtual intptr_t /* EGLNativeWindowType */ GetNativeWindow() = 0; | |
| 52 | |
| 53 // Attempts to resize the EGL native window to match the viewport | |
| 54 // size. | |
| 55 virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) = 0; | |
| 56 | |
| 57 // Called after we swap buffers. This is usually a no-op but can | |
| 58 // be used to present the new front buffer if the platform requires this. | |
| 59 virtual bool OnSwapBuffers() = 0; | |
| 60 | |
| 61 // Called after we swap buffers. This is usually a no-op but can | |
| 62 // be used to present the new front buffer if the platform requires this. | |
| 63 // The callback should be run on the calling thread | |
| 64 // (i.e. same thread SwapBuffersAsync is called). | |
| 65 virtual void OnSwapBuffersAsync(const SwapCompletionCallback& callback) = 0; | |
| 66 | |
| 67 // Returns a gfx::VsyncProvider for this surface. Note that this may be | |
| 68 // called after we have entered the sandbox so if there are operations (e.g. | |
| 69 // opening a file descriptor providing vsync events) that must be done | |
| 70 // outside of the sandbox, they must have been completed in | |
| 71 // InitializeHardware. Returns an empty scoped_ptr on error. | |
| 72 virtual std::unique_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0; | |
| 73 | |
| 74 // Returns true if the surface is created on a UDL device. | |
| 75 virtual bool IsUniversalDisplayLinkDevice(); | |
| 76 | |
| 77 // Returns the EGL configuration to use for this surface. The default EGL | |
| 78 // configuration will be used if this returns nullptr. | |
| 79 virtual void* /* EGLConfig */ GetEGLSurfaceConfig( | |
| 80 const EglConfigCallbacks& egl) = 0; | |
| 81 }; | |
| 82 | |
| 83 } // namespace ui | |
| 84 | |
| 85 #endif // UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ | |
| OLD | NEW |