From 551b1559b1f25e174df0c97d9271e6ba153933ed Mon Sep 17 00:00:00 2001 From: hj kim Date: Tue, 20 Feb 2018 15:17:41 +0900 Subject: [PATCH] Apply new mm_util_resize_image() Change-Id: Ib4a27a6aeb0430c61b7acb185ba405633da46906 --- src/image_util_internal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/image_util_internal.c b/src/image_util_internal.c index 771574a..3c86e8d 100755 --- a/src/image_util_internal.c +++ b/src/image_util_internal.c @@ -38,6 +38,10 @@ int image_util_convert_colorspace(unsigned char *dest, image_util_colorspace_e d int image_util_resize(unsigned char *dest, int *dest_width, int *dest_height, const unsigned char *src, int src_width, int src_height, image_util_colorspace_e colorspace) { int err = MM_UTIL_ERROR_NONE; + unsigned int res_w = 0; + unsigned int res_h = 0; + unsigned char *res_buffer = NULL; + size_t res_buffer_size = 0; image_util_retvm_if((dest == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "dest is null"); image_util_retvm_if((src == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "src is null"); @@ -45,13 +49,11 @@ int image_util_resize(unsigned char *dest, int *dest_width, int *dest_height, co image_util_retvm_if((dest_width == NULL || dest_height == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "dest_width or dest_height is null"); image_util_retvm_if((*dest_width <= 0 || *dest_height <= 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid dest_width or Invalid dest_height"); - unsigned int dest_w, dest_h; - dest_w = *dest_width; - dest_h = *dest_height; - err = mm_util_resize_image(src, src_width, src_height, TYPECAST_COLOR(colorspace), dest, &dest_w, &dest_h); + err = mm_util_resize_image(src, src_width, src_height, TYPECAST_COLOR(colorspace), *dest_width, dest_height, &res_buffer, &res_w, &res_h, &res_buffer_size); if (err == MM_UTIL_ERROR_NONE) { - *dest_width = (int)dest_w; - *dest_height = (int)dest_h; + memcpy(dest, res_buffer, res_buffer_size); + *dest_width = (int)res_w; + *dest_height = (int)res_h; } return _image_error_capi(ERR_TYPE_TRANSFORM, err); -- 2.7.4