case IMAGE_UTIL_BMP:
{
mm_util_bmp_data *bmp_data = (mm_util_bmp_data *) _handle->image_h;
- mm_util_bmp_encode_set_width(bmp_data, width);
- mm_util_bmp_encode_set_height(bmp_data, height);
+ bmp_data->width = width;
+ bmp_data->height = height;
}
break;
default:
case IMAGE_UTIL_PNG:
{
mm_util_png_data *png_data = (mm_util_png_data *) _handle->image_h;
+ size_t size = 0;
+
+ png_data->data = _handle->src_buffer[0];
if (_handle->path)
- err = mm_util_encode_to_png_file(&(_handle->src_buffer[0]), png_data, _handle->path, _handle->compression);
+ err = mm_util_encode_to_png_file(png_data, _handle->compression, _handle->path);
else
- err = mm_util_encode_to_png_memory(&(_handle->src_buffer[0]), png_data, _handle->compression);
+ err = mm_util_encode_to_png_memory(png_data, _handle->compression, _handle->dst_buffer, &size);
if (err == MM_UTIL_ERROR_NONE) {
- if (_handle->dst_buffer)
- *(_handle->dst_buffer) = png_data->data;
- _handle->dst_size = png_data->size;
+ _handle->dst_size = size;
_handle->width = png_data->width;
_handle->height = png_data->height;
}
err = mm_util_encode_bmp_to_file(bmp_data, _handle->path);
} else {
size_t size = 0;
- err = mm_util_encode_bmp_to_memory(bmp_data, &(bmp_data->data), &size);
+ err = mm_util_encode_bmp_to_memory(bmp_data, _handle->dst_buffer, &size);
if (err == MM_UTIL_ERROR_NONE)
bmp_data->size = (unsigned long long)size;
else
bmp_data->size = 0;
}
if (err == MM_UTIL_ERROR_NONE) {
- if (_handle->dst_buffer)
- *(_handle->dst_buffer) = bmp_data->data;
_handle->dst_size = bmp_data->size;
_handle->width = bmp_data->width;
_handle->height = bmp_data->height;