return MM_UTIL_ERROR_NONE;
}
-static Image * __mm_util_constitute_image(mm_util_image_h handle, const char *map)
+static Image * __mm_util_constitute_image(mm_util_image_h handle)
{
+ int ret = MM_UTIL_ERROR_NONE;
mm_image_info_s *_handle = (mm_image_info_s*)handle;
+ char *map = NULL;
Image *_image = NULL;
ExceptionInfo exception;
mm_util_fenter();
- mm_util_retvm_if(handle == NULL, NULL, "invalid handle");
- mm_util_retvm_if(!MMUTIL_STRING_VALID(map), NULL, "invalid map");
+ mm_util_retvm_if(!handle, NULL, "invalid handle");
+
+ ret = __mm_util_get_map(_handle->color, &map);
+ mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, NULL, "fail to get map");
GetExceptionInfo(&exception);
}
DestroyExceptionInfo(&exception);
+ g_free(map);
mm_util_fleave();
{
int ret = MM_UTIL_ERROR_NONE;
mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
- char *map = NULL;
Image *_image = NULL;
Image *_processed_image = NULL;
ExceptionInfo exception;
- mm_util_retvm_if(src_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
+ mm_util_retvm_if(!src_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_handle");
mm_util_retvm_if(!__mm_util_check_rotation(rotation), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid rotation [%d]", rotation);
- mm_util_retvm_if(dst_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
+ mm_util_retvm_if(!dst_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
mm_util_debug("rotation [%d]", rotation);
- ret = __mm_util_get_map(_src_handle->color, &map);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "fail to get map");
-
__mm_util_init(&exception);
- _image = __mm_util_constitute_image(src_handle, map);
+ _image = __mm_util_constitute_image(src_handle);
if (_image == NULL) {
mm_util_error("Error: __mm_util_constitute_image failed.");
ret = MM_UTIL_ERROR_INVALID_OPERATION;
__mm_util_finalize(_image, _processed_image, &exception);
- g_free(map);
-
mm_util_fleave();
return ret;
int mm_util_rotate_B_P(mm_util_image_h src_handle, mm_util_rotate_type_e rotation, const char *dst_path)
{
int ret = MM_UTIL_ERROR_NONE;
- mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
- char *map = NULL;
Image *_image = NULL;
Image *_processed_image = NULL;
ExceptionInfo exception;
- mm_util_retvm_if(src_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
+ mm_util_retvm_if(!src_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_handle");
mm_util_retvm_if(!__mm_util_check_rotation(rotation), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid rotation [%d]", rotation);
mm_util_retvm_if(!MMUTIL_STRING_VALID(dst_path), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_path");
mm_util_sec_debug("rotation [%d] dst_path [%s]", rotation, dst_path);
- ret = __mm_util_get_map(_src_handle->color, &map);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "fail to get map");
-
__mm_util_init(&exception);
- _image = __mm_util_constitute_image(src_handle, map);
+ _image = __mm_util_constitute_image(src_handle);
if (_image == NULL) {
mm_util_error("Error: __mm_util_constitute_image failed.");
ret = MM_UTIL_ERROR_INVALID_OPERATION;
__mm_util_finalize(_image, _processed_image, &exception);
- g_free(map);
-
mm_util_fleave();
return ret;
mm_util_retvm_if(!MMUTIL_STRING_VALID(src_path), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_path");
mm_util_retvm_if(!__mm_util_check_rotation(rotation), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid rotation [%d]", rotation);
- mm_util_retvm_if(dst_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
+ mm_util_retvm_if(!dst_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
mm_util_sec_debug("src_path [%s] rotation [%d] req_format [%d]", src_path, rotation, req_format);
{
int ret = MM_UTIL_ERROR_NONE;
mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
- char *map = NULL;
Image *_image = NULL;
Image *_processed_image = NULL;
ExceptionInfo exception;
- mm_util_retvm_if(src_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
+ mm_util_retvm_if(!src_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_handle");
mm_util_retvm_if((req_width == 0) || (req_height == 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid size W[%d] H[%d]", req_width, req_height);
- mm_util_retvm_if(dst_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
+ mm_util_retvm_if(!dst_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
mm_util_debug("req_width [%u] req_height [%u]", req_width, req_height);
- ret = __mm_util_get_map(_src_handle->color, &map);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "fail to get map");
-
__mm_util_init(&exception);
- _image = __mm_util_constitute_image(src_handle, map);
+ _image = __mm_util_constitute_image(src_handle);
if (_image == NULL) {
mm_util_error("Error: __mm_util_constitute_image failed.");
ret = MM_UTIL_ERROR_INVALID_OPERATION;
__mm_util_finalize(_image, _processed_image, &exception);
- g_free(map);
-
mm_util_fleave();
return ret;
int mm_util_resize_B_P(mm_util_image_h src_handle, unsigned int req_width, unsigned int req_height, const char *dst_path)
{
int ret = MM_UTIL_ERROR_NONE;
- mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
- char *map = NULL;
Image *_image = NULL;
Image *_processed_image = NULL;
ExceptionInfo exception;
- mm_util_retvm_if(src_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
+ mm_util_retvm_if(!src_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_handle");
mm_util_retvm_if((req_width == 0) || (req_height == 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid size W[%d] H[%d]", req_width, req_height);
mm_util_retvm_if(!MMUTIL_STRING_VALID(dst_path), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_path");
mm_util_sec_debug("req_width [%u] req_height [%u] dst_path [%s]", req_width, req_height, dst_path);
- ret = __mm_util_get_map(_src_handle->color, &map);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "fail to get map");
-
__mm_util_init(&exception);
- _image = __mm_util_constitute_image(src_handle, map);
+ _image = __mm_util_constitute_image(src_handle);
if (_image == NULL) {
mm_util_error("Error: __mm_util_constitute_image failed.");
ret = MM_UTIL_ERROR_INVALID_OPERATION;
__mm_util_finalize(_image, _processed_image, &exception);
- g_free(map);
-
mm_util_fleave();
return ret;
mm_util_retvm_if(!MMUTIL_STRING_VALID(src_path), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_path");
mm_util_retvm_if((req_width == 0) || (req_height == 0), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid size W[%d] H[%d]", req_width, req_height);
- mm_util_retvm_if(dst_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
+ mm_util_retvm_if(!dst_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
mm_util_sec_debug("src_path [%s] req_width [%u] req_height [%u]", src_path, req_width, req_height);
{
int ret = MM_UTIL_ERROR_NONE;
mm_image_info_s *_src_handle = (mm_image_info_s*)src_handle;
- char *map = NULL;
Image *_image = NULL;
ExceptionInfo exception;
- mm_util_retvm_if(src_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid handle");
- mm_util_retvm_if(dst_handle == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
+ mm_util_retvm_if(!src_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_handle");
+ mm_util_retvm_if(!dst_handle, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid dst_handle");
mm_util_debug("input format [%d] req_format [%d]", _src_handle->color, req_format);
- ret = __mm_util_get_map(_src_handle->color, &map);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "fail to get map");
-
__mm_util_init(&exception);
- _image = __mm_util_constitute_image(src_handle, map);
+ _image = __mm_util_constitute_image(src_handle);
if (_image == NULL) {
mm_util_error("Error: __mm_util_constitute_image failed.");
ret = MM_UTIL_ERROR_INVALID_OPERATION;
goto ERROR;
}
- g_free(map);
-
ret = __mm_util_dispatch_image(_image, req_format, dst_handle);
ERROR:
{
int ret = MM_UTIL_ERROR_NONE;
char *extension = NULL;
- char *map = NULL;
Image *_image = NULL;
mm_util_image_h converted_image = NULL, source = NULL;
source = (converted_image) ? converted_image : decoded_image;
- ret = __mm_util_get_map(((mm_image_info_s *)source)->color, &map);
- if (ret != MM_UTIL_ERROR_NONE) {
- mm_util_error("fail to get map");
- goto ERROR;
- }
-
__mm_util_init(NULL);
- _image = __mm_util_constitute_image(source, map);
+ _image = __mm_util_constitute_image(source);
if (_image == NULL) {
mm_util_error("Error: __mm_util_constitute_image failed.");
ret = MM_UTIL_ERROR_INVALID_OPERATION;
__mm_util_finalize(_image, NULL, NULL);
- g_free(map);
-
mm_image_destroy_image(converted_image);
mm_util_fleave();