Skip to content

Commit

Permalink
Minor code clean-up & reformatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
TurboGit committed Sep 25, 2024
1 parent 3b57b33 commit 7970d71
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 58 deletions.
13 changes: 9 additions & 4 deletions src/common/mipmap_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,10 @@ static void _init_8(uint8_t *buf,
const int imgwd = img2->width;
const int imght = img2->height;
dt_image_cache_read_release(darktable.image_cache, img2);
if(thumb_width < wd && thumb_height < ht && thumb_width < imgwd - 4 && thumb_height < imght - 4)
if(thumb_width < wd
&& thumb_height < ht
&& thumb_width < imgwd - 4
&& thumb_height < imght - 4)
{
res = TRUE;
}
Expand All @@ -1481,7 +1484,8 @@ static void _init_8(uint8_t *buf,
dt_print(DT_DEBUG_CACHE,
"[mipmap_cache] generate mip %d for ID=%d from embedded jpeg\n",
size, imgid);
dt_iop_flip_and_zoom_8(tmp, thumb_width, thumb_height, buf, wd, ht, orientation, width, height);
dt_iop_flip_and_zoom_8(tmp, thumb_width, thumb_height,
buf, wd, ht, orientation, width, height);
}
dt_free_align(tmp);
}
Expand Down Expand Up @@ -1521,8 +1525,9 @@ static void _init_8(uint8_t *buf,
dat.head.max_width = wd;
dat.head.max_height = ht;
dat.buf = buf;
// export with flags: ignore exif(don't load from disk), don't swap byte order, don't do hq processing,
// no upscaling and signal we want thumbnail export
// export with flags: ignore exif(don't load from disk), don't
// swap byte order, don't do hq processing, no upscaling and
// signal we want thumbnail export
res = dt_imageio_export_with_flags(imgid, "unused", &format, (dt_imageio_module_data_t *)&dat, TRUE, FALSE, FALSE,
FALSE, FALSE, TRUE, NULL, FALSE, FALSE, DT_COLORSPACE_NONE, NULL, DT_INTENT_LAST, NULL,
NULL, 1, 1, NULL, -1);
Expand Down
99 changes: 50 additions & 49 deletions src/imageio/imageio.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ dt_image_flags_t dt_imageio_get_type_from_extension(const char *extension)

// load a full-res thumbnail:
gboolean dt_imageio_large_thumbnail(const char *filename,
uint8_t **buffer,
int32_t *width,
int32_t *height,
dt_colorspaces_color_profile_type_t *color_space)
uint8_t **buffer,
int32_t *width,
int32_t *height,
dt_colorspaces_color_profile_type_t *color_space)
{
int res = TRUE;

Expand Down Expand Up @@ -688,21 +688,21 @@ void dt_imageio_to_fractional(const float in,
}

gboolean dt_imageio_export(const dt_imgid_t imgid,
const char *filename,
dt_imageio_module_format_t *format,
dt_imageio_module_data_t *format_params,
const gboolean high_quality,
const gboolean upscale,
const gboolean copy_metadata,
const gboolean export_masks,
const dt_colorspaces_color_profile_type_t icc_type,
const gchar *icc_filename,
const dt_iop_color_intent_t icc_intent,
dt_imageio_module_storage_t *storage,
dt_imageio_module_data_t *storage_params,
const int num,
const int total,
dt_export_metadata_t *metadata)
const char *filename,
dt_imageio_module_format_t *format,
dt_imageio_module_data_t *format_params,
const gboolean high_quality,
const gboolean upscale,
const gboolean copy_metadata,
const gboolean export_masks,
const dt_colorspaces_color_profile_type_t icc_type,
const gchar *icc_filename,
const dt_iop_color_intent_t icc_intent,
dt_imageio_module_storage_t *storage,
dt_imageio_module_data_t *storage_params,
const int num,
const int total,
dt_export_metadata_t *metadata)
{
if(strcmp(format->mime(format_params), "x-copy") == 0)
/* This is a just a copy, skip process and just export */
Expand Down Expand Up @@ -743,27 +743,27 @@ static double _get_pipescale(dt_dev_pixelpipe_t *pipe,
// internal function: to avoid exif blob reading + 8-bit byteorder
// flag + high-quality override
gboolean dt_imageio_export_with_flags(const dt_imgid_t imgid,
const char *filename,
dt_imageio_module_format_t *format,
dt_imageio_module_data_t *format_params,
const gboolean ignore_exif,
const gboolean display_byteorder,
const gboolean high_quality,
const gboolean upscale,
const gboolean is_scaling,
const gboolean thumbnail_export,
const char *filter,
const gboolean copy_metadata,
const gboolean export_masks,
const dt_colorspaces_color_profile_type_t icc_type,
const gchar *icc_filename,
const dt_iop_color_intent_t icc_intent,
dt_imageio_module_storage_t *storage,
dt_imageio_module_data_t *storage_params,
int num,
const int total,
dt_export_metadata_t *metadata,
const int history_end)
const char *filename,
dt_imageio_module_format_t *format,
dt_imageio_module_data_t *format_params,
const gboolean ignore_exif,
const gboolean display_byteorder,
const gboolean high_quality,
const gboolean upscale,
const gboolean is_scaling,
const gboolean thumbnail_export,
const char *filter,
const gboolean copy_metadata,
const gboolean export_masks,
const dt_colorspaces_color_profile_type_t icc_type,
const gchar *icc_filename,
const dt_iop_color_intent_t icc_intent,
dt_imageio_module_storage_t *storage,
dt_imageio_module_data_t *storage_params,
int num,
const int total,
dt_export_metadata_t *metadata,
const int history_end)
{
dt_develop_t dev;
dt_dev_init(&dev, FALSE);
Expand Down Expand Up @@ -794,8 +794,9 @@ gboolean dt_imageio_export_with_flags(const dt_imgid_t imgid,
filename,img->load_status);
if(img->load_status == DT_IMAGEIO_FILE_NOT_FOUND)
dt_control_log(_("image `%s' is not available!"), img->filename);
else if(img->load_status == DT_IMAGEIO_LOAD_FAILED || img->load_status == DT_IMAGEIO_IOERROR ||
img->load_status == DT_IMAGEIO_CACHE_FULL)
else if(img->load_status == DT_IMAGEIO_LOAD_FAILED
|| img->load_status == DT_IMAGEIO_IOERROR
|| img->load_status == DT_IMAGEIO_CACHE_FULL)
dt_control_log(_("unable to load image `%s'!"), img->filename);
else
dt_control_log(_("image '%s' not supported"), img->filename);
Expand Down Expand Up @@ -913,13 +914,13 @@ gboolean dt_imageio_export_with_flags(const dt_imgid_t imgid,
}

dt_print(DT_DEBUG_ALWAYS,
"[dt_imageio_export_with_flags] %s%s%s%s%s modules:%s\n",
use_style && appending ? "append style history " : "",
use_style && !appending ? "replace style history " : "",
use_style ? "`" : "",
use_style && format_params ? format_params->style : "",
use_style ? "'." : "",
mbuf);
"[dt_imageio_export_with_flags] %s%s%s%s%s modules:%s\n",
use_style && appending ? "append style history " : "",
use_style && !appending ? "replace style history " : "",
use_style ? "`" : "",
use_style && format_params ? format_params->style : "",
use_style ? "'." : "",
mbuf);
}

