Skip to content

Commit

Permalink
Added 'make check' and 'make distcheck'
Browse files Browse the repository at this point in the history
fix-ca.c:show_progress == {-1=RUN_NONINTERACTIVE,0=no_display,1=display}.

Works with latest gimp-2.99.19 RC1 2024sep16 on commandline.

however, 'gimp-2.99 -i' still requests a display, so this is not ready for
scripts like rpmbuild or .github/workflows/main.yml yet
  • Loading branch information
JoesCat committed Sep 17, 2024
1 parent 6e13c72 commit eb57362
Show file tree
Hide file tree
Showing 11 changed files with 411 additions and 270 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Makefile.am - Top level automakefile for fix-ca

SUBDIRS = . po
SUBDIRS = . po tests

# The braces around ACLOCAL_FLAGS below instead of parentheses are intentional!
# Otherwise autoreconf misparses the line.
Expand Down
8 changes: 6 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dnl Process this file with "autoreconf -i;automake" to produce a configure scrip

# Copyright (C) 2024 by Joe Da Silva

AC_PREREQ([2.71])
AC_PREREQ([2.69])
#--------------------------------------------------------------------------
# Setup variables before running AC_INIT
#
Expand Down Expand Up @@ -51,11 +51,14 @@ AC_PROG_CC
AC_PROG_SED
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PATH_PROG([CHMOD],[chmod],[:])
AC_CHECK_PROGS([GIMP],[gimp-3.0 gimp-2.99],[:])
AC_CHECK_PROGS([GIMPTOOL],[gimptool-3.0 gimptool-2.99],[:])
AC_PATH_PROG([STRIP],[strip],[:])
AC_PATH_PROG([MD5SUM],[md5sum],[:])
AC_PATH_PROG([MSGFMT],[msgfmt],[:])
AC_PATH_PROG([MSGINIT],[msginit],[:])
AC_PATH_PROG([MSGMERGE],[msgmerge],[:])
AC_PATH_PROG([STRIP],[strip],[:])
AC_PATH_PROG([XGETTEXT],[xgettext],[:])
AM_CONFIG_HEADER(fix-ca-config.h)
AC_PROG_INSTALL
Expand Down Expand Up @@ -241,6 +244,7 @@ AH_BOTTOM([
AC_CONFIG_FILES([
Makefile
po/Makefile
tests/Makefile
rpm/gimp3-fix-ca.spec
])
AC_OUTPUT
Expand Down
38 changes: 25 additions & 13 deletions fix-ca.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
#include <windows.h>
#endif

#ifdef TEST_FIX_CA
#define PLUG_IN_PROC "test-plug-in-fix-ca"
#define PLUG_IN_ROLE "test-fix-ca"
#define PLUG_IN_BINARY "test-fix-ca"
/* No i18n for now */
#define _(x) x
#define N_(x) x
#else
#define PLUG_IN_PROC "plug-in-fix-ca"
#define PLUG_IN_ROLE "gimp3-fix-ca"
#define PLUG_IN_BINARY "fix-ca"
#ifdef HAVE_GETTEXT
#include <libintl.h>
#define _(String) gettext (String)
Expand All @@ -48,16 +59,13 @@
#define _(x) x
#define N_(x) x
#endif
#endif

#ifdef DEBUG_TIME
# include <sys/time.h>
# include <stdio.h>
#endif

#define PLUG_IN_PROC "plug-in-fix-ca"
#define PLUG_IN_ROLE "gimp3-fix-ca"
#define PLUG_IN_BINARY "fix-ca"

/* For fixca() row buffer management */
#define SOURCE_ROWS 120
#define INPUT_MAX SOURCE_ROWS/4
Expand Down Expand Up @@ -126,7 +134,7 @@ static void fixca_region (FixCaParams *params,
gint x2,
gint y1,
gint y2,
gboolean show_progress);
gint show_progress);

static void fixca_help (const gchar *help_id,
gpointer help_data);
Expand Down Expand Up @@ -178,7 +186,7 @@ fixca_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_image_types (procedure, "RGB*");
gimp_procedure_set_sensitivity_mask (procedure,
GIMP_PROCEDURE_SENSITIVE_DRAWABLE);

#ifndef TEST_FIX_CA
#ifdef HAVE_GETTEXT
/* Initialize i18n support */
setlocale (LC_ALL, "");
Expand All @@ -187,6 +195,7 @@ fixca_create_procedure (GimpPlugIn *plug_in,
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
textdomain (GETTEXT_PACKAGE);
#endif
#endif

gimp_procedure_set_menu_label (procedure, _("Chromatic Aberration..."));
Expand Down Expand Up @@ -265,6 +274,7 @@ fixca_run (GimpProcedure *procedure,
GError *error = NULL;
gint x, y, width, height, sizeImg;

#ifndef TEST_FIX_CA
#ifdef HAVE_GETTEXT
/* Initialize i18n support */
setlocale(LC_ALL, "");
Expand All @@ -273,6 +283,7 @@ fixca_run (GimpProcedure *procedure,
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
#endif
textdomain(GETTEXT_PACKAGE);
#endif
#endif

if (n_drawables != 1) {
Expand Down Expand Up @@ -440,7 +451,8 @@ fixca_run (GimpProcedure *procedure,
shadow = gimp_drawable_get_shadow_buffer(drawable);

/* adjust pixel regions from srcImg to destImg, according to params */
fixca_region (&fix_ca_params, x, (x+width), y, (y+height), TRUE);
fixca_region (&fix_ca_params, x, (x+width), y, (y+height),
((run_mode == GIMP_RUN_NONINTERACTIVE)? -1:1));

#ifdef DEBUG_TIME
printf ("finished doing fixca_region\n");
Expand Down Expand Up @@ -612,7 +624,7 @@ preview_update (GtkWidget *widget, GObject *config)
params->blueY, params->redY);
#endif

fixca_region (params, 0, params->Xsize, y, (y + height), FALSE);
fixca_region (params, 0, params->Xsize, y, (y + height), 0);

buffer = g_new (guchar, width * height * params->bpp);
b = absolute (params->bpc);
Expand Down Expand Up @@ -1166,7 +1178,7 @@ centerline(guchar *dest, gint width, gint bpp, gint bpc,
static void
fixca_region (FixCaParams *params,
gint x1, gint x2, gint y1, gint y2,
gboolean show_progress)
gint show_progress)
{
guchar *srcPTR = params->srcImg;
guchar *src[SOURCE_ROWS];
Expand All @@ -1189,7 +1201,7 @@ fixca_region (FixCaParams *params,
gettimeofday (&tv1, NULL);
#endif

if (show_progress)
if (show_progress > 0)
gimp_progress_init(_("Shifting pixel components..."));

/* Allocate buffers for reading, writing */
Expand Down Expand Up @@ -1487,7 +1499,7 @@ fixca_region (FixCaParams *params,
}
}

if (!show_progress) {
if (show_progress == 0) {
if (params->saturation != 0.0)
saturate (dest, x2-x1, bytes, bpc, 1+params->saturation/100);

Expand All @@ -1496,11 +1508,11 @@ fixca_region (FixCaParams *params,

set_data (dest, params, x1, y, (x2-x1));

if (show_progress && ((y-y1) % 8 == 0))
if (show_progress > 0 && ((y-y1) % 8 == 0))
gimp_progress_update ((gdouble) (y-y1)/(y2-y1));
}

if (show_progress)
if (show_progress > 0)
gimp_progress_update (0.0);

for (i = 0; i < SOURCE_ROWS; ++i)
Expand Down
Loading

0 comments on commit eb57362

Please sign in to comment.