diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-10-30 02:06:35 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-10-30 02:06:35 -0400 |
commit | 7dcf2843272e122ebbaff2f090d630e4f9436d1c (patch) | |
tree | 3d63a2223b8adfb596c19b8fd1d95f0a4bc48296 /libdimension/png.c | |
parent | d615d6795ee81e59795081b7fb2524978b6aa9cb (diff) | |
download | dimension-7dcf2843272e122ebbaff2f090d630e4f9436d1c.tar.xz |
Don't flip optimized PNG writes.
Diffstat (limited to 'libdimension/png.c')
-rw-r--r-- | libdimension/png.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libdimension/png.c b/libdimension/png.c index bc547a1..20190d8 100644 --- a/libdimension/png.c +++ b/libdimension/png.c @@ -306,8 +306,9 @@ dmnsn_png_write_canvas_impl(dmnsn_progress *progress, dmnsn_array_get(canvas->optimizers, i, &optimizer); if (optimizer.optimizer_fn == &dmnsn_png_optimizer_fn) { for (y = 0; y < height; ++y) { - png_write_row(png_ptr, - (png_bytep)((uint16_t *)optimizer.ptr + 4*y*width)); + /* Invert the rows. PNG coordinates are fourth quadrant. */ + uint16_t *row = (uint16_t *)optimizer.ptr + 4*(height - y - 1)*width; + png_write_row(png_ptr, (png_bytep)row); dmnsn_increment_progress(progress); } |