if(filter)
Expand Down
6 changes: 3 additions & 3 deletions src/imageio/storage/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,9 @@ int store(dt_imageio_module_storage_t *self,

/* export image to file */
if(!dt_imageio_export(imgid, filename, format, fdata, high_quality,
upscale, TRUE, export_masks, icc_type,
icc_filename, icc_intent, self, sdata,
num, total, metadata))
upscale, TRUE, export_masks, icc_type,
icc_filename, icc_intent, self, sdata,
num, total, metadata))
{
dt_print(DT_DEBUG_ALWAYS,
"[imageio_storage_disk] could not export to file: `%s'!\n",
Expand Down
6 changes: 4 additions & 2 deletions src/imageio/storage/latex.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,13 @@ int store(dt_imageio_module_storage_t *self, dt_imageio_module_data_t *sdata, co
dt_pthread_mutex_unlock(&darktable.plugin_threadsafe);

/* export image to file */
dt_imageio_export(imgid, filename, format, fdata, high_quality, upscale, TRUE, export_masks, icc_type, icc_filename,
dt_imageio_export(imgid, filename, format, fdata, high_quality, upscale,
TRUE, export_masks, icc_type, icc_filename,
icc_intent, self, sdata, num, total, metadata);

dt_print(DT_DEBUG_ALWAYS, "[export_job] exported to `%s'\n", filename);
dt_control_log(ngettext("%d/%d exported to `%s'", "%d/%d exported to `%s'", num),
dt_control_log(ngettext("%d/%d exported to `%s'", "%d/%d exported to `%s'",
num),
num, total, filename);
return 0;
}
Expand Down

0 comments on commit 7970d71

Please sign in to comment.