/* LCOV_EXCL_STOP */
}
- ret = image_util_decode_jpeg(info->src, colorspace, (unsigned char **)&buffer,
- &width, &height, &size_decode);
- if (IMAGE_UTIL_ERROR_NONE != ret) {
+ image_util_decode_h dh = NULL;
+ do {
+ unsigned long l_width = 0;
+ unsigned long l_height = 0;
+ unsigned long long ll_size_decode = 0;
+
+ ret = image_util_decode_create(&dh);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_decode_set_input_path(dh, info->src);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_decode_set_colorspace(dh, colorspace);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_decode_set_output_buffer(dh, (unsigned char **)&buffer);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_decode_run(dh, &l_width, &l_height, &ll_size_decode);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+
+ width = (int)l_width;
+ height = (int)l_height;
+ size_decode = (unsigned int)ll_size_decode;
+ } while (0);
+ if (dh)
+ ret = image_util_decode_destroy(dh);
+ if (IMAGE_UTIL_ERROR_NONE != ret || 0 == width || 0 == height) {
/* LCOV_EXCL_START */
info->ret = CONTACTS_ERROR_SYSTEM;
return true;
height = resized_height;
}
- ret = image_util_encode_jpeg_to_memory(buffer, width, height, colorspace,
- CTSVC_IMAGE_ENCODE_QUALITY, info->image, info->image_size);
+ image_util_encode_h eh = NULL;
+ do {
+ unsigned long long ll_size_encode = 0;
+
+ ret = image_util_encode_create(IMAGE_UTIL_JPEG, &eh);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_input_buffer(eh, buffer);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_resolution(eh, width, height);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_colorspace(eh, colorspace);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_quality(eh, CTSVC_IMAGE_ENCODE_QUALITY);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_output_buffer(eh, info->image);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_run(eh, &ll_size_encode);
+ *(info->image_size) = (unsigned int)ll_size_encode;
+ } while (0);
+ if (eh)
+ ret = image_util_encode_destroy(eh);
free(buffer);
if (IMAGE_UTIL_ERROR_NONE != ret) {
/* LCOV_EXCL_START */
int ret;
vcard_image_info info = {src, image, image_size, CONTACTS_ERROR_SYSTEM};
- ret = image_util_foreach_supported_jpeg_colorspace(
+ ret = image_util_foreach_supported_colorspace(IMAGE_UTIL_JPEG,
_ctsvc_vcard_image_util_supported_jpeg_colorspace_cb, &info);
if (IMAGE_UTIL_ERROR_NONE != ret)
return true;
}
- ret = image_util_decode_jpeg(info->src, colorspace, (unsigned char **)&buffer,
- &width, &height, &size_decode);
- if (IMAGE_UTIL_ERROR_NONE != ret) {
+ image_util_decode_h dh = NULL;
+ do {
+ unsigned long l_width = 0;
+ unsigned long l_height = 0;
+ unsigned long long ll_size_decode = 0;
+
+ ret = image_util_decode_create(&dh);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_decode_set_input_path(dh, info->src);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_decode_set_colorspace(dh, colorspace);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_decode_set_output_buffer(dh, (unsigned char **)&buffer);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_decode_run(dh, &l_width, &l_height, &ll_size_decode);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+
+ width = (int)l_width;
+ height = (int)l_height;
+ size_decode = (unsigned int)ll_size_decode;
+ } while (0);
+ if (dh)
+ ret = image_util_decode_destroy(dh);
+ if (IMAGE_UTIL_ERROR_NONE != ret || 0 == width || 0 == height) {
+ /* LCOV_EXCL_START */
info->ret = CONTACTS_ERROR_SYSTEM;
return true;
+ /* LCOV_EXCL_STOP */
}
size = (uint64_t)size_decode;
height = resized_height;
}
- ret = image_util_encode_jpeg(buffer, width, height, colorspace,
- CTSVC_IMAGE_ENCODE_QUALITY, info->dest);
+ image_util_encode_h eh = NULL;
+ do {
+ unsigned long long ll_size_encode = 0;
+
+ ret = image_util_encode_create(IMAGE_UTIL_JPEG, &eh);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_input_buffer(eh, buffer);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_resolution(eh, width, height);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_colorspace(eh, colorspace);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_quality(eh, CTSVC_IMAGE_ENCODE_QUALITY);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_set_output_path(eh, info->dest);
+ if (IMAGE_UTIL_ERROR_NONE != ret)
+ break;
+ ret = image_util_encode_run(eh, &ll_size_encode);
+ } while (0);
+ if (eh)
+ ret = image_util_encode_destroy(eh);
free(buffer);
if (IMAGE_UTIL_ERROR_NONE != ret) {
/* LCOV_EXCL_START */
int ret;
image_info info = {src, dest, max_size, CONTACTS_ERROR_SYSTEM};
- ret = image_util_foreach_supported_jpeg_colorspace(
+ ret = image_util_foreach_supported_colorspace(IMAGE_UTIL_JPEG,
_ctsvc_image_util_supported_jpeg_colorspace_cb, &info);
if (IMAGE_UTIL_ERROR_NONE != ret)