Code refactoring change png parameters 63/171563/2 accepted/tizen/unified/20180307.071321 submit/tizen/20180305.053300
authorJiyong Min <jiyong.min@samsung.com>
Mon, 5 Mar 2018 23:17:59 +0000 (08:17 +0900)
committerhj kim <backto.kim@samsung.com>
Mon, 5 Mar 2018 23:20:04 +0000 (23:20 +0000)
Change-Id: I0650f40ec79b377d4cb4f85bb8fc615b48e46776
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
src/image_util_encode.c

index 5c6332a..0717d07 100755 (executable)
@@ -219,8 +219,8 @@ int image_util_encode_set_resolution(image_util_encode_h handle, unsigned long w
        case IMAGE_UTIL_BMP:
                {
                        mm_util_bmp_data *bmp_data = (mm_util_bmp_data *) _handle->image_h;
-                       mm_util_bmp_encode_set_width(bmp_data, width);
-                       mm_util_bmp_encode_set_height(bmp_data, height);
+                       bmp_data->width = width;
+                       bmp_data->height = height;
                }
                break;
        default:
@@ -403,16 +403,17 @@ static int _image_util_encode_internal(decode_encode_s * _handle)
        case IMAGE_UTIL_PNG:
                {
                        mm_util_png_data *png_data = (mm_util_png_data *) _handle->image_h;
+                       size_t size = 0;
+
+                       png_data->data = _handle->src_buffer[0];
 
                        if (_handle->path)
-                               err = mm_util_encode_to_png_file(&(_handle->src_buffer[0]), png_data, _handle->path, _handle->compression);
+                               err = mm_util_encode_to_png_file(png_data, _handle->compression, _handle->path);
                        else
-                               err = mm_util_encode_to_png_memory(&(_handle->src_buffer[0]), png_data, _handle->compression);
+                               err = mm_util_encode_to_png_memory(png_data, _handle->compression, _handle->dst_buffer, &size);
 
                        if (err == MM_UTIL_ERROR_NONE) {
-                               if (_handle->dst_buffer)
-                                       *(_handle->dst_buffer) = png_data->data;
-                               _handle->dst_size = png_data->size;
+                               _handle->dst_size = size;
                                _handle->width = png_data->width;
                                _handle->height = png_data->height;
                        }
@@ -457,15 +458,13 @@ static int _image_util_encode_internal(decode_encode_s * _handle)
                                err = mm_util_encode_bmp_to_file(bmp_data, _handle->path);
                        } else {
                                size_t size = 0;
-                               err = mm_util_encode_bmp_to_memory(bmp_data, &(bmp_data->data), &size);
+                               err = mm_util_encode_bmp_to_memory(bmp_data, _handle->dst_buffer, &size);
                                if (err == MM_UTIL_ERROR_NONE)
                                        bmp_data->size = (unsigned long long)size;
                                else
                                        bmp_data->size = 0;
                        }
                        if (err == MM_UTIL_ERROR_NONE) {
-                               if (_handle->dst_buffer)
-                                       *(_handle->dst_buffer) = bmp_data->data;
                                _handle->dst_size = bmp_data->size;
                                _handle->width = bmp_data->width;
                                _handle->height = bmp_data->height;