From dd29c2f9ee2e5d1ed87eaec6aa20cb11ab9d92f8 Mon Sep 17 00:00:00 2001 From: Jiyong Min Date: Tue, 6 Mar 2018 08:17:59 +0900 Subject: [PATCH] Code refactoring change png parameters Change-Id: I0650f40ec79b377d4cb4f85bb8fc615b48e46776 Signed-off-by: Jiyong Min --- src/image_util_encode.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/image_util_encode.c b/src/image_util_encode.c index 5c6332a..0717d07 100755 --- a/src/image_util_encode.c +++ b/src/image_util_encode.c @@ -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; -- 2.34.1