| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 CHROMECAST_OZONE_CAST_EGL_PLATFORM_H_ | |
| 6 #define CHROMECAST_OZONE_CAST_EGL_PLATFORM_H_ | |
| 7 | |
| 8 #include "ui/ozone/public/surface_factory_ozone.h" | |
| 9 | |
| 10 namespace gfx { | |
| 11 class Size; | |
| 12 } | |
| 13 | |
| 14 namespace chromecast { | |
| 15 namespace ozone { | |
| 16 | |
| 17 // Interface representing all the hardware-specific elements of an Ozone | |
| 18 // implementation for Cast. Supply an implementation of this interface | |
| 19 // to OzonePlatformCast to create a complete Ozone implementation. | |
| 20 class CastEglPlatform { | |
| 21 public: | |
| 22 typedef ui::SurfaceFactoryOzone::AddGLLibraryCallback AddGLLibraryCallback; | |
| 23 typedef ui::SurfaceFactoryOzone::SetGLGetProcAddressProcCallback | |
| 24 SetGLGetProcAddressProcCallback; | |
| 25 | |
| 26 virtual ~CastEglPlatform() {} | |
| 27 | |
| 28 // Default display size is used for initial display and also as a minimum | |
| 29 // resolution for applications. | |
| 30 virtual gfx::Size GetDefaultDisplaySize() const = 0; | |
| 31 | |
| 32 // Returns an array of EGL properties, which can be used in any EGL function | |
| 33 // used to select a display configuration. Note that all properties should be | |
| 34 // immediately followed by the corresponding desired value and array should be | |
| 35 // terminated with EGL_NONE. Ownership of the array is not transferred to | |
| 36 // caller. desired_list contains list of desired EGL properties and values. | |
| 37 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list) = 0; | |
| 38 | |
| 39 // Initialize/ShutdownHardware are called at most once each over the object's | |
| 40 // lifetime. Initialize will be called before creating display type or | |
| 41 // window. If Initialize fails, return false (Shutdown will still be called). | |
| 42 virtual bool InitializeHardware() = 0; | |
| 43 virtual void ShutdownHardware() = 0; | |
| 44 | |
| 45 // Called once after hardware successfully initialized. Implementation needs | |
| 46 // to add the EGL and GLES2 libraries through add_gl_library and also supply | |
| 47 // a pointer to eglGetProcAddress (or equivalent function). | |
| 48 virtual bool LoadEGLGLES2Bindings( | |
| 49 AddGLLibraryCallback add_gl_library, | |
| 50 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0; | |
| 51 | |
| 52 // Create/destroy an EGLNativeDisplayType. These may be called multiple times | |
| 53 // over the object's lifetime, for example to release the display when | |
| 54 // switching to an external application. There will be at most one display | |
| 55 // type at a time. | |
| 56 virtual intptr_t CreateDisplayType(const gfx::Size& size) = 0; | |
| 57 virtual void DestroyDisplayType(intptr_t display_type) = 0; | |
| 58 | |
| 59 // Create/destroy an EGLNativeWindow. There will be at most one window at a | |
| 60 // time, created within a valid display type. | |
| 61 virtual intptr_t CreateWindow(intptr_t display_type, | |
| 62 const gfx::Size& size) = 0; | |
| 63 virtual void DestroyWindow(intptr_t window) = 0; | |
| 64 }; | |
| 65 | |
| 66 } // namespace ozone | |
| 67 } // namespace chromecast | |
| 68 | |
| 69 #endif // CHROMECAST_OZONE_CAST_EGL_PLATFORM_H_ | |
| OLD | NEW |