diff --git a/graphic/graphic_2d/native_image/libnative_image.ndk.json b/graphic/graphic_2d/native_image/libnative_image.ndk.json index 1b40db3aafe575c466ec47ad9d4c2a83a71e8e2d..0a09bba188067f7d55a6428f842f4330a4cb92d6 100644 --- a/graphic/graphic_2d/native_image/libnative_image.ndk.json +++ b/graphic/graphic_2d/native_image/libnative_image.ndk.json @@ -34,5 +34,9 @@ { "first_introduced": "13", "name": "OH_ConsumerSurface_SetDefaultSize" + }, + { + "first_introduced": "17", + "name": "OH_NativeImage_SetDropBufferMode" } ] \ No newline at end of file diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index 9ad3ebbd74ba203e5e19e9c5f94acb83c1ddcbca..72dc7d2f6c4d7d5ee654beb8f09e7ec04f5df6f0 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -350,6 +350,25 @@ int32_t OH_ConsumerSurface_SetDefaultUsage(OH_NativeImage* image, uint64_t usage * @version 1.0 */ int32_t OH_ConsumerSurface_SetDefaultSize(OH_NativeImage* image, int32_t width, int32_t height); + +/** + * @brief Set the rendering in drop buffer mode of the OH_NativeImage.\n + * In this mode, most of the buffers produced by the producer will be discarded, + * and the latest buffer will be selected for rending.\n + * This mode can not simultaneously guarantee high frame rate requirements.\n + * This interface suggest be called after the OH_NativeImage_Create call immediately.\n + * This interface will only take effect when used together with the OH_NativeImage_UpdateSurfaceImage.\n + * This interface is a non-thread-safe type interface.\n + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param image Indicates the pointer to a OH_NativeImage instance. + * @param isOpen Indicates the switch of drop buffer mode. + * @return {@link NATIVE_ERROR_OK} 0 - Success. + * {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image is NULL. + * @since 17 + * @version 1.0 + */ +int32_t OH_NativeImage_SetDropBufferMode(OH_NativeImage* image, bool isOpen); #ifdef __cplusplus } #endif