]> Pileus Git - ~andy/sunrise/commitdiff
media-plugins/gimp-refocus: new ebuild for bug #327179
authorStefan Talpalaru (stefantalpalaru) <stefantalpalaru@yahoo.com>
Thu, 8 Jul 2010 18:40:20 +0000 (18:40 +0000)
committerStefan Talpalaru (stefantalpalaru) <stefantalpalaru@yahoo.com>
Thu, 8 Jul 2010 18:40:20 +0000 (18:40 +0000)
svn path=/sunrise/; revision=10965

media-plugins/gimp-refocus/ChangeLog [new file with mode: 0644]
media-plugins/gimp-refocus/Manifest [new file with mode: 0644]
media-plugins/gimp-refocus/files/gimp-refocus-atlas.patch [new file with mode: 0644]
media-plugins/gimp-refocus/files/gimp-refocus-gimp2.6.patch [new file with mode: 0644]
media-plugins/gimp-refocus/files/refocus-0.9.0-gimp-2.2_rlx.diff [new file with mode: 0644]
media-plugins/gimp-refocus/files/refocus-gimp-2.0.patch [new file with mode: 0644]
media-plugins/gimp-refocus/gimp-refocus-0.9.0.ebuild [new file with mode: 0644]
media-plugins/gimp-refocus/metadata.xml [new file with mode: 0644]

