Chromium Code Reviews| Index: chromecast/public/cast_egl_platform.h |
| diff --git a/chromecast/public/cast_egl_platform.h b/chromecast/public/cast_egl_platform.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f9ed35ae8e6e08735f65796e7469951b22d7ed81 |
| --- /dev/null |
| +++ b/chromecast/public/cast_egl_platform.h |
| @@ -0,0 +1,72 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROMECAST_PUBLIC_CAST_EGL_PLATFORM_H_ |
| +#define CHROMECAST_PUBLIC_CAST_EGL_PLATFORM_H_ |
| + |
| +namespace chromecast { |
| + |
| +// Interface representing all the hardware-specific elements of an Ozone |
| +// implementation for Cast. Supply an implementation of this interface |
| +// to OzonePlatformCast to create a complete Ozone implementation. |
| +class CastEglPlatform { |
| + public: |
| + |
| + // 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.
|
| + struct Size { |
| + Size(int w, int h) |
| + : width(w), |
| + height(h) {} |
| + const int width; |
| + const int height; |
| + }; |
| + |
| + virtual ~CastEglPlatform() {} |
| + |
| + // Default display size is used for initial display and also as a minimum |
| + // resolution for applications. |
| + virtual Size GetDefaultDisplaySize() const = 0; |
| + |
| + // Returns an array of EGL properties, which can be used in any EGL function |
| + // used to select a display configuration. Note that all properties should be |
| + // immediately followed by the corresponding desired value and array should be |
| + // terminated with EGL_NONE. Ownership of the array is not transferred to |
| + // caller. desired_list contains list of desired EGL properties and values. |
| + virtual const int* GetEGLSurfaceProperties(const int* desired_list) = 0; |
| + |
| + // Initialize/ShutdownHardware are called at most once each over the object's |
| + // lifetime. Initialize will be called before creating display type or |
| + // window. If Initialize fails, return false (Shutdown will still be called). |
| + virtual bool InitializeHardware() = 0; |
| + virtual void ShutdownHardware() = 0; |
| + |
| + // These three are called once after hardware is successfully initialized. |
| + // The implementation must load the libraries containing EGL and GLES2 |
| + // bindings (return the pointer obtained from dlopen). It must also supply |
| + // a function pointer to eglGetProcAddress or equivalent. |
| + virtual void* GetEglLibrary() = 0; |
| + virtual void* GetGles2Library() = 0; |
| + |
| + 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.
|
| + virtual GLGetProcAddressProc GetGLProcAddressProc() = 0; |
| + |
| + // Creates/destroys an EGLNativeDisplayType. These may be called multiple |
| + // times over the object's lifetime, for example to release the display when |
| + // switching to an external application. There will be at most one display |
| + // type at a time. |
| + typedef void* NativeDisplayType; |
|
byungchul
2015/04/04 02:54:37
ditto
halliwell
2015/04/06 14:32:42
Done.
|
| + virtual NativeDisplayType CreateDisplayType(const Size& size) = 0; |
| + virtual void DestroyDisplayType(NativeDisplayType display_type) = 0; |
| + |
| + // Creates/destroys an EGLNativeWindow. There will be at most one window at a |
| + // time, created within a valid display type. |
| + typedef void* NativeWindowType; |
|
byungchul
2015/04/04 02:54:37
ditto
halliwell
2015/04/06 14:32:42
Done.
|
| + virtual NativeWindowType CreateWindow(NativeDisplayType display_type, |
| + const Size& size) = 0; |
| + virtual void DestroyWindow(NativeWindowType window) = 0; |
| +}; |
| + |
| +} // namespace chromecast |
| + |
| +#endif // CHROMECAST_PUBLIC_CAST_EGL_PLATFORM_H_ |