diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-09-23 12:10:01 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-09-23 12:10:01 +0200 |
| commit | 559fdaeb07024c6b6d0d354900805b61fb262367 (patch) | |
| tree | cc45bdac9f5534f598f0be503b2cfd6b6d42aa49 | |
| parent | f71553cd2fb7bab75f014f2fe79ea900f4faee5a (diff) | |
| download | cataract-559fdaeb07024c6b6d0d354900805b61fb262367.tar.xz | |
Make thumbnail orientation independent of source image orientation
| -rw-r--r-- | src/generators.c | 10 | ||||
| -rw-r--r-- | src/generators.h | 2 | ||||
| -rw-r--r-- | src/items.h | 2 | ||||
| -rw-r--r-- | src/job-manager.c | 8 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/generators.c b/src/generators.c index 5e9e64e..b2cf807 100644 --- a/src/generators.c +++ b/src/generators.c @@ -110,7 +110,7 @@ generate_image (TGallerySetup *setup, unsigned int item_index, const gchar *dst_dir, gboolean update_when_necessary, - gboolean *portrait) + gboolean *thumb_portrait) { unsigned long new_w, new_h; unsigned long thumb_w, thumb_h; @@ -123,6 +123,7 @@ generate_image (TGallerySetup *setup, gchar *s1; int bigq; gboolean res; + gboolean source_img_portrait; thumb_src_full = NULL; @@ -162,14 +163,15 @@ generate_image (TGallerySetup *setup, if ((new_w > 0) && (new_h > 0)) { stats_images_inc (); - *portrait = (new_w / new_h) < 1; + source_img_portrait = (new_w / new_h) < 1; /* Generate thumbnail */ g_assert (thumb_src_full != NULL); get_image_sizes (thumb_src_full, &thumb_w, &thumb_h); + *thumb_portrait = (thumb_w / thumb_h) < 1; if ((thumb_w > 0) && (thumb_h > 0)) { - if (! *portrait) + if (! *thumb_portrait) calculate_sizes (setup->thumbnail_landscape_width, setup->thumbnail_landscape_height, &thumb_w, &thumb_h); else calculate_sizes (setup->thumbnail_portrait_width, setup->thumbnail_portrait_height, &thumb_w, &thumb_h); @@ -192,7 +194,7 @@ generate_image (TGallerySetup *setup, if ((item->width > 0) && (item->height > 0)) { calculate_sizes (item->width, item->height, &new_w, &new_h); } else { - if (! *portrait) { + if (! source_img_portrait) { if ((items->landscape_width > 0) && (items->landscape_height > 0)) calculate_sizes (items->landscape_width, items->landscape_height, &new_w, &new_h); else diff --git a/src/generators.h b/src/generators.h index ae39ed2..a6da10a 100644 --- a/src/generators.h +++ b/src/generators.h @@ -34,7 +34,7 @@ gboolean generate_image (TGallerySetup *setup, unsigned int item_index, const gchar *dst_dir, gboolean update_when_necessary, - gboolean *portrait); + gboolean *thumb_portrait); /* * write_html_album: process album and index template files diff --git a/src/items.h b/src/items.h index c972d59..ffad086 100644 --- a/src/items.h +++ b/src/items.h @@ -74,7 +74,7 @@ typedef struct { /* generated item info */ /* !! be careful with writes to this structure during thread work !! */ - gboolean gen_portrait; + gboolean gen_portrait; /* thumbnail orientation, don't use for original image orientation */ } TIndexItem; diff --git a/src/job-manager.c b/src/job-manager.c index 5dd5f8c..ecfe5b6 100644 --- a/src/job-manager.c +++ b/src/job-manager.c @@ -51,7 +51,7 @@ typedef struct { gboolean gen_done; int index; /* processed image index */ int real_index; /* absolute index in the list */ - gboolean gen_portrait; + gboolean gen_thumb_portrait; } TJobItem; @@ -139,7 +139,7 @@ thread_func (gpointer data) /* actually do some work */ if (item != NULL && job_item != NULL) { imgname = g_path_get_basename ((item->path == NULL && item->preview) ? item->preview : item->path); - updated = generate_image (job->setup, job->items, item, job_item->real_index, job->dst_dir, ! job->force_update, &job_item->gen_portrait); + updated = generate_image (job->setup, job->items, item, job_item->real_index, job->dst_dir, ! job->force_update, &job_item->gen_thumb_portrait); if (updated && job->setup->verbose) { G_LOCK (items_print); @@ -321,7 +321,7 @@ build_tree (TGallerySetup *setup, job_item->gen_done = FALSE; job_item->index = job->total_items; job_item->real_index = i; - job_item->gen_portrait = FALSE; + job_item->gen_thumb_portrait = FALSE; job_items = g_list_append (job_items, job_item); } } @@ -359,7 +359,7 @@ build_tree (TGallerySetup *setup, /* Copy runtime flags back to items, outside of threading */ for (l = job_items; l != NULL; l = l->next) { job_item = l->data; - job_item->item->gen_portrait = job_item->gen_portrait; + job_item->item->gen_portrait = job_item->gen_thumb_portrait; } /* Cleanup generator objects */ |
