From bff7f2b3b440c30d0d6eb692576af57ef42edd1b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 8 Jul 2009 17:12:02 +0000 Subject: Comments and style adjustments, and a couple fixes. --- tests/png.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/png.c') diff --git a/tests/png.c b/tests/png.c index 8db6d63..0949f8b 100644 --- a/tests/png.c +++ b/tests/png.c @@ -40,12 +40,14 @@ main() { /* Set the resilience low for tests */ dmnsn_set_resilience(DMNSN_SEVERITY_LOW); + /* Allocate a canvas */ canvas = dmnsn_new_canvas(3*x, y); if (!canvas) { fprintf(stderr, "--- Allocation of canvas failed! ---\n"); return EXIT_FAILURE; } + /* Optimize the canvas for PNG export */ if (dmnsn_png_optimize_canvas(canvas) != 0) { dmnsn_delete_canvas(canvas); fprintf(stderr, "--- Couldn't optimize canvas for PNG! ---\n"); @@ -110,6 +112,8 @@ main() { } } + /* Write the image to PNG */ + ofile = fopen("dimension1.png", "wb"); if (!ofile) { fprintf(stderr, "--- Opening 'dimension1.png' for writing failed! ---\n"); @@ -137,6 +141,8 @@ main() { fclose(ofile); dmnsn_delete_canvas(canvas); + /* Read the image back from the PNG file */ + ifile = fopen("dimension1.png", "rb"); if (!ifile) { fprintf(stderr, "--- Opening 'dimension1.png' for reading failed! ---\n"); @@ -160,6 +166,8 @@ main() { fclose(ifile); + /* ... and write it back again */ + ofile = fopen("dimension2.png", "wb"); if (!ofile) { fprintf(stderr, "--- Opening 'dimension2.png' for writing failed! ---\n"); -- cgit v1.2.3