diff options
author | Thomas White <taw@physics.org> | 2021-02-22 17:09:44 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-02-22 17:09:44 +0100 |
commit | 8bb397379fd4d6975a37ae43418ed1d27f145d39 (patch) | |
tree | 2462f5f51a9200bac0dcd060f29a597d610c143e /src | |
parent | 2dbbb8232cad0ec1dbb5bc8585d0cbbade8ff85c (diff) |
CrystFELImageView: Re-render a bit less often
Diffstat (limited to 'src')
-rw-r--r-- | src/crystfelimageview.c | 16 | ||||
-rw-r--r-- | src/crystfelimageview.h | 1 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c index 26e06bce..6540635a 100644 --- a/src/crystfelimageview.c +++ b/src/crystfelimageview.c @@ -45,6 +45,9 @@ #include "crystfelimageview.h" +static int rerender_image(CrystFELImageView *iv); + + static void scroll_interface_init(GtkScrollable *iface) { } @@ -526,6 +529,7 @@ static gint draw_sig(GtkWidget *window, cairo_t *cr, CrystFELImageView *iv) cairo_matrix_t m; if ( iv->image == NULL ) return FALSE; + if ( iv->need_rerender ) rerender_image(iv); cairo_save(cr); @@ -713,6 +717,7 @@ GtkWidget *crystfel_image_view_new() iv->peak_box_size = 1.0; iv->refl_box_size = 1.0; iv->label_refls = 1; + iv->need_rerender = 0; g_signal_connect(G_OBJECT(iv), "destroy", G_CALLBACK(destroy_sig), iv); @@ -931,6 +936,7 @@ static int rerender_image(CrystFELImageView *iv) } configure_scroll_adjustments(iv); + iv->need_rerender = 0; redraw(iv); return 0; @@ -958,7 +964,7 @@ void crystfel_image_view_set_brightness(CrystFELImageView *iv, double brightness) { iv->brightness = brightness; - rerender_image(iv); + iv->need_rerender = 1; } @@ -966,7 +972,7 @@ void crystfel_image_view_set_show_peaks(CrystFELImageView *iv, int show_peaks) { iv->show_peaks = show_peaks; - rerender_image(iv); + iv->need_rerender = 1; } @@ -974,7 +980,7 @@ void crystfel_image_view_set_show_reflections(CrystFELImageView *iv, int show_refls) { iv->show_refls = show_refls; - rerender_image(iv); + iv->need_rerender = 1; } @@ -982,7 +988,7 @@ void crystfel_image_view_set_label_reflections(CrystFELImageView *iv, int label_refls) { iv->label_refls = label_refls; - rerender_image(iv); + iv->need_rerender = 1; } @@ -990,6 +996,7 @@ void crystfel_image_view_set_peak_box_size(CrystFELImageView *iv, float box_size) { iv->peak_box_size = box_size; + iv->need_rerender = 1; } @@ -997,4 +1004,5 @@ void crystfel_image_view_set_refl_box_size(CrystFELImageView *iv, float box_size) { iv->refl_box_size = box_size; + iv->need_rerender = 1; } diff --git a/src/crystfelimageview.h b/src/crystfelimageview.h index 0ea2ab87..9e1bf4a1 100644 --- a/src/crystfelimageview.h +++ b/src/crystfelimageview.h @@ -67,6 +67,7 @@ struct _crystfelimageview double detector_h; /* Redraw/scroll stuff */ + int need_rerender; GtkScrollablePolicy hpol; GtkScrollablePolicy vpol; GtkAdjustment *hadj; |