aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ambigator.c1
-rw-r--r--src/cell_explorer.c1
-rw-r--r--src/check_hkl.c1
-rw-r--r--src/cl-utils.c4
-rw-r--r--src/compare_hkl.c1
-rw-r--r--src/diffraction-gpu.c4
-rw-r--r--src/diffraction-gpu.h2
-rw-r--r--src/dw-hdfsee.c9
-rw-r--r--src/geoptimiser.c54
-rw-r--r--src/get_hkl.c1
-rw-r--r--src/hdfsee-render.c39
-rw-r--r--src/hdfsee-render.h16
-rw-r--r--src/hdfsee.c1
-rw-r--r--src/indexamajig.c1
-rw-r--r--src/list_events.c1
-rw-r--r--src/partial_sim.c1
-rw-r--r--src/partialator.c1
-rw-r--r--src/pattern_sim.c1
-rw-r--r--src/process_hkl.c1
-rw-r--r--src/render_hkl.c1
-rw-r--r--src/whirligig.c1
21 files changed, 63 insertions, 79 deletions
diff --git a/src/ambigator.c b/src/ambigator.c
index bf733c24..bbf1d06e 100644
--- a/src/ambigator.c
+++ b/src/ambigator.c
@@ -44,7 +44,6 @@
#include <gsl/gsl_permutation.h>
#include <gsl/gsl_randist.h>
-#include "version.h"
#include <image.h>
#include <utils.h>
#include <symmetry.h>
diff --git a/src/cell_explorer.c b/src/cell_explorer.c
index f3ec7cb7..94e7e985 100644
--- a/src/cell_explorer.c
+++ b/src/cell_explorer.c
@@ -40,7 +40,6 @@
#include <gdk/gdkkeysyms.h>
#include <gsl/gsl_multifit_nlin.h>
-#include "version.h"
#include "stream.h"
#include "image.h"
#include "utils.h"
diff --git a/src/check_hkl.c b/src/check_hkl.c
index 1657eb6f..018200cf 100644
--- a/src/check_hkl.c
+++ b/src/check_hkl.c
@@ -40,7 +40,6 @@
#include <gsl/gsl_fit.h>
#include <assert.h>
-#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "symmetry.h"
diff --git a/src/cl-utils.c b/src/cl-utils.c
index a7e500cd..b3ce0de0 100644
--- a/src/cl-utils.c
+++ b/src/cl-utils.c
@@ -34,11 +34,7 @@
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_CL_CL_H
#include <CL/cl.h>
-#else
-#include <cl.h>
-#endif
#include "utils.h"
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index fd988b89..feb79879 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -43,7 +43,6 @@
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_fit.h>
-#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "symmetry.h"
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c
index ea50b3fa..8c21586a 100644
--- a/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -38,11 +38,7 @@
#include <string.h>
#include <complex.h>
-#ifdef HAVE_CL_CL_H
#include <CL/cl.h>
-#else
-#include <cl.h>
-#endif
#include "image.h"
#include "utils.h"
diff --git a/src/diffraction-gpu.h b/src/diffraction-gpu.h
index 0b0e364b..bef12a8e 100644
--- a/src/diffraction-gpu.h
+++ b/src/diffraction-gpu.h
@@ -38,7 +38,7 @@
struct gpu_context;
-#if HAVE_OPENCL
+#ifdef HAVE_OPENCL
extern int get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
int na, int nb, int nc, UnitCell *ucell,
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index c1bb39cc..c5c4d85a 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -1653,7 +1653,8 @@ static gint displaywindow_save_response(GtkWidget *d, gint response,
"Therefore, it can't be saved as TIFF.");
r = 0;
} else {
- r = render_tiff_fp(dw, dw->image, file);
+ r = render_tiff_fp(dw->image, file, dw->min_x,
+ dw->max_x, dw->min_y, dw->max_y);
}
} else if ( type == 2 ) {
if ( !single_panel_data_source(dw->image->det, NULL) ) {
@@ -1662,8 +1663,10 @@ static gint displaywindow_save_response(GtkWidget *d, gint response,
"Therefore, it can't be saved as TIFF.");
r = 0;
} else {
- r = render_tiff_int16(dw, dw->image, file,
- dw->boostint);
+ r = render_tiff_int16(dw->image, file,
+ dw->boostint, dw->min_x,
+ dw->max_x, dw->min_y,
+ dw->max_y);
}
} else if ( type == 3 ) {
if ( !single_panel_data_source(dw->image->det, NULL) ) {
diff --git a/src/geoptimiser.c b/src/geoptimiser.c
index 5962df71..9b03d1b9 100644
--- a/src/geoptimiser.c
+++ b/src/geoptimiser.c
@@ -44,16 +44,18 @@
#include <gsl/gsl_sort.h>
#ifdef HAVE_CAIRO
-#ifdef HAVE_GTK
-#define HAVE_SAVE_TO_PNG 1
+#ifdef HAVE_GDK
+#ifdef HAVE_GDKPIXBUF
#include <cairo.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
-#endif /* HAVE_GTK */
+#define CAN_SAVE_TO_PNG
+#endif /* HAVE_GDKPIXBUF */
+#endif /* HAVE_GDK */
#endif /* HAVE_CAIRO */
#include "detector.h"
#include "stream.h"
-#include "version.h"
#include "crystal.h"
#include "image.h"
#include "utils.h"
@@ -1664,7 +1666,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)
@@ -1943,7 +1945,27 @@ static int save_stretch_to_png(char *filename, struct detector *det,
return 0;
}
-#endif /* HAVE_SAVE_TO_PNG */
+#else /* CAN_SAVE_TO_PNG */
+
+static int save_stretch_to_png(char *filename, struct detector *det,
+ struct rg_collection *connected,
+ struct connected_data *conn_data)
+{
+ 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 */
+}
+
+
+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,
@@ -2477,8 +2499,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);
@@ -2486,12 +2506,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 */
}
@@ -2558,7 +2572,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");
@@ -2569,12 +2583,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 */
}
@@ -2594,12 +2608,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);
diff --git a/src/get_hkl.c b/src/get_hkl.c
index 5dddc5be..efd06c94 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -38,7 +38,6 @@
#include <unistd.h>
#include <getopt.h>
-#include "version.h"
#include "utils.h"
#include "reflist-utils.h"
#include "symmetry.h"
diff --git a/src/hdfsee-render.c b/src/hdfsee-render.c
index 5e1de2f1..d9da469e 100644
--- a/src/hdfsee-render.c
+++ b/src/hdfsee-render.c
@@ -30,15 +30,16 @@
#include <config.h>
#endif
-#ifdef HAVE_GTK
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
#include <stdlib.h>
#include <math.h>
#include <stdint.h>
#include <assert.h>
+
+#ifdef HAVE_GDKPIXBUF
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#endif
+
#ifdef HAVE_TIFF
#include <tiffio.h>
#endif
@@ -46,8 +47,6 @@
#include <render.h>
#include <image.h>
-#include "dw-hdfsee.h"
-
static float *get_binned_panel(struct image *image, int binning,
int pi, double *max, int *pw, int *ph)
{
@@ -107,6 +106,8 @@ static float *get_binned_panel(struct image *image, int binning,
}
+#ifdef HAVE_GDKPIXBUF
+
/* NB This function is shared between render_get_image() and
* render_get_colour_scale() */
static void render_free_data(guchar *data, gpointer p)
@@ -260,17 +261,15 @@ GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale)
w, h, w*3, render_free_data, NULL);
}
+#endif /* HAVE_GDKPIXBUF */
-int render_tiff_fp(DisplayWindow *dw, struct image *image, const char *filename)
+int render_tiff_fp(struct image *image, const char *filename, int min_x, int max_x,
+ int min_y, int max_y)
{
#ifdef HAVE_TIFF
TIFF *th;
int16_t *line;
int x, y;
- int min_x = (int)dw->min_x;
- int max_x = (int)dw->max_x;
- int min_y = (int)dw->min_y;
- int max_y = (int)dw->max_y;
int width = max_x - min_x;
int height = max_y - min_y;
float *buf;
@@ -331,24 +330,20 @@ int render_tiff_fp(DisplayWindow *dw, struct image *image, const char *filename)
TIFFClose(th);
free(buf);
-#else
+#else /* HAVE_TIFF */
STATUS("No TIFF support.\n");
-#endif
+#endif /* HAVE_TIFF */
return 0;
}
-int render_tiff_int16(DisplayWindow *dw, struct image *image,
- const char *filename, double boost)
+int render_tiff_int16(struct image *image, const char *filename, double boost,
+ int min_x, int max_x, int min_y, int max_y)
{
#ifdef HAVE_TIFF
TIFF *th;
int16_t *line;
int x, y;
- int min_x = (int)dw->min_x;
- int max_x = (int)dw->max_x;
- int min_y = (int)dw->min_y;
- int max_y = (int)dw->max_y;
int width = max_x - min_x;
int height = max_y - min_y;
int16_t *buf;
@@ -417,10 +412,8 @@ int render_tiff_int16(DisplayWindow *dw, struct image *image,
TIFFClose(th);
free(buf);
-#else
+#else /* HAVE_TIFF */
STATUS("No TIFF support.\n");
-#endif
+#endif /* HAVE_TIFF */
return 0;
}
-
-#endif /* HAVE_GTK */
diff --git a/src/hdfsee-render.h b/src/hdfsee-render.h
index 7e87b79e..414e6ecd 100644
--- a/src/hdfsee-render.h
+++ b/src/hdfsee-render.h
@@ -33,25 +33,21 @@
#include <config.h>
#endif
-
-#ifdef HAVE_GTK
-
+#ifdef HAVE_GDKPIXBUF
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "dw-hdfsee.h"
-
extern GdkPixbuf **render_panels(struct image *image,
int binning, int scale, double boost,
int *n_pixbufs);
extern GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale);
-extern int render_tiff_fp(DisplayWindow *dw, struct image *image,
- const char *filename);
-extern int render_tiff_int16(DisplayWindow *dw, struct image *image,
- const char *filename, double boost);
+#endif /* HAVE_GDKPIXBUF */
-#endif /* HAVE_GTK */
+extern int render_tiff_fp(struct image *image, const char *filename, int min_x,
+ int max_x, int min_y, int max_y);
+extern int render_tiff_int16(struct image *image, const char *filename, double boost,
+ int min_x, int max_x, int min_y, int max_y);
#endif /* HDFSEE_RENDER_H */
diff --git a/src/hdfsee.c b/src/hdfsee.c
index aa8dfc8e..954eb762 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -37,7 +37,6 @@
#include <gtk/gtk.h>
#include <getopt.h>
-#include "version.h"
#include "dw-hdfsee.h"
#include "utils.h"
#include "render.h"
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 9eaf9ae2..38d83d58 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -49,7 +49,6 @@
#include <sys/stat.h>
#include <fcntl.h>
-#include "version.h"
#include "utils.h"
#include "hdf5-file.h"
#include "index.h"
diff --git a/src/list_events.c b/src/list_events.c
index 44087233..ce48478b 100644
--- a/src/list_events.c
+++ b/src/list_events.c
@@ -38,7 +38,6 @@
#include <unistd.h>
#include <getopt.h>
-#include "version.h"
#include "utils.h"
#include "detector.h"
#include "hdf5-file.h"
diff --git a/src/partial_sim.c b/src/partial_sim.c
index fc7845c1..218780fd 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -42,7 +42,6 @@
#include <pthread.h>
#include <gsl/gsl_rng.h>
-#include "version.h"
#include "image.h"
#include "utils.h"
#include "reflist-utils.h"
diff --git a/src/partialator.c b/src/partialator.c
index 0541e54a..e152db7c 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -54,7 +54,6 @@
#include <cell.h>
#include <cell-utils.h>
-#include "version.h"
#include "scaling.h"
#include "post-refinement.h"
#include "merge.h"
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 52ed6d48..6c9eb880 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -42,7 +42,6 @@
#include <getopt.h>
#include <hdf5.h>
-#include "version.h"
#include "image.h"
#include "diffraction.h"
#include "diffraction-gpu.h"
diff --git a/src/process_hkl.c b/src/process_hkl.c
index 12d4340f..ab5b9af1 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -43,7 +43,6 @@
#include <unistd.h>
#include <getopt.h>
-#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "reflist-utils.h"
diff --git a/src/render_hkl.c b/src/render_hkl.c
index 3952940e..a8fc852e 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -45,7 +45,6 @@
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
-#include "version.h"
#include "utils.h"
#include "symmetry.h"
#include "render.h"
diff --git a/src/whirligig.c b/src/whirligig.c
index e8829880..f5a435c2 100644
--- a/src/whirligig.c
+++ b/src/whirligig.c
@@ -43,7 +43,6 @@
#include <utils.h>
#include <stream.h>
-#include "version.h"
#include "cell-utils.h"
#include "integer_matrix.h"
#include "reflist.h"