const char *template = NULL;
GError *error = NULL;
- /* GraphicsMagick determine image codec from filename suffix */
+ /* GraphicsMagick determine image codec from file extension */
switch(type) {
case IMG_CODEC_GIF:
template = "XXXXXX.gif";
char *extension = NULL;
char *map = NULL;
Image *_image = NULL;
- mm_image_info_s *convert_image = NULL;
- mm_util_color_format_e format;
+ mm_util_image_h converted_image = NULL, source = NULL;
mm_util_retvm_if(!decoded_image, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid decoded_image");
mm_util_retvm_if(!MMUTIL_STRING_VALID(path), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid path");
*/
if (((mm_image_info_s *)decoded_image)->color == MM_UTIL_COLOR_RGBA) {
- ret = mm_util_convert_B_B(decoded_image, MM_UTIL_COLOR_RGB24, (mm_util_image_h *)&convert_image);
+ ret = mm_util_convert_B_B(decoded_image, MM_UTIL_COLOR_RGB24, &converted_image);
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("Error: mm_util_convert_B_B failed.");
goto ERROR;
}
}
- format = (convert_image) ? (convert_image->color) : (((mm_image_info_s *)decoded_image)->color);
- ret = __mm_util_get_map(format, &map);
+ 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((convert_image ? convert_image : decoded_image), map);
+ _image = __mm_util_constitute_image(source, map);
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((mm_util_image_h)convert_image);
+ mm_image_destroy_image(converted_image);
mm_util_fleave();