From 870d534b6e1ebefe3745e00d906c5a2a44d6baf2 Mon Sep 17 00:00:00 2001 From: xuweinan Date: Sat, 16 Dec 2023 18:35:08 +0800 Subject: [PATCH] Description:XComponent add rate interface Feature or Bugfix:Feature Signed-off-by: xuweinan --- arkui/ace_engine/native/libace.ndk.json | 12 +++++ .../native/native_interface_xcomponent.h | 49 +++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index bcc196abd..c8af1edc1 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -78,5 +78,17 @@ { "first_introduced": "10", "name": "OH_NativeXComponent_GetHistoricalPoints" + }, + { + "first_introduced": "11", + "name": "OH_NativeXComponent_SetExpectedFrameRateRange" + }, + { + "first_introduced": "11", + "name": "OH_NativeXComponent_RegisterOnFrameCallback" + }, + { + "first_introduced": "11", + "name": "OH_NativeXComponent_UnregisterOnFrameCallback" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_interface_xcomponent.h b/arkui/ace_engine/native/native_interface_xcomponent.h index df44e8b4e..9c266f116 100644 --- a/arkui/ace_engine/native/native_interface_xcomponent.h +++ b/arkui/ace_engine/native/native_interface_xcomponent.h @@ -329,6 +329,21 @@ struct OH_NativeXComponent_KeyEvent; */ typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent; +/** + * @brief Defines the expected frame rate range struct. + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** The minimum frame rate of dynamical callback rate range. */ + int32_t min; + /** The maximum frame rate of dynamical callback rate range. */ + int32_t max; + /** The expected frame rate of dynamical callback rate range. */ + int32_t expected; +} OH_NativeXComponent_ExpectedRateRange; + /** * @brief Obtains the ID of the ArkUI XComponent. * @@ -575,6 +590,40 @@ int32_t OH_NativeXComponent_GetKeyEventDeviceId(OH_NativeXComponent_KeyEvent* ke */ int32_t OH_NativeXComponent_GetKeyEventTimestamp(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* timestamp); +/** + * @brief Set the Expected FrameRateRange. + * + * @param component Indicates the pointer to this OH_NativeXComponent instance. + * @param callback Indicates the pointer to a expected rate range. + * @return Returns the status code of the execution. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_SetExpectedFrameRateRange( + OH_NativeXComponent* component, OH_NativeXComponent_ExpectedRateRange* range); + +/** + * @brief Registers a callback for this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to this OH_NativeXComponent instance. + * @param callback Indicates the pointer to a onFrame callback. + * @return Returns the status code of the execution. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* component, + void (*callback)(OH_NativeXComponent* component, uint64_t timestamp, uint64_t targetTimestamp)); + +/** + * @brief UnRegister a callback for this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to this OH_NativeXComponent instance. + * @return Returns the status code of the execution. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* component); + #ifdef __cplusplus }; #endif -- Gitee