Updated patch for EPSILON_THUMB_CANOLA
authoretrunko <eblima@gmail.com>
Mon, 12 May 2008 13:39:15 +0000 (13:39 +0000)
committeretrunko <eblima@gmail.com>
Mon, 12 May 2008 13:39:15 +0000 (13:39 +0000)
trunk/epsilon/debian/patches/02_epsilon_thumb_canola.diff

index 2faff3c..5c1c44d 100644 (file)
@@ -1,6 +1,7 @@
-diff -upNr epsilon/src/lib/Epsilon.c epsilon.new/src/lib/Epsilon.c
---- epsilon/src/lib/Epsilon.c  2008-03-06 10:50:30.000000000 -0300
-+++ epsilon.new/src/lib/Epsilon.c      2008-05-08 13:53:26.000000000 -0300
+diff --git a/src/lib/Epsilon.c b/src/lib/Epsilon.c
+index c1d769e..e01f714 100644
+--- a/src/lib/Epsilon.c
++++ b/src/lib/Epsilon.c
 @@ -23,6 +23,9 @@
  #ifdef HAVE_EPEG_H
  #include <Epeg.h>
@@ -43,7 +44,7 @@ diff -upNr epsilon/src/lib/Epsilon.c epsilon.new/src/lib/Epsilon.c
    ecore_file_mkpath(PATH_DIR_FAIL);
  
    plugins_mime = ecore_hash_new(ecore_str_hash, ecore_str_compare);
