Skip to content

Commit

Permalink
vsync: Update bindings to OH 5.0 release.
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
  • Loading branch information
jschwe committed Nov 7, 2024
1 parent 83d013b commit 00d9f4e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/vsync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ extern "C" {}

mod vsync_api10;
pub use vsync_api10::*;

#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
mod api12_additions;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub use api12_additions::*;
25 changes: 25 additions & 0 deletions src/vsync/api12_additions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

use crate::vsync::{OH_NativeVSync, OH_NativeVSync_FrameCallback};

extern "C" {
/** @brief Request next vsync with callback.
If this function is called multiple times in one vsync period, all these callbacks and dataset will be called.
@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
@param nativeVsync Indicates the pointer to a NativeVsync.
@param callback Indicates the OH_NativeVSync_FrameCallback which will be called when next vsync coming.
@param data Indicates data whick will be used in callback.
@return {@link NATIVE_ERROR_OK} 0 - Success.
{@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - the parameter nativeVsync is NULL or callback is NULL.
{@link NATIVE_ERROR_BINDER_ERROR} 50401000 - ipc send failed.
@since 12
@version 1.0*/
pub fn OH_NativeVSync_RequestFrameWithMultiCallback(
nativeVsync: *mut OH_NativeVSync,
callback: OH_NativeVSync_FrameCallback,
data: *mut ::core::ffi::c_void,
) -> ::core::ffi::c_int;
}
25 changes: 22 additions & 3 deletions src/vsync/vsync_api12.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.69.4 */
/* automatically generated by rust-bindgen 0.70.0 */

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
Expand Down Expand Up @@ -29,24 +29,43 @@ extern "C" {
@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
@param window Indicates the pointer to a <b>NativeVsync</b> instance.
@return Returns int32_t, return value == 0, success, otherwise, failed.
@since 9
@version 1.0*/
pub fn OH_NativeVSync_Destroy(nativeVsync: *mut OH_NativeVSync);
/** @brief Request next vsync with callback.
If you call this interface multiple times in one frame, it will only call the last callback.
@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
@param nativeVsync Indicates the pointer to a NativeVsync.
@param callback Indicates the OH_NativeVSync_FrameCallback which will be called when next vsync coming.
@param data Indicates data whick will be used in callback.
@return Returns int32_t, return value == 0, success, otherwise, failed.
@return {@link NATIVE_ERROR_OK} 0 - Success.
{@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - the parameter nativeVsync is NULL or callback is NULL.
{@link NATIVE_ERROR_BINDER_ERROR} 50401000 - ipc send failed.
@since 9
@version 1.0*/
pub fn OH_NativeVSync_RequestFrame(
nativeVsync: *mut OH_NativeVSync,
callback: OH_NativeVSync_FrameCallback,
data: *mut ::core::ffi::c_void,
) -> ::core::ffi::c_int;
/** @brief Request next vsync with callback.
If this function is called multiple times in one vsync period, all these callbacks and dataset will be called.
@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
@param nativeVsync Indicates the pointer to a NativeVsync.
@param callback Indicates the OH_NativeVSync_FrameCallback which will be called when next vsync coming.
@param data Indicates data whick will be used in callback.
@return {@link NATIVE_ERROR_OK} 0 - Success.
{@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - the parameter nativeVsync is NULL or callback is NULL.
{@link NATIVE_ERROR_BINDER_ERROR} 50401000 - ipc send failed.
@since 12
@version 1.0*/
pub fn OH_NativeVSync_RequestFrameWithMultiCallback(
nativeVsync: *mut OH_NativeVSync,
callback: OH_NativeVSync_FrameCallback,
data: *mut ::core::ffi::c_void,
) -> ::core::ffi::c_int;
/** @brief Get vsync period.
@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
Expand Down

0 comments on commit 00d9f4e

Please sign in to comment.