From abd86b4c674f3aea538ee7acba11248eac5ccc7f Mon Sep 17 00:00:00 2001 From: xuweinan Date: Mon, 4 Dec 2023 14:53:34 +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 | 50 +++++++++++++++++++ 2 files changed, 62 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 fbc9a7f71..8df6a8398 100644 --- a/arkui/ace_engine/native/native_interface_xcomponent.h +++ b/arkui/ace_engine/native/native_interface_xcomponent.h @@ -327,6 +327,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. * @@ -573,6 +588,41 @@ 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