-@@ -446,6 +457,11 @@ _epsilon_file_name(unsigned thumb_size, 
+@@ -446,6 +457,11 @@ _epsilon_file_name(unsigned thumb_size, const char *hash, const char *ext, char
        dir = PATH_DIR_NORMAL;
        dir_len = LEN_DIR_NORMAL;
       }
@@ -55,7 +56,20 @@ diff -upNr epsilon/src/lib/Epsilon.c epsilon.new/src/lib/Epsilon.c
     else
       {
        dir = PATH_DIR_FAIL;
-@@ -575,15 +591,16 @@ epsilon_generate (Epsilon * e)
+@@ -563,10 +579,10 @@ epsilon_generate (Epsilon * e)
+   if (!e || !e->src || !e->hash)
+     return (EPSILON_FAIL);
+-   
++
+   tw = e->tw;
+   th = e->th;
+-   
++
+ #ifdef HAVE_EPEG_H
+   len = strlen (e->src);
+   if ((len > 4) &&
+@@ -575,7 +591,8 @@ epsilon_generate (Epsilon * e)
        _epsilon_file_name(e->tw, e->hash, "jpg", outfile, sizeof(outfile));
        epeg_thumbnail_comments_get (im, &info);
        epeg_size_get (im, &iw, &ih);
@@ -63,53 +77,28 @@ diff -upNr epsilon/src/lib/Epsilon.c epsilon.new/src/lib/Epsilon.c
 +      /* XXX - hack to force fixed height in case of tw != th (canola) */
 +      if (iw > ih && tw == th)
        {
--        th = e->th * ((double) ih / (double) iw);
--         if (th < 1) th = 1;
-+        th = ((unsigned long) e->tw * ih) / iw;
-+        if (th < 1) th = 1;
-       }
-       else
-       {
--        tw = e->tw * ((double) iw / (double) ih);
--         if (tw < 1) tw = 1;
-+        tw = ((unsigned long) e->th *  iw) / ih;
-+        if (tw < 1) tw = 1;
-       }
-       epeg_decode_size_set (im, tw, th);
-       epeg_quality_set (im, 100);
-@@ -695,18 +712,19 @@ epsilon_generate (Epsilon * e)
- #ifdef HAVE_PNG_H
-     if (tmp)
+         th = ((unsigned long) e->tw * ih) / iw;
+         if (th < 1) th = 1;
+@@ -697,7 +714,8 @@ epsilon_generate (Epsilon * e)
        {
--      iw = imlib_image_get_width ();
--      ih = imlib_image_get_height ();
+       iw = imlib_image_get_width ();
+       ih = imlib_image_get_height ();
 -      if (iw > ih)
--        {
--          th = e->th * ((double) ih / (double) iw);
--         if (th < 1) th = 1;
--        }
--      else
--        {
--          tw = e->tw * ((double) iw / (double) ih);
--         if (tw < 1) tw = 1;
--        }
-+        iw = imlib_image_get_width ();
-+        ih = imlib_image_get_height ();
-+        /* XXX - hack to force fixed height in case of tw != th (canola) */
-+        if (iw > ih && tw == th)
-+          {
-+            th = ((unsigned long) e->tw * ih) / iw;
-+            if (th < 1) th = 1;
-+          }
-+            else
-+          {
-+            tw = ((unsigned long) e->th *  iw) / ih;
-+            if (tw < 1) tw = 1;
-+          }
-       imlib_context_set_cliprect (0, 0, tw, th);
-       if ((src = imlib_create_cropped_scaled_image (0, 0, iw, ih, tw, th)))
++      /* XXX - hack to force fixed height in case of tw != th (canola) */
++      if (iw > ih && tw == th)
          {
-@@ -749,7 +767,11 @@ epsilon_thumb_size(Epsilon *e, Epsilon_T
+            th = ((unsigned long) e->tw * ih) / iw;
+            if (th < 1) th = 1;
+@@ -738,7 +756,7 @@ void
+ epsilon_thumb_size(Epsilon *e, Epsilon_Thumb_Size size)
+ {
+    if (!e) return;
+-   
++
+    switch (size)
+      {
+       case EPSILON_THUMB_NORMAL:
+@@ -749,7 +767,11 @@ epsilon_thumb_size(Epsilon *e, Epsilon_Thumb_Size size)
        e->tw = THUMB_SIZE_LARGE;
        e->th = THUMB_SIZE_LARGE;
        break;
@@ -122,10 +111,11 @@ diff -upNr epsilon/src/lib/Epsilon.c epsilon.new/src/lib/Epsilon.c
  }
  
  
-diff -upNr epsilon/src/lib/Epsilon.h epsilon.new/src/lib/Epsilon.h
---- epsilon/src/lib/Epsilon.h  2008-03-06 10:50:30.000000000 -0300
-+++ epsilon.new/src/lib/Epsilon.h      2008-05-08 13:53:26.000000000 -0300
-@@ -58,7 +58,8 @@ typedef struct _Epsilon_Info Epsilon_Inf
+diff --git a/src/lib/Epsilon.h b/src/lib/Epsilon.h
+index 90a51b3..05ff2f7 100644
+--- a/src/lib/Epsilon.h
++++ b/src/lib/Epsilon.h
+@@ -58,7 +58,8 @@ typedef struct _Epsilon_Info Epsilon_Info;
  enum _Epsilon_Thumb_Size
  {
     EPSILON_THUMB_NORMAL,
@@ -135,28 +125,6 @@ diff -upNr epsilon/src/lib/Epsilon.h epsilon.new/src/lib/Epsilon.h
  };
  
  typedef enum _Epsilon_Thumb_Size Epsilon_Thumb_Size;
-diff -upNr epsilon/src/lib/epsilon_thumb.c epsilon.new/src/lib/epsilon_thumb.c
---- epsilon/src/lib/epsilon_thumb.c    2008-03-06 10:50:30.000000000 -0300
-+++ epsilon.new/src/lib/epsilon_thumb.c        2008-05-08 13:53:26.000000000 -0300
-@@ -218,6 +218,9 @@ epsilon_cb_server_data(void *data, int t
-       if (e->server != epsilon_server)
-               return 1;
-+      if (!(e && e->data))
-+              return 1;
-+
-       msg = e->data;
-       Epsilon_Request *thumb;
-diff -upNr epsilon/src/lib/exiftags/canon.c epsilon.new/src/lib/exiftags/canon.c
---- epsilon/src/lib/exiftags/canon.c   2008-03-06 10:50:30.000000000 -0300
-+++ epsilon.new/src/lib/exiftags/canon.c       2008-05-08 13:53:26.000000000 -0300
-@@ -52,7 +52,7 @@
- struct ccstm {
-       int32_t val;
-       struct descrip *table;
--      const char descr[];
-+      const char *descr;
- };
+-- 
+1.5.3.6
+