_handle->path = NULL;
_handle->image_type = _NOT_SUPPORTED_IMAGE_TYPE;
_handle->colorspace = IMAGE_UTIL_COLORSPACE_RGBA8888;
+ _handle->down_scale = IMAGE_UTIL_DOWNSCALE_1_1;
*handle = (image_util_decode_h) _handle;
return IMAGE_UTIL_ERROR_NONE;
}
-static int _image_util_decode_create_image_handle(image_util_decode_h handle)
-{
- int err = IMAGE_UTIL_ERROR_NONE;
- decode_s *_handle = (decode_s *) handle;
-
- switch (_handle->image_type) {
- case IMAGE_UTIL_JPEG:
- _handle->down_scale = IMAGE_UTIL_DOWNSCALE_1_1;
- break;
- case IMAGE_UTIL_PNG:
- case IMAGE_UTIL_GIF:
- case IMAGE_UTIL_BMP:
- /* do nothing... */
- break;
- default:
- err = IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
- break;
- }
-
- if (err != IMAGE_UTIL_ERROR_NONE)
- image_util_error("Error - create image handle");
-
- return err;
-}
-
int image_util_decode_set_input_path(image_util_decode_h handle, const char *path)
{
int err = IMAGE_UTIL_ERROR_NONE;
IMAGE_UTIL_SAFE_FREE(image_header);
- err = _image_util_decode_create_image_handle(_handle);
- image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_decode_create_image_handle failed");
-
_handle->path = g_strndup(path, strlen(path));
image_util_retvm_if(_handle->path == NULL, IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
err = _image_util_decode_check_image_type(src_buffer, &_handle->image_type);
image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "_image_util_decode_check_image_type failed");
- err = _image_util_decode_create_image_handle(_handle);
- image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "_image_util_decode_create_image_handle failed");
-
IMAGE_UTIL_SAFE_FREE(_handle->src_buffer);
_handle->src_buffer = (void *)calloc(1, sizeof(void *));