diff --git a/media-plugins/gimp-refocus/ChangeLog b/media-plugins/gimp-refocus/ChangeLog
new file mode 100644 (file)
index 0000000..43f1f3f
--- /dev/null
@@ -0,0 +1,11 @@
+# ChangeLog for media-plugins/gimp-refocus
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+  08 Jul 2010; Stefan Talpalaru (stefantalpalaru)
+  <stefantalpalaru@yahoo.com> +files/refocus-0.9.0-gimp-2.2_rlx.diff,
+  +files/gimp-refocus-gimp2.6.patch, +gimp-refocus-0.9.0.ebuild,
+  +files/refocus-gimp-2.0.patch, +files/gimp-refocus-atlas.patch,
+  +metadata.xml:
+  new ebuild for bug #327179
+
diff --git a/media-plugins/gimp-refocus/Manifest b/media-plugins/gimp-refocus/Manifest
new file mode 100644 (file)
index 0000000..3aae832
--- /dev/null
@@ -0,0 +1,8 @@
+AUX gimp-refocus-atlas.patch 3730 RMD160 83bee52ac298c86e9605180fdd9eed1492a28698 SHA1 7cbcb07139322b86a1999809273f7e809fd7c90f SHA256 c4226648480adf5bd2f2c52832ff80b098ff698523e1ace56150137f4b3cf2cd
+AUX gimp-refocus-gimp2.6.patch 19331 RMD160 f1c5302ad29778263bdff68bcec1f61c2f82235b SHA1 bc04a980ab9f2938b75685f6c4cdecfe80969c76 SHA256 7ea11c07bf6b229e29d10add90c708508f6cb51e5ebeb080846820f7aec9a08c
+AUX refocus-0.9.0-gimp-2.2_rlx.diff 8466 RMD160 9c8834c71a5c94f795758aaa1aab82d2008bdd97 SHA1 2fc4827eead2414dfb3c218fd2dc793a8bf71707 SHA256 2069cee465fcd6996b6cce17a718a40786a288e57ed54498a0ed9ef104cb54f1
+AUX refocus-gimp-2.0.patch 9790 RMD160 4bf37760a190c97d656b012f87f553bb8c29ad7f SHA1 3c6bd6ff6e426c514e8ea095ded4b3dd7794eeef SHA256 f0bf2f4ae2ba51b6f823731af35a4d4575f2212ec7e737bc36f1b4b508922267
+DIST refocus-0.9.0.tar.gz 381967 RMD160 085c9cd93c1fc8988182a08885a2dd1e782d2a7b SHA1 eab0f7e4df9fd4c82cda574f908e2e43205ddaec SHA256 35cc4ed11c14406a71a27977dd6c1fb3a3071695511cb9546643709b904befe4
+EBUILD gimp-refocus-0.9.0.ebuild 1156 RMD160 1830ff1a6d6f35aa2f01aa1f7a867e993e48dd18 SHA1 90d7e85737a410abd80c55f0aace5c7c2df49bca SHA256 76ebba982dea22275cd9cb21f1f67aa34801543627143beeba936a0d9a321716
+MISC ChangeLog 425 RMD160 ad1aeee347965d6f87062d5cfd154a3546cfbfee SHA1 4ebc03dc06a8469ccee0a6e93b310a1011855bac SHA256 11dd254d2add4b714a94fa96344a613db525fe6eee59275e78a9976b871851dd
+MISC metadata.xml 308 RMD160 e78f26e00f2ed9f8e465a1864f7542d137a29c96 SHA1 6aa601b494f99eae14b7328a40f34ae8f74e6e91 SHA256 9dae132d4ea12bdaf97b173295078b8689511c83987d604dc55b2a5264a0ac72
diff --git a/media-plugins/gimp-refocus/files/gimp-refocus-atlas.patch b/media-plugins/gimp-refocus/files/gimp-refocus-atlas.patch
new file mode 100644 (file)
index 0000000..d1a3595
--- /dev/null
@@ -0,0 +1,117 @@
+diff -ur refocus-0.9.0/configure.in refocus-0.9.0-patched/configure.in
+--- refocus-0.9.0/configure.in 2010-07-06 18:32:20.047863465 +0200
++++ refocus-0.9.0-patched/configure.in 2010-07-06 18:32:44.900864017 +0200
+@@ -16,26 +16,49 @@
+ AC_PROG_RANLIB
+ # Check if the user has ATLAS installed in ./lib-atlas
+-fw_save_LIBS=$LIBS
+-LIBS=-L./lib-atlas/lib ${LDFLAGS}
+-AC_CHECK_LIB(lapack, clapack_dgesv, 
+-AC_MSG_RESULT([using atlas in lib-atlas/lib])
+-AC_DEFINE(HAVE_ATLAS)
+-have_atlas=yes
+-LAPACK_LIB_DIR='${top_srcdir}/lib-atlas/lib'
+-LAPACK_INCLUDE_DIR='${top_srcdir}/lib-atlas/include'
+-,
+-AC_MSG_RESULT([using unoptimized lapack in lib])
++dnl fw_save_LIBS=$LIBS
++dnl LIBS=-L./lib-atlas/lib ${LDFLAGS}
++dnl AC_CHECK_LIB(lapack, clapack_dgesv, 
++dnl AC_MSG_RESULT([using atlas in lib-atlas/lib])
++dnl AC_DEFINE(HAVE_ATLAS)
++dnl have_atlas=yes
++dnl LAPACK_LIB_DIR='${top_srcdir}/lib-atlas/lib'
++dnl LAPACK_INCLUDE_DIR='${top_srcdir}/lib-atlas/include'
++dnl ,
++dnl AC_MSG_RESULT([using unoptimized lapack in lib])
++dnl have_atlas=no
++dnl LAPACK_LIB_DIR='${top_srcdir}/lib'
++dnl LAPACK_INCLUDE_DIR='${top_srcdir}/lib'
++dnl ,
++dnl [-lcblas -latlas])
++dnl LIBS=$fw_save_LIBS
++dnl AC_SUBST(LAPACK_LIB_DIR)
++dnl AC_SUBST(LAPACK_INCLUDE_DIR)
++dnl AM_CONDITIONAL(HAVE_ATLAS, test x${have_atlas} = xyes)
++
++BUNDLED_LAPACK_LIB_DIR='${top_srcdir}/lib'
++AC_SUBST(BUNDLED_LAPACK_LIB_DIR)
++
+ have_atlas=no
+-LAPACK_LIB_DIR='${top_srcdir}/lib'
+-LAPACK_INCLUDE_DIR='${top_srcdir}/lib'
+-,
+-[-lcblas -latlas])
+-LIBS=$fw_save_LIBS
+-AC_SUBST(LAPACK_LIB_DIR)
+-AC_SUBST(LAPACK_INCLUDE_DIR)
++AC_ARG_WITH(lapack-libs, [  --with-lapack-libs=LIBS ])
++if test "x$with_lapack_libs" = "x" ; then
++  LAPACK_LIBS='-L${top_srcdir}/lib -llapack'
++else
++  LAPACK_LIBS="$with_lapack_libs"
++  have_atlas=yes
++fi
++AC_SUBST(LAPACK_LIBS)
+ AM_CONDITIONAL(HAVE_ATLAS, test x${have_atlas} = xyes)
++AC_ARG_WITH(lapack-includes, [  --with-lapack-includes=INCLUDES ])
++if test "x$with_lapack_includes" = "x" ; then
++  LAPACK_INCLUDES='-I ${top_srcdir}/lib'
++else
++  LAPACK_INCLUDES="$with_lapack_includes"
++fi
++AC_SUBST(LAPACK_INCLUDES)
++
++
+ AM_PATH_GIMP_2_0(2.0.0)
+ AM_PATH_GTK_2_0(2.0.0)
+ AM_PATH_GLIB_2_0(2.0.0)
+diff -ur refocus-0.9.0/src/Makefile.am refocus-0.9.0-patched/src/Makefile.am
+--- refocus-0.9.0/src/Makefile.am      2010-07-06 18:32:19.991863838 +0200
++++ refocus-0.9.0-patched/src/Makefile.am      2010-07-06 18:35:40.403879796 +0200
+@@ -1,22 +1,28 @@
+ ## Process this file with automake to produce Makefile.in
+-INCLUDES=@GTK_CFLAGS@ @GIMP_CFLAGS@ -I @LAPACK_INCLUDE_DIR@
++INCLUDES=@GTK_CFLAGS@ @GIMP_CFLAGS@ @LAPACK_INCLUDES@
+ bin_PROGRAMS = refocus
+ noinst_PROGRAMS = test-matrix
+-ldadd_atlas=-L@LAPACK_LIB_DIR@ -llapack -lcblas -latlas
++ldadd_atlas=@LAPACK_LIBS@
+ noinst_HEADERS=bdclosure.h refocus.h matrix.h tilebuf.h conv.h fwlapack.h gimppreview.h prevman.h util.h
+ EXTRA_DIST = dummy-plugin.c
+ refocus_SOURCES = refocus.c conv.c gimppreview.c prevman.c util.c matrix.c tilebuf.c bdclosure.c fwlapack.c
+ refocus_LDADD = @GIMP_LIBS@ ${ldadd_atlas}
+-refocus_DEPENDENCIES=@LAPACK_LIB_DIR@/liblapack.a
++if HAVE_ATLAS
++else
++refocus_DEPENDENCIES=@BUNDLED_LAPACK_LIB_DIR@/liblapack.a
++endif
+ test_matrix_SOURCES = matrix.c test-matrix.c fwlapack.c
+ test_matrix_LDADD = -lm ${ldadd_atlas} @GLIB_LIBS@
+-test_matrix_DEPENDENCIES=@LAPACK_LIB_DIR@/liblapack.a
++if HAVE_ATLAS
++else
++test_matrix_DEPENDENCIES=@BUNDLED_LAPACK_LIB_DIR@/liblapack.a
++endif
+ install-bin: refocus
+       @if test "x@GIMPTOOL@" = "x" ; then \
+@@ -36,8 +42,8 @@
+               @GIMPTOOL@ --install-admin-bin refocus ; \
+       fi
+-@LAPACK_LIB_DIR@/liblapack.a:
+-      cd @LAPACK_LIB_DIR@; make
++@BUNDLED_LAPACK_LIB_DIR@/liblapack.a:
++      cd @BUNDLED_LAPACK_LIB_DIR@; make
+ %.s: %.c
+       ${CC} ${CFLAGS} -S $< -o $@
diff --git a/media-plugins/gimp-refocus/files/gimp-refocus-gimp2.6.patch b/media-plugins/gimp-refocus/files/gimp-refocus-gimp2.6.patch
new file mode 100644 (file)
index 0000000..ece7a4b
--- /dev/null
@@ -0,0 +1,530 @@
+diff -ur refocus-0.9.0/configure.in refocus-0.9.0-patched/configure.in
+--- refocus-0.9.0/configure.in 2010-07-04 16:33:24.307364434 +0200
++++ refocus-0.9.0-patched/configure.in 2010-07-04 16:34:09.679615391 +0200
+@@ -96,13 +96,6 @@
+    AC_DEFINE(PREVIEW_DEBUG)
+ fi
+-# If we have gcc set the CFLAGS
+-# This is done here because otherwise configure would use
+-# these flags for compiling test-programs.
+-if test "$GCC" = yes; then
+-   CFLAGS="-Wall -ansi -pedantic -ggdb -fomit-frame-pointer -O3 -funroll-all-loops"
+-fi
+-
+ #Check if erf is defined in the mathlibrary
+ AC_CHECK_LIB(m, erf, AC_DEFINE(HAVE_ERF))
+diff -ur refocus-0.9.0/src/gimppreview.c refocus-0.9.0-patched/src/gimppreview.c
+--- refocus-0.9.0/src/gimppreview.c    2010-07-04 16:33:24.310366565 +0200
++++ refocus-0.9.0-patched/src/gimppreview.c    2010-07-04 16:42:46.016366709 +0200
+@@ -36,18 +36,18 @@
+ #include "gimppreview.h"
+-static void gimp_preview_init (GimpPreview * preview);
+-static void gimp_preview_class_init (GimpPreviewClass * klass);
++static void gimp_preview_init (myGimpPreview * preview);
++static void gimp_preview_class_init (myGimpPreviewClass * klass);
+ static void gimp_preview_plus_callback (GtkWidget * widget, gpointer data);
+ static void gimp_preview_minus_callback (GtkWidget * widget, gpointer data);
+ static gint gimp_preview_event (GtkWidget * widget, GdkEvent * event,
+                                 gpointer data);
+-static void gimp_preview_recompute_sizes (GimpPreview * preview,
++static void gimp_preview_recompute_sizes (myGimpPreview * preview,
+                                           gdouble newscale);
+-static void gimp_preview_update_preview (GimpPreview * preview);
++static void gimp_preview_update_preview (myGimpPreview * preview);
+-static void gimp_preview_image_set_size (GimpPreview * preview, gint width,
++static void gimp_preview_image_set_size (myGimpPreview * preview, gint width,
+                                          gint height);
+ static void gimp_preview_size_request (GtkWidget * widget,
+                                        GtkRequisition * requisition);
+@@ -58,7 +58,7 @@
+                                  GtkCallback callback,
+                                  gpointer callback_data);
+ gboolean gimp_preview_update_preview_idle_fun (gpointer data);
+-void gimp_preview_schedule_update (GimpPreview * preview);
++void gimp_preview_schedule_update (myGimpPreview * preview);
+ #define PROGRESS_BAR_HEIGHT (10)
+ #define PREVIEW_SIZE (100)
+@@ -94,11 +94,11 @@
+ /*
+- * Apps which use a GimpPreview widget should not be accessing the private
++ * Apps which use a myGimpPreview widget should not be accessing the private
+  * data!
+  */
+ #define PREVIEW_DATA(preview) \
+-        ((GimpPreviewData*)(GIMP_PREVIEW (preview)->private_data))
++        ((myGimpPreviewData*)(MY_GIMP_PREVIEW (preview)->private_data))
+ typedef struct
+ {
+@@ -126,7 +126,7 @@
+   GtkWidget *image;
+   GtkWidget *progress_bar;
+ }
+-GimpPreviewData;
++myGimpPreviewData;
+ /* Convert coordinate in preview space to image coordinates */
+@@ -155,20 +155,20 @@
+   if (!preview_type)
+     {
+       GTypeInfo preview_info = {
+-        sizeof (GimpPreviewClass),
++        sizeof (myGimpPreviewClass),
+         (GBaseInitFunc) NULL,
+         (GBaseFinalizeFunc) NULL,
+         (GClassInitFunc) gimp_preview_class_init,
+         (GClassFinalizeFunc) NULL,
+         (gconstpointer) NULL,   /* class_data */
+-        sizeof (GimpPreview),
++        sizeof (myGimpPreview),
+         0,                      /* n_preallocs */
+         (GInstanceInitFunc) gimp_preview_init,
+         (GTypeValueTable *) NULL /* value_table */
+       };
+       preview_type =
+-        g_type_register_static (GTK_TYPE_CONTAINER, "GimpPreview",
++        g_type_register_static (GTK_TYPE_CONTAINER, "myGimpPreview",
+                                 &preview_info, 0);
+     }
+@@ -181,7 +181,7 @@
+  * by GTK's internal mechanisms.
+  */
+ static void
+-gimp_preview_class_init (GimpPreviewClass * klass)
++gimp_preview_class_init (myGimpPreviewClass * klass)
+ {
+   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
+@@ -190,7 +190,7 @@
+     g_signal_new ("update_preview",
+                   G_TYPE_FROM_CLASS (klass),
+                   G_SIGNAL_RUN_FIRST,
+-                  G_STRUCT_OFFSET (GimpPreviewClass, update_preview),
++                  G_STRUCT_OFFSET (myGimpPreviewClass, update_preview),
+                   NULL,
+                   NULL,
+                   g_cclosure_marshal_VOID__POINTER,
+@@ -200,7 +200,7 @@
+     g_signal_new ("preview_changed",
+                   G_TYPE_FROM_CLASS (klass),
+                   G_SIGNAL_RUN_FIRST,
+-                  G_STRUCT_OFFSET (GimpPreviewClass, preview_changed),
++                  G_STRUCT_OFFSET (myGimpPreviewClass, preview_changed),
+                   NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+   klass->update_preview = NULL;
+@@ -212,7 +212,7 @@
+ void
+-gimp_preview_set_scale_amount(GimpPreview *preview, gdouble scale_amount)
++gimp_preview_set_scale_amount(myGimpPreview *preview, gdouble scale_amount)
+ {
+   /*
+    * If the caller wants to set the scale amount, let them do so.
+@@ -269,7 +269,7 @@
+  * by GTK's internal mechanisms.
+  */
+ static void
+-gimp_preview_init (GimpPreview * preview)
++gimp_preview_init (myGimpPreview * preview)
+ {
+   gchar buffer[10];
+@@ -277,7 +277,7 @@
+   GTK_WIDGET_SET_FLAGS (preview, GTK_NO_WINDOW);
+   GTK_CONTAINER (preview)->resize_mode = GTK_RESIZE_IMMEDIATE;
+-  preview->private_data = g_malloc0 (sizeof (GimpPreviewData));
++  preview->private_data = g_malloc0 (sizeof (myGimpPreviewData));
+   PREVIEW_DATA (preview)->label = gtk_label_new ("");
+@@ -307,7 +307,7 @@
+ gimp_preview_new_with_args (GimpDrawable * drawable, gint cb_preview_size,
+                             gdouble cb_scale_amount, gint cb_allow_scale)
+ {
+-  GimpPreview *preview;
++  myGimpPreview *preview;
+   GtkWidget *frame;
+   GtkWidget *hbox;
+   GtkWidget *event_box;
+@@ -337,7 +337,7 @@
+   /* Now allocate the actual preview window. */
+-  preview = GIMP_PREVIEW (g_object_new (gimp_preview_get_type (), NULL));
++  preview = MY_GIMP_PREVIEW (g_object_new (gimp_preview_get_type (), NULL));
+   /* Set the scale amount. */
+   gimp_preview_set_scale_amount(preview, cb_scale_amount);
+@@ -352,8 +352,8 @@
+       preview_width = i2p (drawable->width, preview->scale);
+       preview_height = i2p (drawable->height, preview->scale);
+-      GIMP_PREVIEW (preview)->width = preview_width;
+-      GIMP_PREVIEW (preview)->height = preview_height;
++      MY_GIMP_PREVIEW (preview)->width = preview_width;
++      MY_GIMP_PREVIEW (preview)->height = preview_height;
+     }
+   else
+     {
+@@ -454,7 +454,7 @@
+ static void
+ gimp_preview_size_request (GtkWidget * widget, GtkRequisition * requisition)
+ {
+-  GimpPreview *preview = GIMP_PREVIEW (widget);
++  myGimpPreview *preview = MY_GIMP_PREVIEW (widget);
+   GtkRequisition resize_box_requisition;
+ #ifdef PREVIEW_DEBUG
+@@ -478,7 +478,7 @@
+ static void
+ gimp_preview_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
+ {
+-  GimpPreview *preview = GIMP_PREVIEW (widget);
++  myGimpPreview *preview = MY_GIMP_PREVIEW (widget);
+   GtkAllocation resize_box_allocation, progress_bar_allocation,
+     event_box_allocation;
+   GtkRequisition resize_box_requisition;
+@@ -543,7 +543,7 @@
+                      gboolean include_internals,
+                      GtkCallback callback, gpointer callback_data)
+ {
+-  GimpPreview *preview = GIMP_PREVIEW (container);
++  myGimpPreview *preview = MY_GIMP_PREVIEW (container);
+   if (PREVIEW_DATA (preview)->resize_box)
+     {
+@@ -564,7 +564,7 @@
+  * Plug-ins call this to do an update of the preview area.
+  */
+ void
+-gimp_preview_update (GimpPreview * preview)
++gimp_preview_update (myGimpPreview * preview)
+ {
+   gimp_preview_recompute_sizes (preview, preview->scale);
+   gimp_preview_update_preview (preview);
+@@ -579,11 +579,11 @@
+ static void
+ gimp_preview_plus_callback (GtkWidget * widget, gpointer data)
+ {
+-  GimpPreview *preview;
++  myGimpPreview *preview;
+   gchar buffer[10];
+   gdouble new_scale;
+-  preview = GIMP_PREVIEW (data);
++  preview = MY_GIMP_PREVIEW (data);
+   if (PREVIEW_DATA (preview)->scale_n == PREVIEW_SCALE_LAST)
+     return;
+@@ -616,11 +616,11 @@
+ static void
+ gimp_preview_minus_callback (GtkWidget * widget, gpointer data)
+ {
+-  GimpPreview *preview;
++  myGimpPreview *preview;
+   gchar buffer[10];
+   gdouble new_scale;
+-  preview = GIMP_PREVIEW (data);
++  preview = MY_GIMP_PREVIEW (data);
+   if (PREVIEW_DATA (preview)->scale_n == 0)
+     return;
+@@ -651,12 +651,12 @@
+ static gint
+ gimp_preview_event (GtkWidget * widget, GdkEvent * event, gpointer data)
+ {
+-  GimpPreview *preview;
++  myGimpPreview *preview;
+   GdkEventButton *button_event;
+   gint x, y;
+   gint dx, dy;
+-  preview = GIMP_PREVIEW (data);
++  preview = MY_GIMP_PREVIEW (data);
+   button_event = (GdkEventButton *) event;
+   switch (event->type)
+@@ -733,7 +733,7 @@
+  * This function is also used for initializing the preview.
+  */
+ static void
+-gimp_preview_recompute_sizes (GimpPreview * preview, gdouble new_scale)
++gimp_preview_recompute_sizes (myGimpPreview * preview, gdouble new_scale)
+ {
+   /* The center of the preview in image coordinates.
+@@ -765,7 +765,7 @@
+ }
+ void
+-gimp_preview_generate_update_event (GimpPreview * preview)
++gimp_preview_generate_update_event (myGimpPreview * preview)
+      /* Signal the user that the preview must be updated */
+ {
+   const gdouble scale = preview->scale;
+@@ -783,7 +783,7 @@
+            0,
+            preview->drawable->height - image_y);
+-  GimpPreviewEvent preview_event;
++  myGimpPreviewEvent preview_event;
+   preview_event.event_id = PREVIEW_DATA (preview)->current_event_id;
+   preview_event.scale = preview->scale;
+@@ -814,7 +814,7 @@
+  * to step through source and destination!
+  */
+ static void
+-gimp_preview_update_preview (GimpPreview * preview)
++gimp_preview_update_preview (myGimpPreview * preview)
+ {
+   GimpPixelRgn region;
+   guchar *image_data = NULL;
+@@ -1012,7 +1012,7 @@
+ void
+-gimp_preview_force_redraw (GimpPreview * preview)
++gimp_preview_force_redraw (myGimpPreview * preview)
+ {
+   gtk_widget_queue_draw (GTK_WIDGET (PREVIEW_DATA (preview)->image));
+ }
+@@ -1022,7 +1022,7 @@
+ gboolean
+ gimp_preview_update_preview_idle_fun (gpointer data)
+ {
+-  GimpPreview *preview = GIMP_PREVIEW (data);
++  myGimpPreview *preview = MY_GIMP_PREVIEW (data);
+   gint event_id = PREVIEW_DATA (preview)->current_event_id;
+ #ifdef PREVIEW_DEBUG
+@@ -1041,7 +1041,7 @@
+ }
+ void
+-gimp_preview_schedule_update (GimpPreview * preview)
++gimp_preview_schedule_update (myGimpPreview * preview)
+ {
+   PREVIEW_DATA (preview)->current_event_id++;
+@@ -1082,7 +1082,7 @@
+ }
+ void
+-gimp_preview_image_set_size (GimpPreview * preview, gint width, gint height)
++gimp_preview_image_set_size (myGimpPreview * preview, gint width, gint height)
+ {
+   const gint real_width = MIN (preview->max_width, width);
+   const gint real_height = MIN (preview->max_height, height);
+@@ -1120,8 +1120,8 @@
+ /**
+  * gimp_preview_draw_row:
+- * @preview: the #GimpPreview
+- * @event_id: event_id that was sent with the #GimpPreviewEvent.
++ * @preview: the #myGimpPreview
++ * @event_id: event_id that was sent with the #myGimpPreviewEvent.
+  * @type: the format of the data (e.g. %GIMP_RGBA_IMAGE).
+  * @row:the relative number of the row within the preview.
+  * The top row of the preview is number 0.
+@@ -1137,7 +1137,7 @@
+  * with the same event-id will be ignored by the preview.
+  **/
+ gboolean
+-gimp_preview_draw_row (GimpPreview * preview, const gint event_id,
++gimp_preview_draw_row (myGimpPreview * preview, const gint event_id,
+                        GimpImageType type, gint row,
+                        const guchar * const data)
+ {
+@@ -1247,8 +1247,8 @@
+ /**
+  * gimp_preview_draw_unscaled_row:
+- * @preview: the #GimpPreview
+- * @event_id: event_id that was sent with the #GimpPreviewEvent.
++ * @preview: the #myGimpPreview
++ * @event_id: event_id that was sent with the #myGimpPreviewEvent.
+  * @type: the format of the data (e.g. %GIMP_RGBA_IMAGE).
+  * @row:row is the relative position of the row w.r.t. preview_event->image_y.
+  * The top row has number 0.
+@@ -1267,7 +1267,7 @@
+  * with the same event-id will be ignored by the preview.
+  **/
+ gboolean
+-gimp_preview_draw_unscaled_row (GimpPreview * preview, const gint event_id,
++gimp_preview_draw_unscaled_row (myGimpPreview * preview, const gint event_id,
+                                 GimpImageType type, const gint row,
+                                 const guchar * const data)
+ {
+@@ -1445,8 +1445,8 @@
+ /**
+  * gimp_preview_progress_set_fraction:
+- * @preview: the #GimpPreview.
+- * @event_id: event_id that was sent with the #GimpPreviewEvent.
++ * @preview: the #myGimpPreview.
++ * @event_id: event_id that was sent with the #myGimpPreviewEvent.
+  * @fraction: the fraction completed.
+  *
+  * Set the progress bar of the preview to @fraction completed.
+@@ -1456,7 +1456,7 @@
+  * with the same event-id will be ignored by the preview.
+  **/
+ gboolean
+-gimp_preview_progress_set_fraction (GimpPreview * preview,
++gimp_preview_progress_set_fraction (myGimpPreview * preview,
+                                     const gint event_id, double fraction)
+ {
+   const gboolean return_status =
+diff -ur refocus-0.9.0/src/gimppreview.h refocus-0.9.0-patched/src/gimppreview.h
+--- refocus-0.9.0/src/gimppreview.h    2003-01-30 22:30:18.000000000 +0100
++++ refocus-0.9.0-patched/src/gimppreview.h    2010-07-04 16:42:33.885366354 +0200
+@@ -32,25 +32,25 @@
+ #define PREVIEW_FIXED_SIZE           0
+ #define PREVIEW_DEFAULT_SIZE         -1
+-#define GIMP_TYPE_PREVIEW            (gimp_preview_get_type ())
+-#define GIMP_PREVIEW(obj)            (GTK_CHECK_CAST ((obj), GIMP_TYPE_PREVIEW, GimpPreview))
+-#define GIMP_PREVIEW_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PREVIEW, GimpPreviewClass))
+-#define GIMP_IS_PREVIEW(obj)         (GTK_CHECK_TYPE ((obj), GIMP_TYPE_PREVIEW))
+-#define GIMP_IS_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PREVIEW))
+-typedef struct _GimpPreview GimpPreview;
+-typedef struct _GimpPreviewClass GimpPreviewClass;
+-typedef struct _GimpPreviewEvent GimpPreviewEvent;
++//#define GIMP_TYPE_PREVIEW            (gimp_preview_get_type ())
++#define MY_GIMP_PREVIEW(obj)            (GTK_CHECK_CAST ((obj), GIMP_TYPE_PREVIEW, myGimpPreview))
++#define MY_GIMP_PREVIEW_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PREVIEW, myGimpPreviewClass))
++//#define GIMP_IS_PREVIEW(obj)         (GTK_CHECK_TYPE ((obj), GIMP_TYPE_PREVIEW))
++//#define GIMP_IS_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PREVIEW))
++typedef struct _myGimpPreview myGimpPreview;
++typedef struct _myGimpPreviewClass myGimpPreviewClass;
++typedef struct _myGimpPreviewEvent myGimpPreviewEvent;
+-struct _GimpPreviewClass
++struct _myGimpPreviewClass
+ {
+   GtkContainerClass parent_class;
+-  void (*update_preview) (GimpPreview * preview, GimpPreviewEvent * event);
+-  void (*preview_changed) (GimpPreview * preview);
++  void (*update_preview) (myGimpPreview * preview, myGimpPreviewEvent * event);
++  void (*preview_changed) (myGimpPreview * preview);
+ };
+-struct _GimpPreview
++struct _myGimpPreview
+ {
+   GtkContainer parent;
+@@ -75,13 +75,13 @@
+ };
+ /**
+- * GimpPreviewEvent:
++ * myGimpPreviewEvent:
+  * @event_id: Id of this event. This is needed for gimp_preview_draw_row,
+  * gimp_preview_draw_unscaled_row and gimp_preview_progress_set_fraction.
+  * @scale: Current scale of the preview.
+  *
+  **/
+-struct _GimpPreviewEvent
++struct _myGimpPreviewEvent
+ {
+   gint event_id;                /* Id of this event */
+   gdouble scale;                /* Scale of preview */
+@@ -113,20 +113,20 @@
+                                        gint preview_size,
+                                        gdouble scale_amount,
+                                        gint allow_scale);
+-void gimp_preview_update (GimpPreview * preview);
++void gimp_preview_update (myGimpPreview * preview);
+-gboolean gimp_preview_draw_row (GimpPreview * preview, const gint event_id,
++gboolean gimp_preview_draw_row (myGimpPreview * preview, const gint event_id,
+                                 GimpImageType type, const gint row,
+                                 const guchar * const data);
+-gboolean gimp_preview_draw_unscaled_row (GimpPreview * preview,
++gboolean gimp_preview_draw_unscaled_row (myGimpPreview * preview,
+                                          const gint event_id,
+                                          GimpImageType type, const gint row,
+                                          const guchar * const data);
+-void gimp_preview_force_redraw (GimpPreview * preview);
++void gimp_preview_force_redraw (myGimpPreview * preview);
+-gboolean gimp_preview_progress_set_fraction (GimpPreview * preview,
++gboolean gimp_preview_progress_set_fraction (myGimpPreview * preview,
+                                              const gint event_id,
+                                              double fraction);
+diff -ur refocus-0.9.0/src/refocus.c refocus-0.9.0-patched/src/refocus.c
+--- refocus-0.9.0/src/refocus.c        2010-07-04 16:33:24.312364787 +0200
++++ refocus-0.9.0-patched/src/refocus.c        2010-07-04 16:43:02.753363951 +0200
+@@ -335,7 +335,7 @@
+   (void) data;
+   set_busy_cursor (widget, TRUE);
+   update_matrix ();
+-  gimp_preview_update (GIMP_PREVIEW (my_widgets.preview));
++  gimp_preview_update (MY_GIMP_PREVIEW (my_widgets.preview));
+   set_busy_cursor (widget, FALSE);
+ }
+@@ -368,11 +368,11 @@
+ {
+   gint event_id = GPOINTER_TO_INT (data);
+   return (gimp_preview_progress_set_fraction
+-          (GIMP_PREVIEW (my_widgets.preview), event_id, arg));
++          (MY_GIMP_PREVIEW (my_widgets.preview), event_id, arg));
+ }
+ static void
+-preview_callback (GtkWidget * widget, GimpPreviewEvent * event, gpointer data)
++preview_callback (GtkWidget * widget, myGimpPreviewEvent * event, gpointer data)
+ {
+   TileSource source;
+   TileSink sink;
+@@ -392,7 +392,7 @@
+                                       im_width, im_height);
+       tile_sink_init_for_preview (&sink, drawable, image_x, image_y,
+                                   im_width, im_height);
+-      gimp_preview_progress_set_fraction (GIMP_PREVIEW (my_widgets.preview),
++      gimp_preview_progress_set_fraction (MY_GIMP_PREVIEW (my_widgets.preview),
+                                           event->event_id, 0);
+       bd_closure_init (&update_progress_closure,
+                        preview_progress_update_fun,
+@@ -408,7 +408,7 @@
+         {
+           tile_sink_get_row (&sink, buf, image_x, image_y + row, im_width);
+           event_is_current =
+-            gimp_preview_draw_unscaled_row (GIMP_PREVIEW (my_widgets.preview),
++            gimp_preview_draw_unscaled_row (MY_GIMP_PREVIEW (my_widgets.preview),
+                                             event->event_id,
+                                             gimp_drawable_type (drawable->drawable_id),
+                                             row, buf);
+@@ -582,7 +582,7 @@
+   gtk_widget_show (dlg);
+   redraw_all ();
+-  gimp_preview_update (GIMP_PREVIEW (preview));
++  gimp_preview_update (MY_GIMP_PREVIEW (preview));
+   gtk_main ();
+   gdk_flush ();
+   return run_flag;
diff --git a/media-plugins/gimp-refocus/files/refocus-0.9.0-gimp-2.2_rlx.diff b/media-plugins/gimp-refocus/files/refocus-0.9.0-gimp-2.2_rlx.diff
new file mode 100644 (file)
index 0000000..c2c3a25
--- /dev/null
@@ -0,0 +1,255 @@
+diff -ur refocus-0.9.0/ChangeLog refocus-0.9.0-patched/ChangeLog
+--- refocus-0.9.0/ChangeLog    2003-01-31 14:02:03.000000000 +0100
++++ refocus-0.9.0-patched/ChangeLog    2010-07-04 15:13:21.414365851 +0200
+@@ -2,3 +2,9 @@
+       * This is the first public release (0.9.0) of the refocus plug-in.
++2007-09-28  Richard Lemieux <rlemieu(at)cooptel(dot)qc(dot)ca
++
++        * The plugin failed for some picture sizes because of buffer
++          overflow on the last row of tiles.  I corrected the code
++          handling the upper boundary of the picture.
++ 
+\ No newline at end of file
+diff -ur refocus-0.9.0/src/conv.c refocus-0.9.0-patched/src/conv.c
+--- refocus-0.9.0/src/conv.c   2003-01-30 22:30:18.000000000 +0100
++++ refocus-0.9.0-patched/src/conv.c   2010-07-04 15:13:21.415365014 +0200
+@@ -421,13 +421,19 @@
+   gint x, buf_start_y, total_tiles, tile_nr = 0;
+   /* Will be false when progress_update tells us that the data is no longer needed */
+   gboolean ok = TRUE;
+-
++  /*
++    tile_height()                 [util.c]
++    tile_width()                  [util.c]
++   */
+   initialize_buf (&buf, source, mat_size / 2, sx, sy, width, height,
+                   boundary_type);
+   total_tiles = (1 + floor ((buf.x + buf.width - 1) / tile_width ())
+                  - floor ((buf.x) / tile_width ())) *
+     (1 + floor ((buf.y_limit - 1) / tile_height ())
+      - floor ((buf.y) / tile_height ()));
++#ifdef RLXTEST
++  printf("convolve_image: total_tiles %d\n",total_tiles);
++#endif
+   buf_start_y = buf.y;
+   while (ok && shift_buf (&buf, source))
+@@ -437,6 +443,10 @@
+         {
+           const gint ncolors = source->bpp - source->has_alpha;
+           GimpTile *tile = tile_sink_get_tile (sink, x, buf.y);
++#ifdef RLXTEST
++          printf("convolve_image: x %d, y %d, tile->eheight %d\n",
++                 x, buf.y, tile->eheight);
++#endif
+           convolve_tile (tile, pixpos_in_buf (&buf, x, buf.y), buf.row_stride,
+                          ncolors, sink->bpp, mat->data, mat_size);
+           tile_sink_tile_unref (sink, tile);
+diff -ur refocus-0.9.0/src/tilebuf.c refocus-0.9.0-patched/src/tilebuf.c
+--- refocus-0.9.0/src/tilebuf.c        2010-07-04 15:12:14.223365075 +0200
++++ refocus-0.9.0-patched/src/tilebuf.c        2010-07-04 15:17:46.752381257 +0200
+@@ -18,6 +18,7 @@
+  * Version $Id: tilebuf.c,v 1.1.1.1 2003/01/30 21:30:19 ernstl Exp $
+  */
++#include <stdio.h>
+ #include "tilebuf.h"
+ #include "util.h"
+ #include <string.h>
+@@ -39,6 +40,11 @@
+ guchar *
+ pixpos_in_buf (TileStripBuffer * buf, const gint x, const gint y)
+ {
++  /*
++    & data = array(? lines x row_stride columns)
++    & pixpos_in_buf = &data[(x - real_x)*bytes_per_pixel, y - real_y]
++    & (real_x, real_y) = origin of tile.
++   */
+   return (&buf->data[buf->row_stride * (y - buf->real_y) +
+                      buf->bpp * (x - buf->real_x)]);
+ }
+@@ -220,7 +226,7 @@
+ static void
+ fix_bottom_boundary (TileStripBuffer * buf, const gint y_hi)
+ {
+-  if (y_hi >= buf->real_y + buf->real_height)
++  if (y_hi >= buf->real_y + buf->real_height)       /* (1) */
+     {
+       return;
+     };
+@@ -234,13 +240,32 @@
+       break;
+     case TB_BOUNDARY_MIRROR:
+       {
+-        register gint y;
++        register gint y2;
+-        for (y = y_hi; y < buf->real_y + buf->real_height; y++)
++        /*if (y_hi < buf->y_limit)*/
++        for (y2 = y_hi; y2 < buf->real_y + buf->real_height; y2++) /*(2)*/
+           {
+-            gint sy = 2 * (y_hi - 1) - y;
+-            copy_row (buf, buf->real_x, sy>=buf->real_y?sy:buf->real_y,
+-                      buf->real_width, y);
++            /*
++              &1 y < y_hi              [domain of y, definition of y_hi, (1)]
++              &2 y_hi <= y2 < buf->real_y + buf->real_height  [(1),(2)]
++              &3 i = 0, 1, ...
++              &4 y=y_hi-i-1 -> y2=y_hi+i               [definition of mirror]
++              &5 y = y2 - 2*i - 1                      [4]
++              &6 y = 2*y2 - 2*i - y2 - 1               [5,algebra]
++              &7 y = 2*y_hi - y2 - 1                   [4,6]
++            */
++            gint y =  2*y_hi - y2 - 1;
++            if (y < buf->real_y) break;
++#ifdef RLXTEST
++           printf("fix_bottom_boundary: Copying row %d to %d, width %d, buf_loc %d %d, real_y %d\n",
++                  2*y_hi - y2 - 1, y2, buf->real_width,
++                  buf->row_stride * (2*y_hi - y2 - 1 - buf->real_y) +
++                   buf->bpp * (buf->real_x - buf->real_x),
++                  buf->row_stride * (y2 - buf->real_y) +
++                   buf->bpp * (buf->real_x - buf->real_x),
++                   buf->real_y);
++#endif
++            copy_row (buf, buf->real_x, y, buf->real_width,y2);
+           };
+       }
+       break;
+@@ -262,7 +287,21 @@
+   const gint y_lo = MAX (buf->real_y, source->y);
+   const gint y_hi = MIN (buf->real_y + buf->real_height,
+                          source->y + source->height);
+-
++  /*
++    y:  domain of y.
++    & 0 <= y.  y is a 0-index.
++    & | & y in the source image
++        & 0 <=  source->y <= y < source->y + source->height
++      | & y in the buffer
++        & 0 <= buf->real_y <= y < buf->real_y + buf->real_height
++    x:  domain of x = domain of y with mapping y -> x, height -> width.
++   */
++
++#ifdef RLXTEST
++  printf("buf->real_y %d, buf->real_height %d, source->y %d, source->heigh %d, y_hi %d\n",
++         buf->real_y,  buf->real_height,
++       source->y, source->height, y_hi);
++#endif
+   fix_left_boundary (buf, x_lo, first_time ? buf->y : buf->y + tile_height (),
+                      y_hi);
+   fix_right_boundary (buf, x_hi,
+@@ -271,7 +310,15 @@
+     {
+       fix_top_boundary (buf, y_lo);
+     };
++#ifdef RLXTEST
++  printf("fix_boundaries: Now goto fix_bottom_boundary: y_hi %d, real_y + real_height %d, data[%d]\n",
++         y_hi, buf->real_y + buf->real_height,
++         buf->real_height * buf->row_stride);
++#endif
+   fix_bottom_boundary (buf, y_hi);
++#ifdef RLXTEST
++  printf("bottom boundary fixed\n");
++#endif
+ }
+ void
+@@ -318,6 +365,14 @@
+   gint x;
+   gboolean not_finished = TRUE;
++  /*
++    & y_limit = height of picture, if full picture.
++   */
++#ifdef RLXTEST
++  printf("buf->y %d + tile_height%d () >= buf->y_limit %d\n",
++         buf->y,tile_height(),buf->y_limit);
++#endif
++
+   if (buf->first_time)
+     {
+       /* Buf must already have been initialized so there is nothing to do */
+@@ -330,19 +385,31 @@
+     }
+   else
+     {
++#ifdef RLXTEST
++      printf("shift_buf: tile_height %d\n", tile_height());
++#endif
+       memmove (pixpos_in_buf (buf, buf->real_x,
+                               buf->real_y),
+                pixpos_in_buf (buf, buf->real_x,
+                               buf->real_y + tile_height ()),
+                buf->row_stride * (tile_height () + buf->border_width));
+       buf->y += tile_height ();
++#ifdef RLXTEST
++      printf("shift_buf: y %d, y_limit %d\n", buf->y,  buf->y_limit);
++#endif
+       buf->real_y = buf->y - buf->border_width;
+       for (x = buf->x - tile_width ();
+            x <= buf->x + buf->width; x += tile_width ())
+         {
+           copy_tile_to_buf (buf, source, x, buf->y + tile_height ());
++#ifdef RLXTEST
++          printf("shift_buf: x %d\n", x);
++#endif
+         };
+       fix_boundaries (buf, source, FALSE);
+     };
++#ifdef RLXTEST
++  printf("shift_buf: done\n");
++#endif
+   return (not_finished);
+ }
+diff -ur refocus-0.9.0/src/util.c refocus-0.9.0-patched/src/util.c
+--- refocus-0.9.0/src/util.c   2003-01-30 22:30:19.000000000 +0100
++++ refocus-0.9.0-patched/src/util.c   2010-07-04 15:13:21.416365300 +0200
+@@ -18,6 +18,7 @@
+  * Version $Id: util.c,v 1.1.1.1 2003/01/30 21:30:19 ernstl Exp $
+  */
++#include <stdio.h>
+ #include "util.h"
+ #include <string.h>
+ #include <math.h>
+@@ -30,14 +31,38 @@
+ gint
+ floorm (gint a, gint b)
+  /* return largest multiple of b that is <= a */
++ /*
++  & & m = floorm(a,b)
++    & a = b*m + r
++    &  0 <= r < b
++  */
+ {
++#ifdef RLXTEST
++  printf("floorm: a/b %d, fl %g\n", a/b, floor ((gdouble) a / b));
++#endif
+   return (b * floor ((gdouble) a / b));
+ }
+ gint
+ ceilm (gint a, gint b)
+  /* return least multiple of b that is >= a */
++ /*
++    & m = ceilm(a,b)
++    & a = b*m - r;
++    & m = a/b
++    % r = a%b
++    & -a = -b*m + r
++
++    & ceilm = (r == 0 ? b*m : (b+1)*m)
++  */
+ {
++#ifdef RLXTEST
++  printf("ceil: a %d, b %d, -(-a/b) %d,a/b+(a%b != 0 ? 1:0) %d,  fl %g\n",
++         a,b,
++         -((-a)/b),
++          a/b+(a%b != 0 ? 1:0),
++         ceil ((gdouble) a / b) );
++#endif
+   return (b * ceil ((gdouble) a / b));
+ }
diff --git a/media-plugins/gimp-refocus/files/refocus-gimp-2.0.patch b/media-plugins/gimp-refocus/files/refocus-gimp-2.0.patch
new file mode 100644 (file)
index 0000000..a95cc2f
--- /dev/null
@@ -0,0 +1,265 @@
+Index: configure.in
+===================================================================
+RCS file: /cvsroot/refocus/refocus/configure.in,v
+retrieving revision 1.1.1.1
+diff -u -u -r1.1.1.1 configure.in
+--- configure.in       30 Jan 2003 21:29:29 -0000      1.1.1.1
++++ configure.in       6 Apr 2004 20:26:54 -0000
+@@ -1,8 +1,8 @@
+ dnl Process this file with autoconf to produce a configure script.
+-AC_INIT(README)
+-
+-AM_INIT_AUTOMAKE(refocus, 0.9.0)
++AC_INIT([refocus],[0.9.0])
++AC_CONFIG_SRCDIR(README)
++AM_INIT_AUTOMAKE
+ AC_PROG_CC
+ AC_CHECK_PROG(GCC3, gcc3, gcc3)
+@@ -12,7 +12,7 @@
+    AC_MSG_RESULT([using $CC as compiler])
+ fi
+-AC_STDC_HEADERS
++AC_HEADER_STDC([])
+ AC_PROG_RANLIB
+ # Check if the user has ATLAS installed in ./lib-atlas
+@@ -36,7 +36,7 @@
+ AC_SUBST(LAPACK_INCLUDE_DIR)
+ AM_CONDITIONAL(HAVE_ATLAS, test x${have_atlas} = xyes)
+-AM_PATH_GIMP(1.2.0)
++AM_PATH_GIMP_2_0(2.0.0)
+ AM_PATH_GTK_2_0(2.0.0)
+ AM_PATH_GLIB_2_0(2.0.0)
+@@ -106,5 +106,6 @@
+ #Check if erf is defined in the mathlibrary
+ AC_CHECK_LIB(m, erf, AC_DEFINE(HAVE_ERF))
+-AC_OUTPUT([Makefile src/Makefile lib/Makefile doc/Makefile gtk-doc/Makefile ])
++AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile doc/Makefile gtk-doc/Makefile ])
++AC_OUTPUT
+Index: lib/Makefile.am
+===================================================================
+RCS file: /cvsroot/refocus/refocus/lib/Makefile.am,v
+retrieving revision 1.1.1.1
+diff -u -u -r1.1.1.1 Makefile.am
+--- lib/Makefile.am    30 Jan 2003 21:29:52 -0000      1.1.1.1
++++ lib/Makefile.am    6 Apr 2004 20:26:55 -0000
+@@ -1,4 +1,4 @@
+-CFLAGS=-fomit-frame-pointer -O3 -funroll-all-loops
++AM_CFLAGS=-fomit-frame-pointer -O3 -funroll-all-loops
+ noinst_LIBRARIES = liblapack.a libatlas.a libcblas.a
+Index: src/Makefile.am
+===================================================================
+RCS file: /cvsroot/refocus/refocus/src/Makefile.am,v
+retrieving revision 1.1.1.1
+diff -u -u -r1.1.1.1 Makefile.am
+--- src/Makefile.am    30 Jan 2003 21:30:18 -0000      1.1.1.1
++++ src/Makefile.am    6 Apr 2004 20:26:55 -0000
+@@ -11,7 +11,7 @@
+ EXTRA_DIST = dummy-plugin.c
+ refocus_SOURCES = refocus.c conv.c gimppreview.c prevman.c util.c matrix.c tilebuf.c bdclosure.c fwlapack.c
+-refocus_LDADD = @GTK_LIBS@ -lgimp ${ldadd_atlas}
++refocus_LDADD = @GIMP_LIBS@ ${ldadd_atlas}
+ refocus_DEPENDENCIES=@LAPACK_LIB_DIR@/liblapack.a
+ test_matrix_SOURCES = matrix.c test-matrix.c fwlapack.c
+Index: src/gimppreview.c
+===================================================================
+RCS file: /cvsroot/refocus/refocus/src/gimppreview.c,v
+retrieving revision 1.1.1.1
+diff -u -u -r1.1.1.1 gimppreview.c
+--- src/gimppreview.c  30 Jan 2003 21:30:18 -0000      1.1.1.1
++++ src/gimppreview.c  6 Apr 2004 20:26:55 -0000
+@@ -344,7 +344,7 @@
+   /* Save the drawable info. */
+   preview->drawable = drawable;
+-  preview->drawable_has_alpha = gimp_drawable_has_alpha (drawable->id);
++  preview->drawable_has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
+   /* Calculate our preview size. */
+   if (preview_size == PREVIEW_FIXED_SIZE)
+Index: src/prevman.c
+===================================================================
+RCS file: /cvsroot/refocus/refocus/src/prevman.c,v
+retrieving revision 1.1.1.1
+diff -u -u -r1.1.1.1 prevman.c
+--- src/prevman.c      30 Jan 2003 21:30:18 -0000      1.1.1.1
++++ src/prevman.c      6 Apr 2004 20:26:56 -0000
+@@ -52,7 +52,7 @@
+   tile_source->width = drawable->width;
+   tile_source->height = drawable->height;
+   tile_source->bpp = drawable->bpp;
+-  tile_source->has_alpha = gimp_drawable_has_alpha (drawable->id);
++  tile_source->has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
+   tile_source->un.drw.drawable = drawable;
+   gimp_pixel_rgn_init (&tile_source->un.drw.pixel_rgn, drawable, x, y, width,
+                        height, FALSE, FALSE);
+@@ -144,7 +144,7 @@
+   tile_sink->width = drawable->width;
+   tile_sink->height = drawable->height;
+   tile_sink->bpp = drawable->bpp;
+-  tile_sink->has_alpha = gimp_drawable_has_alpha (drawable->id);
++  tile_sink->has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
+   gimp_pixel_rgn_init (&tile_sink->un.drw.pixel_rgn, drawable, x, y, width,
+                        height, TRUE, TRUE);
+ }
+@@ -159,7 +159,7 @@
+   tile_sink->width = width;
+   tile_sink->height = height;
+   tile_sink->bpp = drawable->bpp;
+-  tile_sink->has_alpha = gimp_drawable_has_alpha (drawable->id);
++  tile_sink->has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
+   tile_sink->un.prv.data = g_new (guchar,
+                                   tile_sink->width * tile_sink->height *
+                                   tile_sink->bpp);
+Index: src/refocus.c
+===================================================================
+RCS file: /cvsroot/refocus/refocus/src/refocus.c,v
+retrieving revision 1.1.1.1
+diff -u -u -r1.1.1.1 refocus.c
+--- src/refocus.c      30 Jan 2003 21:30:19 -0000      1.1.1.1
++++ src/refocus.c      6 Apr 2004 20:26:56 -0000
+@@ -45,9 +45,9 @@
+ /* Declare local functions. */
+ static void query (void);
+-static void run (char *name,
++static void run (const gchar *name,
+                  gint nparams,
+-                 GimpParam * param,
++                 const GimpParam * param,
+                  gint * nreturn_vals, GimpParam ** return_vals);
+ static gint dialog ();
+ static void doit (void);
+@@ -111,7 +111,6 @@
+     {GIMP_PDB_FLOAT, "noise", "Noise to Signal ratio"},
+   };
+   static GimpParamDef *return_vals = NULL;
+-  static gint nargs = (gint) (sizeof (args) / sizeof (args[0]));
+   static gint nreturn_vals = 0;
+   gimp_install_procedure ("plug_in_refocus",
+@@ -123,15 +122,15 @@
+                           "<Image>/Filters/Enhance/Refocus ...",
+                           "RGB*, GRAY*",
+                           GIMP_PLUGIN,
+-                          nargs, nreturn_vals, args, return_vals);
++                          G_N_ELEMENTS(args), nreturn_vals, args, return_vals);
+ }
+ static void
+-run (char *name, gint n_params, GimpParam * param,
++run (const gchar *name, gint n_params, const GimpParam * param,
+      gint * nreturn_vals, GimpParam ** return_vals)
+ {
+   static GimpParam values[1];
+-  GimpRunModeType run_mode;
++  GimpRunMode run_mode;
+   GimpPDBStatusType status = GIMP_PDB_SUCCESS;
+   (void) name;                  /* Shut up warnings about unused parameters. */
+@@ -186,8 +185,8 @@
+     {
+       /*  Make sure that the drawable is gray or RGB color  */
+-      if (gimp_drawable_is_rgb (drawable->id) ||
+-          gimp_drawable_is_gray (drawable->id))
++      if (gimp_drawable_is_rgb (drawable->drawable_id) ||
++          gimp_drawable_is_gray (drawable->drawable_id))
+         {
+           doit ();
+@@ -411,7 +410,7 @@
+           event_is_current =
+             gimp_preview_draw_unscaled_row (GIMP_PREVIEW (my_widgets.preview),
+                                             event->event_id,
+-                                            gimp_drawable_type (drawable->id),
++                                            gimp_drawable_type (drawable->drawable_id),
+                                             row, buf);
+         };
+       g_free (buf);
+@@ -608,7 +607,7 @@
+   gimp_progress_init ("Computing matrix");
+   update_matrix ();
+   gimp_progress_init ("Applying convolution");
+-  gimp_drawable_mask_bounds (drawable->id, &sx1, &sy1, &sx2, &sy2);
++  gimp_drawable_mask_bounds (drawable->drawable_id, &sx1, &sy1, &sx2, &sy2);
+   width = sx2 - sx1;
+   height = sy2 - sy1;
+   tile_source_init_from_drawable (&source, drawable, sx1, sy1, width, height);
+@@ -618,7 +617,7 @@
+                   matrix, 2 * my_config.mat_width + 1,
+                   &update_progress_closure);
+   gimp_drawable_flush (drawable);
+-  gimp_drawable_merge_shadow (drawable->id, TRUE);
+-  gimp_drawable_update (drawable->id, sx1, sy1, width, height);
++  gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
++  gimp_drawable_update (drawable->drawable_id, sx1, sy1, width, height);
+   g_free (matrix);
+ }
+Index: src/tilebuf.c
+===================================================================
+RCS file: /cvsroot/refocus/refocus/src/tilebuf.c,v
+retrieving revision 1.1.1.1
+diff -u -u -r1.1.1.1 tilebuf.c
+--- src/tilebuf.c      30 Jan 2003 21:30:19 -0000      1.1.1.1
++++ src/tilebuf.c      6 Apr 2004 20:26:56 -0000
+@@ -140,7 +140,10 @@
+         for (x = x_lo - 1; x >= buf->real_x; x--)
+           {
+-            copy_col (buf, 2 * x_lo - x, y_start, y_end - y_start, x);
++            gint sx = 2 * x_lo - x;
++            copy_col (buf,
++                      sx<=buf->real_x+buf->real_width-1?sx:buf->real_x+buf->real_width-1,
++                      y_start, y_end - y_start, x);
+           };
+       }
+       break;
+@@ -171,7 +174,9 @@
+         for (x = x_hi; x < buf->real_x + buf->real_width; x++)
+           {
+-            copy_col (buf, 2 * (x_hi - 1) - x, y_start, y_end - y_start, x);
++            gint sx = 2 * (x_hi - 1) - x;
++            copy_col (buf, sx>=buf->real_x?sx:buf->real_x,
++                      y_start, y_end - y_start, x);
+           };
+       }
+       break;
+@@ -200,7 +205,10 @@
+         for (y = y_lo - 1; y >= buf->real_y; y--)
+           {
+-            copy_row (buf, buf->real_x, 2 * y_lo - y, buf->real_width, y);
++            gint sy = 2 * y_lo - y;
++            copy_row (buf, buf->real_x,
++                      sy<=buf->real_y+buf->real_height-1?sy:buf->real_y+buf->real_height-1,
++                      buf->real_width, y);
+           };
+       }
+       break;
+@@ -230,8 +238,9 @@
+         for (y = y_hi; y < buf->real_y + buf->real_height; y++)
+           {
+-            copy_row (buf, buf->real_x, 2 * (y_hi - 1) - y, buf->real_width,
+-                      y);
++            gint sy = 2 * (y_hi - 1) - y;
++            copy_row (buf, buf->real_x, sy>=buf->real_y?sy:buf->real_y,
++                      buf->real_width, y);
+           };
+       }
+       break;
+
+                
diff --git a/media-plugins/gimp-refocus/gimp-refocus-0.9.0.ebuild b/media-plugins/gimp-refocus/gimp-refocus-0.9.0.ebuild
new file mode 100644 (file)
index 0000000..487e265
--- /dev/null
@@ -0,0 +1,55 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit autotools eutils toolchain-funcs
+
+MY_PN=${PN#gimp-}
+MY_P=${MY_PN}-${PV}
+
+DESCRIPTION="refocus images using FIR Wiener filtering"
+HOMEPAGE="http://refocus.sourceforge.net"
+SRC_URI="mirror://sourceforge/${MY_PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="lapack-atlas"
+
+RDEPEND="lapack-atlas? (
+               dev-libs/libf2c
+               sci-libs/lapack-atlas
+       )
+       media-gfx/gimp:2
+       x11-libs/gtk+:2"
+DEPEND="${RDEPEND}
+       dev-util/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+       epatch "${FILESDIR}"/${MY_PN}-gimp-2.0.patch
+       epatch "${FILESDIR}"/${MY_PN}-0.9.0-gimp-2.2_rlx.diff
+       epatch "${FILESDIR}"/${PN}-gimp2.6.patch
+       epatch "${FILESDIR}"/${PN}-atlas.patch
+
+       eautoreconf
+}
+
+src_configure() {
+       export GIMPTOOL="/usr/bin/gimptool-2.0"
+
+       if use lapack-atlas; then
+               econf --with-lapack-libs="$($(tc-getPKG_CONFIG) --libs lapack)" \
+               --with-lapack-includes="$($(tc-getPKG_CONFIG) --cflags lapack)"
+       else
+               econf
+       fi
+}
+
+src_install() {
+       exeinto "$(gimptool-2.0 --gimpplugindir)/plug-ins"
+       doexe src/refocus || die
+}
diff --git a/media-plugins/gimp-refocus/metadata.xml b/media-plugins/gimp-refocus/metadata.xml
new file mode 100644 (file)
index 0000000..d841dd4
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>no-herd</herd>
+<maintainer><email>maintainer-wanted@gentoo.org</email></maintainer>
+<use>
+       <flag name='lapack-atlas'>Use the ATLAS version of lapack</flag>
+</use>
+</pkgmetadata>