From: jiyong.min Date: Sun, 3 May 2020 22:23:57 +0000 (+0900) Subject: Unify rotate type enum X-Git-Tag: submit/tizen/20200506.063025^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50753e9444348d11b09871eb294a1eb5c9e5d9f7;p=platform%2Fcore%2Fmultimedia%2Fdcm-service.git Unify rotate type enum Change-Id: I1d186ea40c90cb449b9f4af6dc93a4678007dc87 --- diff --git a/libdcm-util/dcm_image_codec.c b/libdcm-util/dcm_image_codec.c index ab2f8ea..9fd7bb8 100755 --- a/libdcm-util/dcm_image_codec.c +++ b/libdcm-util/dcm_image_codec.c @@ -67,7 +67,7 @@ int dcm_decode_image(const char *file_path, const int orientation, const gboolea unsigned int resized_width = 0; unsigned int resized_height = 0; mm_util_img_codec_type type = IMG_CODEC_UNKNOWN_TYPE; - mm_util_magick_rotate_type angle = MM_UTIL_ROTATE_NUM; + mm_util_rotate_type_e rotation = MM_UTIL_ROTATE_NUM; mm_util_image_h resize_dst_handle = NULL; mm_util_image_h dst_handle = NULL; mm_util_color_format_e format = MM_UTIL_COLOR_NUM; @@ -76,20 +76,28 @@ int dcm_decode_image(const char *file_path, const int orientation, const gboolea DCM_CHECK_VAL(file_path, MS_MEDIA_ERR_INVALID_PARAMETER); - if (orientation == NOT_AVAILABLE || orientation == NORMAL) - angle = MM_UTIL_ROTATE_0; - else if (orientation == ROT_90) - angle = MM_UTIL_ROTATE_90; - else if (orientation == ROT_180) - angle = MM_UTIL_ROTATE_180; - else if (orientation == ROT_270) - angle = MM_UTIL_ROTATE_270; - else if (orientation == HFLIP) - angle = MM_UTIL_ROTATE_FLIP_HORZ; - else if (orientation == VFLIP) - angle = MM_UTIL_ROTATE_FLIP_VERT; - else { - dcm_error("Not supported angle [%d]", orientation); + switch(orientation) { + case NOT_AVAILABLE: + case NORMAL: + rotation = MM_UTIL_ROTATE_0; + break; + case ROT_90: + rotation = MM_UTIL_ROTATE_90; + break; + case ROT_180: + rotation = MM_UTIL_ROTATE_180; + break; + case ROT_270: + rotation = MM_UTIL_ROTATE_270; + break; + case HFLIP: + rotation = MM_UTIL_ROTATE_FLIP_HORZ; + break; + case VFLIP: + rotation = MM_UTIL_ROTATE_FLIP_VERT; + break; + default: + dcm_error("Not supported rotation [%d]", orientation); return MS_MEDIA_ERR_INTERNAL; } @@ -108,14 +116,14 @@ int dcm_decode_image(const char *file_path, const int orientation, const gboolea goto ERROR; } - ret = mm_util_rotate_B_B(resize_dst_handle, angle, &dst_handle); + ret = mm_util_rotate_B_B(resize_dst_handle, rotation, &dst_handle); if (ret != MM_UTIL_ERROR_NONE) { dcm_error("Failed to rotate image!err: %d", ret); ret = MS_MEDIA_ERR_INTERNAL; goto ERROR; } } else { - ret = mm_util_rotate_P_B(file_path, angle, MM_UTIL_COLOR_RGBA, &dst_handle); + ret = mm_util_rotate_P_B(file_path, rotation, MM_UTIL_COLOR_RGBA, &dst_handle); if (ret != MM_UTIL_ERROR_NONE) { dcm_error("Failed to rotate image buffer! err: %d", ret); ret = MS_MEDIA_ERR_INTERNAL; @@ -123,7 +131,7 @@ int dcm_decode_image(const char *file_path, const int orientation, const gboolea } } } else { - ret = mm_util_rotate_P_B(file_path, angle, MM_UTIL_COLOR_RGBA, &dst_handle); + ret = mm_util_rotate_P_B(file_path, rotation, MM_UTIL_COLOR_RGBA, &dst_handle); if (ret != MM_UTIL_ERROR_NONE) { dcm_error("Failed to rotate image buffer! err: %d", ret); ret = MS_MEDIA_ERR_INTERNAL; @@ -135,10 +143,8 @@ int dcm_decode_image(const char *file_path, const int orientation, const gboolea ERROR: - if (resize_dst_handle) - mm_image_destroy_image(resize_dst_handle); - if (dst_handle) - mm_image_destroy_image(dst_handle); + mm_image_destroy_image(resize_dst_handle); + mm_image_destroy_image(dst_handle); dcm_debug_fleave();