Skip to content

Commit

Permalink
gimp-plugin-fix-ca 4.1 (July 10, 2024)
Browse files Browse the repository at this point in the history
- Fixed bug in fix-ca.c to run in non-interactive script mode.
- Added make check due to testing non-interactive scripting mode.
  • Loading branch information
JoesCat committed Jul 11, 2024
1 parent d18c153 commit 62c8b13
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
choiceL: [--disable-silent-rules, --enable-silent-rules --enable-debugtime]
choiceL: [--disable-silent-rules, --enable-silent-rules, --enable-debugtime]
steps:
- uses: actions/checkout@v2
- name: Create configure
Expand All @@ -22,6 +22,9 @@ jobs:
- name: Test make strip
if: matrix.choiceL == '--disable-silent-rules'
run: make strip
- name: Do a make check
if: matrix.choiceL == '--enable-silent-rules'
run: make check
- name: Test user-level install/uninstall
if: matrix.choiceL == '--disable-silent-rules'
run: |
Expand Down
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
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ AC_PREREQ([2.68])
#
m4_define([fix_ca_name], [gimp-fix-ca])
m4_define([fix_ca_major_version], [4])
m4_define([fix_ca_minor_version], [0])
m4_define([fix_ca_minor_version], [1])
m4_define([fix_ca_version],[fix_ca_major_version.fix_ca_minor_version])
m4_define([fix_ca_package_name], [gimp-fix-ca])
m4_define([fix_ca_package_home], [https://github.com/JoesCat/gimp-fix-ca])
Expand Down Expand Up @@ -51,8 +51,10 @@ AC_PROG_CC
AC_PROG_SED
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PATH_PROG([CHMOD],[chmod],[:])
AC_PATH_PROG([STRIP],[strip],[:])
AC_PATH_PROG([GIMPTOOL],[gimptool-2.0],[:])
AC_PATH_PROG([MD5SUM],[md5sum],[:])
AC_PATH_PROG([MSGFMT],[msgfmt],[:])
AC_PATH_PROG([MSGINIT],[msginit],[:])
AC_PATH_PROG([MSGMERGE],[msgmerge],[:])
Expand Down Expand Up @@ -240,6 +242,7 @@ AH_BOTTOM([
AC_CONFIG_FILES([
Makefile
po/Makefile
tests/Makefile
rpm/gimp-fix-ca.spec
])
AC_OUTPUT
Expand Down
12 changes: 8 additions & 4 deletions fix-ca.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
#define N_(x) x
#endif

#ifdef TEST_FIX_CA
#define PROCEDURE_NAME "Test-Fix-CA"
#else
#define PROCEDURE_NAME "Fix-CA"
#endif
#define DATA_KEY_VALS "fix_ca"

/* Size controls in Fix CA dialog box */
Expand Down Expand Up @@ -238,6 +242,8 @@ static void run (const gchar *name, gint nparams,
#endif
textdomain( GETTEXT_PACKAGE );
#endif
gegl_init (NULL, NULL);

switch (run_mode) {
case GIMP_RUN_NONINTERACTIVE:
fix_ca_params.blue = param[3].data.d_float;
Expand Down Expand Up @@ -317,6 +323,8 @@ static void run (const gchar *name, gint nparams,
}
}

gegl_exit ();

values[0].data.d_status = status;
}

Expand Down Expand Up @@ -348,8 +356,6 @@ static int fix_ca (gint32 drawable_ID, FixCaParams *params)
return -1;
}

//gegl_init (NULL, NULL);

/* fetch pixel regions and setup shadow buffer */
srcBuf = gimp_drawable_get_buffer (drawable_ID);
destBuf = gimp_drawable_get_shadow_buffer (drawable_ID);
Expand Down Expand Up @@ -377,8 +383,6 @@ static int fix_ca (gint32 drawable_ID, FixCaParams *params)
gimp_drawable_merge_shadow (drawable_ID, TRUE);
gimp_drawable_update (drawable_ID, x, y, width, height);

//gegl_exit ();

#ifdef DEBUG_TIME
gettimeofday(&tv2, NULL);

Expand Down
3 changes: 2 additions & 1 deletion org.gimp.extension.fix-ca.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<releases>
<release version="4.0" date="2024-02-24" />
<release version="4.1" date="2024-07-10" />
<release version="4.0" date="2024-02-29" />
<release version="3.0.4" date="2023-12-02" />
<release version="3.0.3" date="2022-10-09" />
</releases>
Expand Down
10 changes: 5 additions & 5 deletions rpm/gimp-fix-ca.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,31 @@
%define moname gimp20-fix-ca
%define plugindir %{_libdir}/gimp/2.0/plug-ins/fix-ca

Name: @FIX_CA_PACKAGE_NAME@
Name: gimp-fix-ca
Version: @FIX_CA_VERSION@
Release: 0
Summary: A Gimp2 plugin for correcting Chromatic Aberration (CA)
License: GPLv3+
Group: Graphics/Editors and Converters
URL: https://github.com/JoesCat/gimp-fix-ca
Source0: https://github.com/JoesCat/gimp-fix-ca/releases/download/%{version}/%{name}-%{version}.tar.gz
Source0: https://github.com/JoesCat/gimp-fix-ca/archive/%{version}/gimp-fix-ca-%{version}.tar.gz

BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc
BuildRequires: make
BuildRequires: md5sum
BuildRequires: gettext-devel
BuildRequires: gtk+2-devel
BuildRequires: pkgconfig(gimp-2.0)
Requires: gimp >= 2.10.0


%description
A Gimp2 plug-in to correct Chromatic Aberration (CA).
Fix-CA can fix Lateral CA caused due to light travelling through lenses,
and fix Directional CA due to light travelling through dense material
such as glass or water.


%prep
%setup -q

Expand All @@ -39,13 +38,14 @@ automake --add-missing
%configure
%make_build

%check
make check

%install
%make_install INSTALLDIR="%{buildroot}/%{plugindir}" \
LOCALEDIR="%{buildroot}/%{_datadir}/locale"
%find_lang %{moname}


%files -f %{moname}.lang
%license COPYING
%{plugindir}/fix-ca
Expand Down
34 changes: 34 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
scripttests = test1.sh

AM_CFLAGS = ${CFLAGS} ${CPPFLAGS} ${GIMP_CFLAGS} ${GTK_CFLAGS} ${WCFLAGS} ${FCA_CFLAGS} -I${top_srcdir} -I${top_builddir}

AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} ${GIMP_CFLAGS} -I${includedir}

EXTRA_DIST = test-fix-ca.c test.scm test1.md5
nodist_bin_SCRIPTS = test1.sh

noinst_PROGRAMS = test-fix-ca
test_fix_ca_name = test-fix-ca
test_fix_ca_SOURCES = test-fix-ca.c
test_fix_ca.$(OBJEXT): fix-ca-config.h
test_fix_ca_LDADD = ${LIBS} ${GIMP_LIBS} ${GTK_LIBS} ${WSLIB} ${FCA_LIB}

update-tests: $(scripttests)

$(scripttests):
echo "#!/bin/sh" > ${builddir}/test1.sh; \
echo "rm -f ${builddir}/test1.tga" >> ${builddir}/test1.sh; \
echo "${GIMPTOOL} --install-script ${srcdir}/test.scm" >> ${builddir}/test1.sh; \
echo "${GIMPTOOL} --install-bin ${builddir}/test-fix-ca" >> ${builddir}/test1.sh; \
echo "gimp --verbose --console-messages -b '(test \"${top_srcdir}/img-fix-ca/full-branches.jpg\" \"${builddir}/test1.tga\" 6.0 -2.4 658 1280 1 0.0 0.0 0.0 0.0)' -b '(gimp-quit 0)'" >> ${builddir}/test1.sh; \
echo "${GIMPTOOL} --uninstall-bin test-fix-ca" >> ${builddir}/test1.sh; \
echo "${GIMPTOOL} --uninstall-script test.scm" >> ${builddir}/test1.sh; \
echo "${MD5SUM} -c ${top_srcdir}/tests/test1.md5" >> ${builddir}/test1.sh; \
${CHMOD} +x ${builddir}/test1.sh

TESTS = ${builddir}/test1.sh

clean-local:
rm -f ${builddir}/test?.sh ${builddir}/test?.tga

.PHONY: update-tests
2 changes: 2 additions & 0 deletions tests/test-fix-ca.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define TEST_FIX_CA 1
#include "../fix-ca.c"
6 changes: 6 additions & 0 deletions tests/test.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(define (test filename result bluel redl lensx lensy interpolation bluex redx bluey redy)
(define image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(define drawable (car (gimp-image-get-active-layer image)))
(Test-Fix-CA RUN-NONINTERACTIVE image drawable bluel redl lensx lensy interpolation bluex redx bluey redy)
(gimp-file-save RUN-NONINTERACTIVE image drawable result result)
(gimp-image-delete image))
1 change: 1 addition & 0 deletions tests/test1.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7e59db2f8eeafbc0a37d5fddde45c14c test1.tga

0 comments on commit 62c8b13

Please sign in to comment.