From 60f7df9c95ea1f9d4b8dabbbb7b5712c02b7a36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=93=92?= Date: Wed, 3 Apr 2024 08:59:12 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Enativewindow=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘瓒 Change-Id: I9ba1af5787c61ae691b4f16c2cbaba58235d03d6 --- .../graphic_2d/native_buffer/native_buffer.h | 19 ++++++++ .../native_window/external_window.h | 43 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index 7c15af5f0..6b8fc94d1 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -58,6 +58,10 @@ enum OH_NativeBuffer_Usage { NATIVEBUFFER_USAGE_CPU_READ = (1ULL << 0), /// < CPU read buffer */ NATIVEBUFFER_USAGE_CPU_WRITE = (1ULL << 1), /// < CPU write memory */ NATIVEBUFFER_USAGE_MEM_DMA = (1ULL << 3), /// < Direct memory access (DMA) buffer */ + NATIVEBUFFER_USAGE_HW_RENDER = (1ULL << 8), /// < For GPU write case */ + NATIVEBUFFER_USAGE_HW_TEXTURE = (1ULL << 9), /// < For GPU read case */ + NATIVEBUFFER_USAGE_CPU_READ_OFTEN = (1ULL << 16), /// < Often be mapped for direct CPU reads */ + NATIVEBUFFER_USAGE_ALIGNMENT_512 = (1ULL << 18), /// < 512 bytes alignment */ }; /** @@ -171,6 +175,21 @@ enum OH_NativeBuffer_Format { * @since 12 */ NATIVEBUFFER_PIXEL_FMT_RGBA_1010102, + /** + * YCBCR420 semi-planar 10bit packed format + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_P010, + /** + * YCRCB420 semi-planar 10bit packed format + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCB_P010, + /** + * Raw 10bit packed format + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_RAW10, /** * vender mask format * @since 12 diff --git a/graphic/graphic_2d/native_window/external_window.h b/graphic/graphic_2d/native_window/external_window.h index 66db08561..018197682 100644 --- a/graphic/graphic_2d/native_window/external_window.h +++ b/graphic/graphic_2d/native_window/external_window.h @@ -229,6 +229,37 @@ typedef enum { OH_SCALING_MODE_NO_SCALE_CROP, } OHScalingMode; +/** + * @brief Indicates Scaling Mode. + * @since 12 + */ +typedef enum { + /** + * the window content is not updated until a buffer of + * the window size is received + */ + OH_SCALING_MODE_FREEZE_V2 = 0, + /** + * the buffer is scaled in two dimensions to match the window size + */ + OH_SCALING_MODE_SCALE_TO_WINDOW_V2, + /** + * the buffer is uniformly scaled so that the smaller size of + * the buffer matches the window size + */ + OH_SCALING_MODE_SCALE_CROP_V2, + /** + * the window is clipped to the size of the buffer's clipping rectangle + * pixels outside the clipping rectangle are considered fully transparent. + */ + OH_SCALING_MODE_NO_SCALE_CROP_V2, + /** + * Adapt to the buffer and scale proportionally to the buffer size. Prioritize displaying all buffer content. + * If the size is not the same as the window size, fill the unfilled area of the window with a background color. + */ + OH_SCALING_MODE_SCALE_FIT_V2, +} OHScalingModeV2; + /** * @brief Enumerates the HDR metadata keys. * @since 9 @@ -550,6 +581,18 @@ int32_t OH_NativeWindow_GetSurfaceId(OHNativeWindow *window, uint64_t *surfaceId * @version 1.0 */ int32_t OH_NativeWindow_CreateNativeWindowFromSurfaceId(uint64_t surfaceId, OHNativeWindow **window); + +/** + * @brief Sets scalingMode of a native window. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window indicates the pointer to an OHNativeWindow instance. + * @param scalingMode Indicates the enum value to OHScalingModeV2 + * @return Returns an error code, 0 is Success, otherwise, failed. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_NativeWindowSetScalingMode(OHNativeWindow *window, OHScalingModeV2 scalingMode); #ifdef __cplusplus } #endif -- Gitee