diff options
author | Thomas White <taw@bitwiz.org.uk> | 2010-09-18 20:52:05 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:26:58 +0100 |
commit | 350610979b4b7e4965d3a0ca9f0e07dd1226ed0d (patch) | |
tree | 1aaa5ad7619d7bf512687bf29e750d19458b41ac | |
parent | a18d82f77c335f962475ce65008c697756293320 (diff) |
cubeit: PNG fixes
-rw-r--r-- | src/cubeit.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cubeit.c b/src/cubeit.c index 49cf27cd..bed617df 100644 --- a/src/cubeit.c +++ b/src/cubeit.c @@ -289,7 +289,7 @@ static void write_slice(const char *filename, double *vals, int z, png_structp png_ptr; png_infop info_ptr; png_bytep *row_pointers; - int x, y; + int x, y, zf; float max = 0.0; int w, h; int pw, ph; @@ -300,17 +300,19 @@ static void write_slice(const char *filename, double *vals, int z, w = xs; h = ys; + for ( zf=0; zf<zs; zf++ ) { for ( y=0; y<h; y++ ) { for ( x=0; x<w; x++ ) { float val; - val = vals[xs*ys*z + xs*y + x]; + val = vals[xs*ys*zf + xs*y + x]; if ( val > max ) max = val; } } + } fh = fopen(filename, "wb"); if ( !fh ) { @@ -370,7 +372,7 @@ static void write_slice(const char *filename, double *vals, int z, } } - for ( y=0; y<ph/2+1; y++ ) { + for ( y=0; y<ph/2; y++ ) { png_bytep scratch; scratch = row_pointers[y]; row_pointers[y] = row_pointers[ph-y-1]; @@ -692,7 +694,6 @@ int main(int argc, char *argv[]) if ( !worker_active[i] ) goto free; - /* Tell the thread to exit */ struct process_args *pargs = worker_args[i]; pthread_mutex_lock(&pargs->control_mutex); |