Skip to content

Commit

Permalink
Use GIMP_DRAWABLE_PREVIEW() and GIMP_PREVIEW()
Browse files Browse the repository at this point in the history
Be a little more like other plugins and use the GIMP_*() constants.

Fix test1.bmp in tests/Makefile.am
  • Loading branch information
JoesCat committed Jul 31, 2024
1 parent 78a625f commit adc1a60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions fix-ca.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ static void fix_ca_region (guchar *srcPTR, guchar *dstPTR,
gint x1, gint x2, gint y1, gint y2,
gboolean show_progress);
static gboolean fix_ca_dialog (gint32 drawable_ID, FixCaParams *params);
//static void preview_update (GimpPreview *preview, FixCaParams *params);
static void preview_update (GimpDrawablePreview *preview, FixCaParams *params);
static void preview_update (GtkWidget *widget, FixCaParams *params);
static int color_size (const Babl *format);
static gdouble get_pixel (guchar *ptr, gint bpc);
static void set_pixel (guchar *dest, gdouble d, gint bpc);
Expand Down Expand Up @@ -304,6 +303,7 @@ static void run (const gchar *name, gint nparams,
break;

case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init ("fix_ca", TRUE);
gimp_get_data (DATA_KEY_VALS, &fix_ca_params);
break;

Expand Down Expand Up @@ -614,9 +614,9 @@ static gboolean fix_ca_dialog (gint32 drawable_ID, FixCaParams *params)
return run;
}

//static void preview_update (GtkWidget *widget, FixCaParams *params)
static void preview_update (GimpDrawablePreview *preview, FixCaParams *params)
static void preview_update (GtkWidget *widget, FixCaParams *params)
{
GimpDrawablePreview *preview;
GimpPreview *ptr;
gint32 preview_ID;
gint b, i, j, x, y, width, height, xImg, yImg, bppImg, bpcImg, size;
Expand All @@ -625,8 +625,8 @@ static void preview_update (GimpDrawablePreview *preview, FixCaParams *params)
const Babl *format;
gdouble d;

/* GimpPreview is a subset of GimpScrolledPreview */
ptr = (GimpPreview *)(preview);
preview = GIMP_DRAWABLE_PREVIEW (widget);
ptr = GIMP_PREVIEW (preview);
gimp_preview_get_position (ptr, &x, &y);
gimp_preview_get_size (ptr, &width, &height);

Expand Down
8 changes: 4 additions & 4 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ 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:
update-test1:
echo "#!/bin/sh" > ${builddir}/test1.sh; \
echo "rm -f ${builddir}/test1.tga" >> ${builddir}/test1.sh; \
echo "rm -f ${builddir}/test1.bmp" >> ${builddir}/test1.sh; \
echo "${GIMPTOOL} --install-script ${srcdir}/test-fix-ca.scm" >> ${builddir}/test1.sh; \
echo "${GIMPTOOL} --install-bin ${builddir}/test-fix-ca" >> ${builddir}/test1.sh; \
echo "gimp --verbose --console-messages -i -b '(test \"${top_srcdir}/img-fix-ca/full-branches.jpg\" \"${builddir}/test1.bmp\" 6.0 -2.4 658 1280 1 0.0 0.0 0.0 0.0)' -b '(gimp-quit 0)'" >> ${builddir}/test1.sh; \
Expand All @@ -24,9 +24,9 @@ update-tests:
TESTS = ${builddir}/test1.sh

test1.sh:
make update-tests
make update-test1

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

.PHONY: update-tests
.PHONY: update-test1

0 comments on commit adc1a60

Please sign in to comment.