From f35bcc4d22ea182830e1edf3174eeee24c09cb35 Mon Sep 17 00:00:00 2001 From: hj kim Date: Mon, 22 Oct 2018 13:38:47 +0900 Subject: [PATCH] Remove _image_util_check_resolution() API. check parameters directly Change-Id: Id590cef6dd0a89d78c8884775b812f011bf20285 --- include/image_util_private.h | 1 - src/image_util.c | 5 ++--- src/image_util_encode.c | 2 +- src/image_util_private.c | 15 --------------- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/include/image_util_private.h b/include/image_util_private.h index 8610ef3..4c1a433 100755 --- a/include/image_util_private.h +++ b/include/image_util_private.h @@ -185,7 +185,6 @@ unsigned int get_number_of_colorspace(void); int convert_type_of_colorspace(const image_util_colorspace_e colorspace); int convert_type_of_colorspace_with_image_type(const image_util_colorspace_e colorspace, const image_util_type_e type); int _image_error_capi(int error_code); -bool _image_util_check_resolution(int width, int height); /** * @} diff --git a/src/image_util.c b/src/image_util.c index 510f251..b1befe1 100755 --- a/src/image_util.c +++ b/src/image_util.c @@ -522,7 +522,7 @@ int image_util_transform_set_resolution(transformation_h handle, unsigned int wi image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); image_util_retvm_if((_handle->set_crop), IMAGE_UTIL_ERROR_INVALID_OPERATION, "Crop and Resize can't do at the same time"); - image_util_retvm_if((_image_util_check_resolution(width, height) == false), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution"); + image_util_retvm_if((width == 0 || height == 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution w : [%d] h : [%d]", width, height); _handle->dst_width = width; _handle->dst_height = height; @@ -558,8 +558,7 @@ int image_util_transform_set_crop_area(transformation_h handle, unsigned int sta dest_height = end_y - start_y; image_util_debug("Set crop_info x[%d] y[%d] w[%d] h[%d]", start_x, start_y, dest_width, dest_height); - - image_util_retvm_if((_image_util_check_resolution(dest_width, dest_height) == false), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid dest resolution"); + image_util_retvm_if((dest_width <= 0 || dest_height <= 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution w : [%d] h : [%d]", dest_width, dest_height); _handle->start_x = start_x; _handle->start_y = start_y; diff --git a/src/image_util_encode.c b/src/image_util_encode.c index 98cb644..168c266 100755 --- a/src/image_util_encode.c +++ b/src/image_util_encode.c @@ -115,7 +115,7 @@ int image_util_encode_set_resolution(image_util_encode_h handle, unsigned long w encode_s *_handle = (encode_s *) handle; image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle"); - image_util_retvm_if((width == 0 || height == 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution"); + image_util_retvm_if((width == 0 || height == 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution w : [%d] h : [%d]", width, height); /* multi-src for a-gif */ if (_handle->image_type == IMAGE_UTIL_GIF) { diff --git a/src/image_util_private.c b/src/image_util_private.c index dba91d4..efcc59a 100755 --- a/src/image_util_private.c +++ b/src/image_util_private.c @@ -216,18 +216,3 @@ int _image_error_capi(int error_code) return IMAGE_UTIL_ERROR_INVALID_OPERATION; } - -bool _image_util_check_resolution(int width, int height) -{ - if (width <= 0) { - image_util_error("invalid width [%d]", width); - return false; - } - - if (height <= 0) { - image_util_error("invalid height [%d]", height); - return false; - } - - return true; -} -- 2.7.4