Apply new mm_util_resize_image() 32/170632/1
authorhj kim <backto.kim@samsung.com>
Wed, 21 Feb 2018 06:00:31 +0000 (15:00 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 21 Feb 2018 06:00:31 +0000 (15:00 +0900)
Change-Id: I129fb30f376f1410fa119a893d94a4d848a52b2f

src/image_util_internal.c

index 0591bad..cfd75da 100755 (executable)
@@ -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);