summaryrefslogtreecommitdiffstats
path: root/libdimension/png.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-10-30 02:06:35 -0400
committerTavian Barnes <tavianator@gmail.com>2009-10-30 02:06:35 -0400
commit7dcf2843272e122ebbaff2f090d630e4f9436d1c (patch)
tree3d63a2223b8adfb596c19b8fd1d95f0a4bc48296 /libdimension/png.c
parentd615d6795ee81e59795081b7fb2524978b6aa9cb (diff)
downloaddimension-7dcf2843272e122ebbaff2f090d630e4f9436d1c.tar.xz
Don't flip optimized PNG writes.
Diffstat (limited to 'libdimension/png.c')
-rw-r--r--libdimension/png.c5
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);
}