Apply new mm_util_crop_image() 64/170364/1
authorhj kim <backto.kim@samsung.com>
Mon, 19 Feb 2018 10:12:20 +0000 (19:12 +0900)
committerhj kim <backto.kim@samsung.com>
Mon, 19 Feb 2018 10:12:20 +0000 (19:12 +0900)
Change-Id: I094f22e9c8a35c416e7587778fbc39654a78cf00

packaging/capi-media-image-util.spec
src/image_util_internal.c

index c761767cbb04dde6336740ffcf9b331defb881a6..1c31cbcfc0da00217f13370a7e5115bf7ce74c1c 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-image-util
 Summary:    A Image Utility library in Tizen Native API
-Version:    0.1.32
+Version:    0.1.33
 Release:    2
 Group:      Multimedia/API
 License:    Apache-2.0
index afdd779b405ec0b83407e5085554bb9ed1da355d..771574ac8ed446fbd46375fbd7442964b14535a8 100755 (executable)
@@ -79,6 +79,10 @@ int image_util_rotate(unsigned char *dest, int *dest_width, int *dest_height, im
 int image_util_crop(unsigned char *dest, int x, int y, int *width, int *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");
@@ -86,13 +90,11 @@ int image_util_crop(unsigned char *dest, int x, int y, int *width, int *height,
        image_util_retvm_if((width == NULL || height == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "width or height is null");
        image_util_retvm_if((src_width <= x || src_height <= y || src_width < x + *width || src_height < y + *height), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid crop area");
 
-       unsigned int dest_w, dest_h;
-       dest_w = *width;
-       dest_h = *height;
-       err = mm_util_crop_image(src, src_width, src_height, TYPECAST_COLOR(colorspace), x, y, &dest_w, &dest_h, dest);
+       err = mm_util_crop_image(src, src_width, src_height, TYPECAST_COLOR(colorspace), x, y, *width, *height, &res_buffer, &res_w, &res_h, &res_buffer_size);
        if (err == MM_UTIL_ERROR_NONE) {
-               *width = (int)dest_w;
-               *height = (int)dest_h;
+               memcpy(dest, res_buffer, res_buffer_size);
+               *width = (int)res_w;
+               *height = (int)res_h;
        }
 
        return _image_error_capi(ERR_TYPE_TRANSFORM, err);