!1090 新增native vsync NDK接口,支持多次回调

Merge pull request !1090 from shegangbin/add_native_vsync_ndk
This commit is contained in:
openharmony_ci 2024-08-03 08:08:02 +00:00 committed by Gitee
commit 1e552808b4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 24 additions and 2 deletions

View File

@ -2,5 +2,6 @@
{ "name": "OH_NativeVSync_Create" },
{ "name": "OH_NativeVSync_Destroy" },
{ "name": "OH_NativeVSync_RequestFrame" },
{ "name": "OH_NativeVSync_RequestFrameWithMultiCallback" },
{ "name": "OH_NativeVSync_GetPeriod" }
]

View File

@ -65,7 +65,6 @@ OH_NativeVSync* OH_NativeVSync_Create(const char* name, unsigned int length);
*
* @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
*/
@ -73,17 +72,37 @@ void OH_NativeVSync_Destroy(OH_NativeVSync* 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
*/
int OH_NativeVSync_RequestFrame(OH_NativeVSync* nativeVsync, OH_NativeVSync_FrameCallback callback, void* data);
/**
* @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
*/
int OH_NativeVSync_RequestFrameWithMultiCallback(
OH_NativeVSync* nativeVsync, OH_NativeVSync_FrameCallback callback, void* data);
/**
* @brief Get vsync period.
*

View File

@ -80,6 +80,8 @@ typedef enum OHNativeErrorCode {
NATIVE_ERROR_UNSUPPORTED = 50102000,
/** @error unknown error, please check log */
NATIVE_ERROR_UNKNOWN = 50002000,
/** @error ipc send failed */
NATIVE_ERROR_BINDER_ERROR = 50401000,
/** @error the egl environment is abnormal */
NATIVE_ERROR_EGL_STATE_UNKNOWN = 60001000,
/** @error egl interface invocation failed */