Chromium Code Reviews| 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_PUBLIC_CAST_EGL_PLATFORM_H_ | |
| 6 #define CHROMECAST_PUBLIC_CAST_EGL_PLATFORM_H_ | |
| 7 | |
| 8 namespace chromecast { | |
| 9 | |
| 10 // Interface representing all the hardware-specific elements of an Ozone | |
| 11 // implementation for Cast. Supply an implementation of this interface | |
| 12 // to OzonePlatformCast to create a complete Ozone implementation. | |
| 13 class CastEglPlatform { | |
| 14 public: | |
| 15 | |
| 16 // Avoiding Chromium types in shared library interfaces, so no gfx::Size. | |
|
byungchul
2015/04/04 02:54:38
This comment might not be useful for vendors.
halliwell
2015/04/06 14:32:42
yep, removed.
| |
| 17 struct Size { | |
| 18 Size(int w, int h) | |
| 19 : width(w), | |
| 20 height(h) {} | |
| 21 const int width; | |
| 22 const int height; | |
| 23 }; | |
| 24 | |
| 25 virtual ~CastEglPlatform() {} | |
| 26 | |
| 27 // Default display size is used for initial display and also as a minimum | |
| 28 // resolution for applications. | |
| 29 virtual Size GetDefaultDisplaySize() const = 0; | |
| 30 | |
| 31 // Returns an array of EGL properties, which can be used in any EGL function | |
| 32 // used to select a display configuration. Note that all properties should be | |
| 33 // immediately followed by the corresponding desired value and array should be | |
| 34 // terminated with EGL_NONE. Ownership of the array is not transferred to | |
| 35 // caller. desired_list contains list of desired EGL properties and values. | |
| 36 virtual const int* GetEGLSurfaceProperties(const int* desired_list) = 0; | |
| 37 | |
| 38 // Initialize/ShutdownHardware are called at most once each over the object's | |
| 39 // lifetime. Initialize will be called before creating display type or | |
| 40 // window. If Initialize fails, return false (Shutdown will still be called). | |
| 41 virtual bool InitializeHardware() = 0; | |
| 42 virtual void ShutdownHardware() = 0; | |
| 43 | |
| 44 // These three are called once after hardware is successfully initialized. | |
| 45 // The implementation must load the libraries containing EGL and GLES2 | |
| 46 // bindings (return the pointer obtained from dlopen). It must also supply | |
| 47 // a function pointer to eglGetProcAddress or equivalent. | |
| 48 virtual void* GetEglLibrary() = 0; | |
| 49 virtual void* GetGles2Library() = 0; | |
| 50 | |
| 51 typedef void* (*GLGetProcAddressProc)(const char* name); | |
|
byungchul
2015/04/04 02:54:38
You should move typedefs before dtor.
halliwell
2015/04/06 14:32:42
Done.
| |
| 52 virtual GLGetProcAddressProc GetGLProcAddressProc() = 0; | |
| 53 | |
| 54 // Creates/destroys an EGLNativeDisplayType. These may be called multiple | |
| 55 // times over the object's lifetime, for example to release the display when | |
| 56 // switching to an external application. There will be at most one display | |
| 57 // type at a time. | |
| 58 typedef void* NativeDisplayType; | |
|
byungchul
2015/04/04 02:54:37
ditto
halliwell
2015/04/06 14:32:42
Done.
| |
| 59 virtual NativeDisplayType CreateDisplayType(const Size& size) = 0; | |
| 60 virtual void DestroyDisplayType(NativeDisplayType display_type) = 0; | |
| 61 | |
| 62 // Creates/destroys an EGLNativeWindow. There will be at most one window at a | |
| 63 // time, created within a valid display type. | |
| 64 typedef void* NativeWindowType; | |
|
byungchul
2015/04/04 02:54:37
ditto
halliwell
2015/04/06 14:32:42
Done.
| |
| 65 virtual NativeWindowType CreateWindow(NativeDisplayType display_type, | |
| 66 const Size& size) = 0; | |
| 67 virtual void DestroyWindow(NativeWindowType window) = 0; | |
| 68 }; | |
| 69 | |
| 70 } // namespace chromecast | |
| 71 | |
| 72 #endif // CHROMECAST_PUBLIC_CAST_EGL_PLATFORM_H_ | |
| OLD | NEW |