From 355ed4d28e19da5ac8b25af3f066ee2b595e831d Mon Sep 17 00:00:00 2001 From: barbieri Date: Thu, 29 Jan 2009 16:45:14 +0000 Subject: [PATCH] load_size option now accept -1xH or Wx-1 If one want to load image at a given height or width and the other dimension should be large enough to make it possible, give -1 as the other coordinate and this will happen. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@38845 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/modules/loaders/jpeg/evas_image_load_jpeg.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/modules/loaders/jpeg/evas_image_load_jpeg.c b/src/modules/loaders/jpeg/evas_image_load_jpeg.c index 661ba14..0b9210c 100644 --- a/src/modules/loaders/jpeg/evas_image_load_jpeg.c +++ b/src/modules/loaders/jpeg/evas_image_load_jpeg.c @@ -120,14 +120,20 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, FILE *f) w = (w * ie->load_opts.dpi) / 90.0; h = (h * ie->load_opts.dpi) / 90.0; } - else if ((ie->load_opts.w > 0) && - (ie->load_opts.h > 0)) + else if ((ie->load_opts.w) && (ie->load_opts.h)) { int w2, h2; - - w2 = ie->load_opts.w; - h2 = (ie->load_opts.w * h) / w; - if (h2 > ie->load_opts.h) + if (ie->load_opts.w > 0) + { + w2 = ie->load_opts.w; + h2 = (ie->load_opts.w * h) / w; + if ((ie->load_opts.h > 0) && (h2 > ie->load_opts.h)) + { + h2 = ie->load_opts.h; + w2 = (ie->load_opts.h * w) / h; + } + } + else if (ie->load_opts.h > 0) { h2 = ie->load_opts.h; w2 = (ie->load_opts.h * w) / h; -- 2.7.4