load_size option now accept -1xH or Wx-1
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 29 Jan 2009 16:45:14 +0000 (16:45 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 29 Jan 2009 16:45:14 +0000 (16:45 +0000)
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

index 661ba14..0b9210c 100644 (file)
@@ -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;