-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial support for OpenHarmony (#293)
* Rename platform/android to platform/egl * Add initial support for OpenHarmony * Add `-ohos` build to CI * Fix surfman/mod.rs comment * Add Safety documentation to OH_NativeWindow_NativeWindowHandleOpt * Make couple minor rustdoc adjustments --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
- Loading branch information
Showing
17 changed files
with
536 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
surfman/src/platform/android/ffi.rs → surfman/src/platform/egl/android_ffi.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
surfman/src/platform/android/device.rs → surfman/src/platform/egl/device.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#![allow(non_camel_case_types)] | ||
#![allow(non_upper_case_globals)] | ||
#![allow(non_snake_case)] | ||
#![allow(unused)] | ||
|
||
#[repr(C)] | ||
pub struct NativeWindow { | ||
_unused: [u8; 0], | ||
} | ||
|
||
pub type OHNativeWindow = NativeWindow; | ||
|
||
#[repr(transparent)] | ||
pub(crate) struct NativeWindowOperation(core::ffi::c_int); | ||
|
||
impl NativeWindowOperation { | ||
pub const GET_BUFFER_GEOMETRY: Self = Self(1); | ||
} | ||
|
||
/// According to the [native window guidelines], users need to link against | ||
/// both the NDK and `native_window`. | ||
/// [native window guidelines]: <https://gitee.com/openharmony/docs/blob/master/en/application-dev/graphics/native-window-guidelines.md> | ||
#[link(name = "native_window")] | ||
#[link(name = "ace_ndk.z")] | ||
extern "C" { | ||
/// Sets or obtains the attributes of a native window | ||
/// | ||
/// Can be used to query information like height and width. | ||
/// See the official [Documentation] for detailed usage information. | ||
/// | ||
/// # Safety | ||
/// | ||
/// - The `window` handle must be valid. | ||
/// - The variable arguments which must be passed to this function vary depending on the | ||
/// value of `code`. | ||
/// - For `NativeWindowOperation::GET_BUFFER_GEOMETRY` the function takes two output | ||
/// i32 pointers, `height: *mut i32` and `width: *mut i32` which are passed as variadic | ||
/// arguments. | ||
/// | ||
/// | ||
/// [Documentation]: <https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-arkgraphics2d/_native_window.md> | ||
pub(crate) fn OH_NativeWindow_NativeWindowHandleOpt( | ||
window: *mut OHNativeWindow, | ||
code: NativeWindowOperation, | ||
... | ||
) -> i32; | ||
} |
Oops, something went wrong.