diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-08-08 21:11:55 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-08-08 21:11:55 -0500 |
commit | cad0150d12bd0d4b8f75153068f4fae03d03c4df (patch) | |
tree | 6b3db6b1382a8b5129a70e554c9612f6d5963412 /example.c | |
parent | ee427ad39a95e10e2f0b6c57c979a352421f7a08 (diff) | |
download | libpng-cad0150d12bd0d4b8f75153068f4fae03d03c4df.tar.gz |
[libpng16] Corrected handling of row_pointers in example.c and added some
comments. It has apparently been wrong since libpng-1.0.1c (confusing
use of a 1D and a 2D array for the image source).
Diffstat (limited to 'example.c')
-rw-r--r-- | example.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -968,12 +968,14 @@ void write_png(char *file_name /* , ... other image information ... */) * use the first method if you aren't handling interlacing yourself. */ png_uint_32 k, height, width; - png_byte image[height][width*bytes_per_pixel]; + /* In this example, "image" is a one-dimensional array of bytes */ + png_byte image[height*width*bytes_per_pixel]; png_bytep row_pointers[height]; if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) png_error (png_ptr, "Image is too tall to process in memory"); + /* Set up pointers into your "image" byte array */ for (k = 0; k < height; k++) row_pointers[k] = image + k*width*bytes_per_pixel; |