diff options
author | Thomas White <taw@physics.org> | 2020-06-29 10:07:28 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:44 +0200 |
commit | 93be7a848a320d8eaa0966f57aa56b0337525d4c (patch) | |
tree | f9845857911fac1d29f52f31692b882c80218a4c | |
parent | 1550f5d2323deb24ba14e7b7396a44045e49a8b3 (diff) |
Avoid reloading image data when colour scale is changed
-rw-r--r-- | src/crystfelimageview.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c index d6e898b6..35636a73 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) { } @@ -675,10 +678,6 @@ static void detgeom_pixel_extents(struct detgeom *det, static int reload_image(CrystFELImageView *iv) { - int n_pb; - double min_x, min_y, max_x, max_y; - double border; - if ( iv->dtempl == NULL ) return 0; if ( iv->filename == NULL ) return 0; @@ -690,6 +689,16 @@ static int reload_image(CrystFELImageView *iv) return 1; } + return rerender_image(iv); +} + + +static int rerender_image(CrystFELImageView *iv) +{ + int n_pb; + double min_x, min_y, max_x, max_y; + double border; + iv->pixbufs = render_panels(iv->image, 1, SCALE_COLOUR, iv->brightness, &n_pb); if ( n_pb != iv->image->detgeom->n_panels ) { @@ -778,5 +787,5 @@ void crystfel_image_view_set_brightness(CrystFELImageView *iv, double brightness) { iv->brightness = brightness; - reload_image(iv); + rerender_image(iv); } |