aboutsummaryrefslogtreecommitdiff
path: root/src/crystfelimageview.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-06-29 15:05:03 +0200
committerThomas White <taw@physics.org>2020-07-29 18:53:44 +0200
commit1632be3733a4e15f3f7e1cc47eb497086c5ae59c (patch)
tree4e945f70fc0f81b698c0d5dbd30b3719b2d9e513 /src/crystfelimageview.c
parent3c3c8fcb6510438be6e5481ff6b7f300e21bea7d (diff)
Avoid double iteration
Diffstat (limited to 'src/crystfelimageview.c')
-rw-r--r--src/crystfelimageview.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c
index ca192f62..cb5021a0 100644
--- a/src/crystfelimageview.c
+++ b/src/crystfelimageview.c
@@ -689,37 +689,35 @@ static GdkPixbuf *render_panel(float *data, int *badmap, int w, int h,
{
guchar *pixbuf_data;
- int x, y;
+ long int i;
/* Rendered (colourful) version */
pixbuf_data = malloc(3*w*h);
if ( pixbuf_data == NULL ) return NULL;
- for ( y=0; y<h; y++ ) {
- for ( x=0; x<w; x++ ) {
+ for ( i=0; i<w*h; i++ ) {
double r, g, b;
- if ( !badmap[x+w*y] ) {
+ if ( !badmap[i] ) {
- colscale_lookup(data[x+w*y], scale_top,
+ colscale_lookup(data[i], scale_top,
scale_type, &r, &g, &b);
- pixbuf_data[3*(x+w*y)+0] = 255*r;
- pixbuf_data[3*(x+w*y)+1] = 255*g;
- pixbuf_data[3*(x+w*y)+2] = 255*b;
+ pixbuf_data[3*i+0] = 255*r;
+ pixbuf_data[3*i+1] = 255*g;
+ pixbuf_data[3*i+2] = 255*b;
} else {
/* Bad pixel indicator colour */
- pixbuf_data[3*( x+w*y )+0] = 30;
- pixbuf_data[3*( x+w*y )+1] = 20;
- pixbuf_data[3*( x+w*y )+2] = 0;
+ pixbuf_data[3*i+0] = 30;
+ pixbuf_data[3*i+1] = 20;
+ pixbuf_data[3*i+2] = 0;
}
}
- }
/* Create the pixbuf from the 8-bit display data */
return gdk_pixbuf_new_from_data(pixbuf_data,