diff options
author | Bastien Nocera <hadess@hadess.net> | 2017-01-09 17:01:42 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2017-01-09 18:14:04 +0100 |
commit | 3aa1366e034b2db90a0b8d8c1d56b8ae5b92c963 (patch) | |
tree | 32b1160ba15c612a8467c4e086ac524f48d474fb /thumbnailer | |
parent | 0144147d5597837bdbfb7e6b2f694d80eb5154f9 (diff) | |
download | gdk-pixbuf-3aa1366e034b2db90a0b8d8c1d56b8ae5b92c963.tar.gz |
thumbnailer: Cleanup the cleanups
Commit 6afda9c removed the separate height and width arguments, as we
always want to keep the original image's aspect ratio. The cleanup
wasn't quite finished though, and ended up with slightly non-sensical
checks (like doing comparisons twice).
Coverity CID 1388524
https://bugzilla.gnome.org/show_bug.cgi?id=768062
Diffstat (limited to 'thumbnailer')
-rw-r--r-- | thumbnailer/gdk-pixbuf-thumbnailer.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/thumbnailer/gdk-pixbuf-thumbnailer.c b/thumbnailer/gdk-pixbuf-thumbnailer.c index a10483e15..2fe728d40 100644 --- a/thumbnailer/gdk-pixbuf-thumbnailer.c +++ b/thumbnailer/gdk-pixbuf-thumbnailer.c @@ -46,31 +46,14 @@ size_prepared_cb (GdkPixbufLoader *loader, info->input_height = height; if (width < info->size && height < info->size) return; + if (info->size <= 0) return; - if ((info->size > 0 || info->size > 0)) { - if (info->size < 0) - { - width = width * (double)info->size/(double)height; - height = info->size; - } - else if (info->size < 0) - { - height = height * (double)info->size/(double)width; - width = info->size; - } - else if ((double)height * (double)info->size > - (double)width * (double)info->size) { - width = 0.5 + (double)width * (double)info->size / (double)height; - height = info->size; - } else { - height = 0.5 + (double)height * (double)info->size / (double)width; - width = info->size; - } + if (height > width) { + width = 0.5 + (double)width * (double)info->size / (double)height; + height = info->size; } else { - if (info->size > 0) - width = info->size; - if (info->size > 0) - height = info->size; + height = 0.5 + (double)height * (double)info->size / (double)width; + width = info->size; } gdk_pixbuf_loader_set_size (loader, width, height); |