From ea8e7bc35e5c09096c04f5c269451a330d59c49b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 13 Mar 2018 10:01:13 +0100 Subject: Nicer way of getting Git revision This will need a separate way to create the official releases (which shouldn't have Git revisions attached) --- src/geoptimiser.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/geoptimiser.c') diff --git a/src/geoptimiser.c b/src/geoptimiser.c index 36124e57..3d859a61 100644 --- a/src/geoptimiser.c +++ b/src/geoptimiser.c @@ -53,7 +53,6 @@ #include "detector.h" #include "stream.h" -#include "version.h" #include "crystal.h" #include "image.h" #include "utils.h" -- cgit v1.2.3 From 018bff49cd1f5fbd3071b092d0546be67147e893 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 21 Mar 2018 16:53:31 +0100 Subject: Separate tests for gdk-pixbuf-2.0 and GDK --- src/geoptimiser.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'src/geoptimiser.c') diff --git a/src/geoptimiser.c b/src/geoptimiser.c index 3d859a61..f63ba81b 100644 --- a/src/geoptimiser.c +++ b/src/geoptimiser.c @@ -44,11 +44,14 @@ #include #ifdef HAVE_CAIRO -#ifdef HAVE_GTK -#define HAVE_SAVE_TO_PNG 1 +#ifdef HAVE_GDK +#ifdef HAVE_GDKPIXBUF #include +#include #include -#endif /* HAVE_GTK */ +#define CAN_SAVE_TO_PNG +#endif /* HAVE_GDKPIXBUF */ +#endif /* HAVE_GDK */ #endif /* HAVE_CAIRO */ #include "detector.h" @@ -1636,7 +1639,7 @@ static double compute_rotation_and_stretch(struct rg_collection *connected, } -#ifdef HAVE_SAVE_TO_PNG +#ifdef CAN_SAVE_TO_PNG static void draw_panel(struct image *image, cairo_t *cr, cairo_matrix_t *basic_m, GdkPixbuf **pixbufs, int i) { @@ -1813,7 +1816,17 @@ static int save_data_to_png(char *filename, struct detector *det, return 0; } -#endif /* HAVE_SAVE_TO_PNG */ +#else /* CAN_SAVE_TO_PNG */ + +static int save_data_to_png(char *filename, struct detector *det, + struct gpanel *gpanels) +{ + ERROR("WARNING: geoptimiser was compiled without gdk-pixbuf and cairo " + "support. Error maps will not be saved.\n"); + return 0; /* Return "success" so that program continues */ +} + +#endif /* CAN_SAVE_TO_PNG */ int check_and_enforce_cspad_dist(struct geoptimiser_params *gparams, @@ -2212,8 +2225,6 @@ int optimize_geometry(struct geoptimiser_params *gparams, STATUS("Saving error map before correction.\n"); -#ifdef HAVE_SAVE_TO_PNG - if ( save_data_to_png("error_map_before.png", det, gpanels) ) { ERROR("Error while writing data to file.\n"); free(conn_data); @@ -2221,12 +2232,6 @@ int optimize_geometry(struct geoptimiser_params *gparams, return 1; } -#else /* HAVE_SAVE_TO_PNG */ - - ERROR("WARNING: geoptimiser was compiled without GTK and cairo " - "support. Error maps will not be saved.\n"); - -#endif /* HAVE_SAVE_TO_PNG */ } @@ -2265,7 +2270,7 @@ int optimize_geometry(struct geoptimiser_params *gparams, if ( gparams->error_maps ) { -#ifdef HAVE_SAVE_TO_PNG +#ifdef CAN_SAVE_TO_PNG STATUS("Saving error map after correction.\n"); @@ -2276,12 +2281,12 @@ int optimize_geometry(struct geoptimiser_params *gparams, return 1; } -#else /* HAVE_SAVE_TO_PNG */ +#else /* CAN_SAVE_TO_PNG */ - STATUS("ERROR: geoptimiser was compiled without GTK and cairo " + STATUS("geoptimiser was compiled without GTK and Cairo " "support.\n Error maps will not be saved.\n"); -#endif /* HAVE_SAVE_TO_PNG */ +#endif /* CAN_SAVE_TO_PNG */ } @@ -2301,12 +2306,12 @@ int optimize_geometry(struct geoptimiser_params *gparams, STATUS("All done!\n"); if ( gparams->error_maps ) { -#ifdef HAVE_SAVE_TO_PNG +#ifdef CAN_SAVE_TO_PNG STATUS("Be sure to inspect error_map_before.png and " "error_map_after.png !!\n"); -#endif /* HAVE_SAVE_TO_PNG */ +#endif /* CAN_SAVE_TO_PNG */ } free(conn_data); -- cgit v1.2.3