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;
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;
}
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;
}
}
} 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;
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();