]> git.pld-linux.org Git - packages/povray.git/blob - povray-png_with_pvm.patch
- ver. 3.50c
[packages/povray.git] / povray-png_with_pvm.patch
1 diff -ru povray31/source/frame.h povray31.fixed/source/frame.h
2 --- povray31/source/frame.h     Sat May  1 15:01:17 1999
3 +++ povray31.fixed/source/frame.h       Fri Nov  9 00:19:38 2001
4 @@ -1453,6 +1453,7 @@
5      COLOUR *line_data, int *line_number);
6    void (*Read_Image_p) (IMAGE *Image, char *filename);
7    void (*Close_File_p) (struct file_handle_struct *handle);
8 +  void *private;
9  };
10  
11  #define Open_File(h,n,wd,ht,sz,m) ((*((h)->Open_File_p)) (h,n,wd,ht,sz,m))
12 diff -ru povray31/source/png_pov.c povray31.fixed/source/png_pov.c
13 --- povray31/source/png_pov.c   Sat May  1 15:01:24 1999
14 +++ povray31.fixed/source/png_pov.c     Fri Nov  9 09:04:21 2001
15 @@ -71,8 +71,8 @@
16  #define FLUSH_DIST (*width >= 640 ? 10 : 6400 / *width)
17  */
18  #define FLUSH_DIST ((opts.Options & BUFFERED_OUTPUT && \
19 -                     handle->buffer_size > (*width * png_stride * 5)) ? \
20 -                    (handle->buffer_size / (*width * png_stride)): \
21 +                     handle->buffer_size > (*width * povpng_info->png_stride * 5)) ? \
22 +                    (handle->buffer_size / (*width * povpng_info->png_stride)): \
23                      (*width >= 640 ? 10 : 6400 / *width))
24  
25  #define NTEXT 15     /* Maximum number of tEXt comment blocks */
26 @@ -83,23 +83,22 @@
27  /*****************************************************************************
28  * Local typedefs
29  ******************************************************************************/
30 +typedef struct povpng_info_struct POVPNG_INFO;
31  
32 -
33 +struct povpng_info_struct {
34 +       png_structp png_ptr;
35 +       png_infop   info_ptr;
36 +       png_structp o_png_ptr;
37 +       png_bytep   row_ptr;
38 +       int         png_stride;
39 +       char        tmp_fname[FILE_NAME_LENGTH];
40 +       FILE       *tmp_fp;
41 +};
42  
43  /*****************************************************************************
44  * Local variables
45  ******************************************************************************/
46  
47 -static png_struct *png_ptr  = NULL;
48 -static png_info   *info_ptr = NULL;
49 -static png_struct *o_png_ptr  = NULL;
50 -static png_byte   *row_ptr  = NULL;
51 -static int        png_stride;
52 -static char       tmp_fname[FILE_NAME_LENGTH];
53 -static FILE       *tmp_fp = NULL;
54 -
55 -
56 -
57  /*****************************************************************************
58  * Static functions
59  ******************************************************************************/
60 @@ -155,6 +154,7 @@
61  FILE_HANDLE *Get_Png_File_Handle()
62  {
63    FILE_HANDLE *handle;
64 +  POVPNG_INFO *povpng_info;
65    
66    handle = (FILE_HANDLE *)POV_MALLOC(sizeof(FILE_HANDLE), "PNG file handle");
67  
68 @@ -169,6 +169,16 @@
69    handle->file = NULL;
70    handle->buffer = NULL;
71    
72 +  povpng_info = (POVPNG_INFO *)POV_MALLOC(sizeof(POVPNG_INFO), "PNG file info");
73 +  
74 +  povpng_info->png_ptr = NULL;
75 +  povpng_info->info_ptr = NULL;
76 +  povpng_info->o_png_ptr = NULL;
77 +  povpng_info->row_ptr = NULL;
78 +  povpng_info->tmp_fp = NULL;
79 +  
80 +  handle->private = (void *)povpng_info;
81 +  
82    return (handle);
83  }
84  
85 @@ -262,8 +272,11 @@
86  
87  static int Open_Png_File(FILE_HANDLE *handle, char *name, int *width, int *height, int buffer_size, int mode)
88  {
89 +  POVPNG_INFO *povpng_info;
90 +  
91    handle->mode = mode;
92    handle->filename = name;
93 +  povpng_info = (POVPNG_INFO *)(handle->private);
94    
95    switch (mode)
96    {
97 @@ -280,7 +293,7 @@
98         * need to use the path, or the rename will fail if the temp file
99         * is not on the same drive as the output file.
100         */
101 -      sprintf(tmp_fname, "%s%s.tpn", opts.Output_Path, opts.Scene_Name);
102 +      sprintf(povpng_info->tmp_fname, "%s%s.tpn", opts.Output_Path, opts.Scene_Name);
103  
104        /* Move the old output file to a temporary file, so it can be
105         * read in and simultaneously written out to the new output file.
106 @@ -289,27 +302,27 @@
107         * to check if a temp file already exists, in case the transfer
108         * has been previously aborted.
109         */
110 -      if ((tmp_fp = fopen(tmp_fname,READ_BINFILE_STRING)) == NULL)
111 +      if ((povpng_info->tmp_fp = fopen(povpng_info->tmp_fname,READ_BINFILE_STRING)) == NULL)
112        {
113          /* The temp file doesn't exist.  Try the original file. */
114 -        if ((tmp_fp = fopen(name,READ_BINFILE_STRING)) == NULL)
115 +        if ((povpng_info->tmp_fp = fopen(name,READ_BINFILE_STRING)) == NULL)
116          {
117            Status_Info("\n");
118            return(0);  /* Neither file exists - start from scratch. */
119          }
120          else /* The original file exists, but the temp file doesn't. */
121          {
122 -          fclose(tmp_fp);
123 +          fclose(povpng_info->tmp_fp);
124  
125 -          if (RENAME_FILE(name,tmp_fname) == RENAME_FILE_ERR)
126 +          if (RENAME_FILE(name,povpng_info->tmp_fname) == RENAME_FILE_ERR)
127            {
128              Error("\nError making temporary PNG file for continuing trace.\n");
129            }
130  
131            /* Open the original file (now with a new name) for reading */
132 -          if ((tmp_fp = fopen(tmp_fname,READ_BINFILE_STRING)) == NULL)
133 +          if ((povpng_info->tmp_fp = fopen(povpng_info->tmp_fname,READ_BINFILE_STRING)) == NULL)
134            {
135 -            RENAME_FILE(tmp_fname,name); /* Try to rename back - not crucial */
136 +            RENAME_FILE(povpng_info->tmp_fname,name); /* Try to rename back - not crucial */
137              Error("\nError opening temporary PNG file for continuing trace.\n");
138            }
139          }
140 @@ -320,11 +333,11 @@
141         */
142        else if((handle->file = fopen(name,READ_BINFILE_STRING)) != NULL)
143        {
144 -        fclose(tmp_fp);
145 +        fclose(povpng_info->tmp_fp);
146          fclose(handle->file);
147  
148          Error_Line("\nBoth original and temporary PNG files exist after an interrupted trace.\n");
149 -        Error("Please delete either %s or %s (preferrably the smaller).\n",name,tmp_fname);
150 +        Error("Please delete either %s or %s (preferrably the smaller).\n",name,povpng_info->tmp_fname);
151        }
152  
153        /* Try to open the new output file for writing.  If we can't, try
154 @@ -335,8 +348,8 @@
155        {
156          Status_Info("\n");
157  
158 -        fclose(tmp_fp);
159 -        RENAME_FILE(tmp_fname,name);
160 +        fclose(povpng_info->tmp_fp);
161 +        RENAME_FILE(povpng_info->tmp_fname,name);
162          return(-1);
163        }
164  
165 @@ -349,14 +362,14 @@
166        handle->buffer_size = buffer_size;
167  
168        /* The original input file */
169 -      if ((o_png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
170 +      if ((povpng_info->o_png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
171                         (png_voidp)FALSE, png_pov_err, png_pov_warn)) == NULL ||
172 -          (info_ptr = png_create_info_struct(o_png_ptr)) == NULL)
173 +          (povpng_info->info_ptr = png_create_info_struct(povpng_info->o_png_ptr)) == NULL)
174        {
175          Error("Error allocating PNG data structures");
176        }
177  
178 -      if (setjmp(o_png_ptr->jmpbuf))
179 +      if (setjmp(povpng_info->o_png_ptr->jmpbuf))
180        {
181          /* If we get here, we had a problem reading the file */
182          Status_Info("\n");
183 @@ -367,23 +380,23 @@
184            handle->buffer = NULL;
185          }
186  
187 -        png_destroy_read_struct(&o_png_ptr, &info_ptr, (png_infopp)NULL);
188 +        png_destroy_read_struct(&(povpng_info->o_png_ptr), &(povpng_info->info_ptr), (png_infopp)NULL);
189  
190          fclose(handle->file);
191          handle->file = NULL;
192 -        fclose(tmp_fp);
193 -        tmp_fp = NULL;
194 +        fclose(povpng_info->tmp_fp);
195 +        povpng_info->tmp_fp = NULL;
196  
197          return(0);
198        }
199  
200        /* Set up the compression structure */
201 -      png_init_io(o_png_ptr, tmp_fp);
202 +      png_init_io(povpng_info->o_png_ptr, povpng_info->tmp_fp);
203  
204        /* Read in header info from the file */
205 -      png_read_info(o_png_ptr, info_ptr);
206 +      png_read_info(povpng_info->o_png_ptr, povpng_info->info_ptr);
207  
208 -      if (info_ptr->color_type & ~(PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA))
209 +      if (povpng_info->info_ptr->color_type & ~(PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA))
210        {
211          return(0);
212        }
213 @@ -391,13 +404,13 @@
214        Status_Info("\nResuming interrupted trace from %s",handle->filename);
215  
216        /* The new output file.  Thank god for re-entrant libpng/libz code! */
217 -      if ((png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
218 +      if ((povpng_info->png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
219                       (png_voidp)TRUE, png_pov_err, png_pov_warn)) == NULL)
220        {
221          Error("Error allocating PNG data structures");
222        }
223  
224 -      if (setjmp(png_ptr->jmpbuf))
225 +      if (setjmp(povpng_info->png_ptr->jmpbuf))
226        {
227          /* If we get here, we had a problem writing the file */
228          Status_Info("\n");
229 @@ -408,78 +421,78 @@
230            handle->buffer = NULL;
231          }
232  
233 -        png_destroy_read_struct(&o_png_ptr, &info_ptr, (png_infopp)NULL);
234 -        png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
235 +        png_destroy_read_struct(&(povpng_info->o_png_ptr), &(povpng_info->info_ptr), (png_infopp)NULL);
236 +        png_destroy_write_struct(&(povpng_info->png_ptr), (png_infopp)NULL);
237  
238          fclose(handle->file);
239          handle->file = NULL;
240 -        fclose(tmp_fp);
241 -        tmp_fp = NULL;
242 +        fclose(povpng_info->tmp_fp);
243 +        povpng_info->tmp_fp = NULL;
244  
245          if (DELETE_FILE(name) != DELETE_FILE_ERR)
246          {
247 -          RENAME_FILE(tmp_fname,name);  /* Try to get the original file back */
248 +          RENAME_FILE(povpng_info->tmp_fname,name);  /* Try to get the original file back */
249          }
250  
251          return(-1);
252        }
253  
254        /* Set up the compression structure */
255 -      png_init_io(png_ptr, handle->file);
256 +      png_init_io(povpng_info->png_ptr, handle->file);
257  
258        /* Fill in the relevant image information from the resumed file */
259 -      *width = handle->width = info_ptr->width;
260 -      *height = handle->height = info_ptr->height;
261 +      *width = handle->width = povpng_info->info_ptr->width;
262 +      *height = handle->height = povpng_info->info_ptr->height;
263  
264        /* Find out if file is a valid format, and if it had Alpha in it */
265 -      if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
266 +      if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
267        {
268          opts.Options |= OUTPUT_ALPHA;
269        }
270  
271 -      if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
272 +      if ((povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
273        {
274          opts.Options |= HF_GRAY_16;
275          opts.PaletteOption = GREY;       /* Force grayscale preview */
276        }
277  
278  #if defined(PNG_READ_sBIT_SUPPORTED)
279 -      if (info_ptr->valid & PNG_INFO_sBIT)
280 +      if (povpng_info->info_ptr->valid & PNG_INFO_sBIT)
281        {
282 -        if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
283 +        if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR)
284          {
285 -          opts.OutputQuality = info_ptr->sig_bit.red;
286 +          opts.OutputQuality = povpng_info->info_ptr->sig_bit.red;
287          }
288          else
289          {
290 -          opts.OutputQuality = info_ptr->sig_bit.gray;
291 +          opts.OutputQuality = povpng_info->info_ptr->sig_bit.gray;
292          }
293        }
294  
295  #else /* !PNG_READ_sBIT_SUPPORTED */
296 -      if (info_ptr->bit_depth == 8 && opts.OutputQuality > 8 ||
297 -          info_ptr->bit_depth == 16 && opts.OutputQuality <= 8)
298 +      if (povpng_info->info_ptr->bit_depth == 8 && opts.OutputQuality > 8 ||
299 +          povpng_info->info_ptr->bit_depth == 16 && opts.OutputQuality <= 8)
300        {
301          Error("\nSpecified color depth +fn%d not the same as depth %d in %s\n",
302 -              opts.OutputQuality, info_ptr->bit_depth, name);
303 +              opts.OutputQuality, povpng_info->info_ptr->bit_depth, name);
304        }
305  #endif /* !PNG_READ_sBIT_SUPPORTED */
306  
307  #if defined(PNG_READ_oFFs_SUPPORTED)
308 -      opts.First_Column = info_ptr->x_offset;
309 -      opts.First_Line   = info_ptr->y_offset;
310 +      opts.First_Column = povpng_info->info_ptr->x_offset;
311 +      opts.First_Line   = povpng_info->info_ptr->y_offset;
312  #endif /* PNG_READ_oFFs_SUPPORTED */
313  
314 -      png_write_info(png_ptr, info_ptr);
315 +      png_write_info(povpng_info->png_ptr, povpng_info->info_ptr);
316  
317 -      png_stride = info_ptr->color_type & PNG_COLOR_MASK_COLOR ? 3 : 1;
318 +      povpng_info->png_stride = povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR ? 3 : 1;
319  
320 -      if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
321 -        png_stride++;
322 +      if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
323 +        povpng_info->png_stride++;
324  
325 -      png_stride *= (opts.OutputQuality + 7) / 8;
326 +      povpng_info->png_stride *= (opts.OutputQuality + 7) / 8;
327  
328 -      row_ptr = (png_byte *)POV_MALLOC(*width*png_stride,"PNG read row buffer");
329 +      povpng_info->row_ptr = (png_byte *)POV_MALLOC(*width*povpng_info->png_stride,"PNG read row buffer");
330        break;
331  
332      case WRITE_MODE:
333 @@ -502,14 +515,14 @@
334  
335        handle->buffer_size = buffer_size;
336  
337 -      if ((png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
338 +      if ((povpng_info->png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
339                       (png_voidp)TRUE, png_pov_err, png_pov_warn)) == NULL ||
340 -          (info_ptr = png_create_info_struct(png_ptr)) == NULL)
341 +          (povpng_info->info_ptr = png_create_info_struct(povpng_info->png_ptr)) == NULL)
342        {
343          Error("Error allocating PNG data structures");
344        }
345  
346 -      if (setjmp(png_ptr->jmpbuf))
347 +      if (setjmp(povpng_info->png_ptr->jmpbuf))
348        {
349          /* If we get here, we had a problem writing the file */
350          if (handle->buffer != NULL)
351 @@ -518,7 +531,7 @@
352            handle->buffer = NULL;
353          }
354  
355 -        png_destroy_write_struct(&png_ptr, &info_ptr);
356 +        png_destroy_write_struct(&(povpng_info->png_ptr), &(povpng_info->info_ptr));
357  
358          fclose(handle->file);
359          handle->file = NULL;
360 @@ -528,71 +541,71 @@
361  
362        /* Set up the compression structure */
363  
364 -      png_init_io(png_ptr, handle->file);
365 +      png_init_io(povpng_info->png_ptr, handle->file);
366  
367        /* Fill in the relevant image information */
368  
369 -      info_ptr->width = handle->width = *width;
370 -      info_ptr->height = handle->height = *height;
371 +      povpng_info->info_ptr->width = handle->width = *width;
372 +      povpng_info->info_ptr->height = handle->height = *height;
373  
374 -      info_ptr->bit_depth = 8 * ((opts.OutputQuality + 7) / 8);
375 +      povpng_info->info_ptr->bit_depth = 8 * ((opts.OutputQuality + 7) / 8);
376  
377        if (opts.Options & HF_GRAY_16)
378        {
379 -        info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
380 +        povpng_info->info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
381        }
382        else
383        {
384 -        info_ptr->color_type = PNG_COLOR_TYPE_RGB;
385 +        povpng_info->info_ptr->color_type = PNG_COLOR_TYPE_RGB;
386        }
387  
388        if (opts.Options & OUTPUT_ALPHA)
389        {
390 -        info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
391 +        povpng_info->info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
392        }
393  
394  #if defined(PNG_WRITE_sBIT_SUPPORTED)
395 -      if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
396 +      if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR)
397        {
398 -        info_ptr->sig_bit.red =
399 -        info_ptr->sig_bit.green =
400 -        info_ptr->sig_bit.blue = opts.OutputQuality;
401 +        povpng_info->info_ptr->sig_bit.red =
402 +        povpng_info->info_ptr->sig_bit.green =
403 +        povpng_info->info_ptr->sig_bit.blue = opts.OutputQuality;
404        }
405        else
406        {
407 -        info_ptr->sig_bit.gray = opts.OutputQuality;
408 +        povpng_info->info_ptr->sig_bit.gray = opts.OutputQuality;
409        }
410  
411 -      if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
412 +      if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
413        {
414 -        info_ptr->sig_bit.alpha = opts.OutputQuality;
415 +        povpng_info->info_ptr->sig_bit.alpha = opts.OutputQuality;
416        }
417  
418 -      info_ptr->valid |= PNG_INFO_sBIT;
419 +      povpng_info->info_ptr->valid |= PNG_INFO_sBIT;
420  #endif /* PNG_WRITE_sBIT_SUPPORTED */
421  
422  #if defined(PNG_WRITE_gAMA_SUPPORTED)
423        if (handle->file_type & (IMAGE_FTYPE | GRAY_FTYPE))
424        {
425 -        info_ptr->gamma = 1.0/opts.DisplayGamma;
426 -        info_ptr->valid |= PNG_INFO_gAMA;
427 +        povpng_info->info_ptr->gamma = 1.0/opts.DisplayGamma;
428 +        povpng_info->info_ptr->valid |= PNG_INFO_gAMA;
429        }
430        else if (handle->file_type & (HIST_FTYPE | HF_FTYPE))
431        {
432 -        info_ptr->gamma = 1.0;
433 -        info_ptr->valid |= PNG_INFO_gAMA;
434 +        povpng_info->info_ptr->gamma = 1.0;
435 +        povpng_info->info_ptr->valid |= PNG_INFO_gAMA;
436        }
437  #endif /* PNG_WRITE_gAMA_SUPPORTED */
438  
439  #if defined(PNG_WRITE_oFFs_SUPPORTED)
440        if (opts.First_Column != 0 || opts.First_Line != 0)
441        {
442 -        info_ptr->x_offset = opts.First_Column;
443 -        info_ptr->y_offset = opts.First_Line;
444 +        povpng_info->info_ptr->x_offset = opts.First_Column;
445 +        povpng_info->info_ptr->y_offset = opts.First_Line;
446  
447 -        info_ptr->offset_unit_type = PNG_OFFSET_PIXEL;
448 +        povpng_info->info_ptr->offset_unit_type = PNG_OFFSET_PIXEL;
449  
450 -        info_ptr->valid |= PNG_INFO_oFFs;
451 +        povpng_info->info_ptr->valid |= PNG_INFO_oFFs;
452        }
453  #endif /* PNG_WRITE_oFFs_SUPPORTED */
454  
455 @@ -605,22 +618,22 @@
456         */
457        }
458  
459 -      png_write_info(png_ptr, info_ptr);
460 +      png_write_info(povpng_info->png_ptr, povpng_info->info_ptr);
461  
462 -      png_stride = info_ptr->color_type & PNG_COLOR_MASK_COLOR ? 3 : 1;
463 +      povpng_info->png_stride = povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR ? 3 : 1;
464  
465 -      if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
466 -        png_stride++;
467 +      if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
468 +        povpng_info->png_stride++;
469  
470 -      png_stride *= (opts.OutputQuality + 7) / 8;
471 +      povpng_info->png_stride *= (opts.OutputQuality + 7) / 8;
472  
473 -      row_ptr = (png_byte *)POV_MALLOC(*width*png_stride, "PNG write row buffer");
474 +      povpng_info->row_ptr = (png_byte *)POV_MALLOC(*width*povpng_info->png_stride, "PNG write row buffer");
475  
476  #if defined(PNG_WRITE_FLUSH_SUPPORTED)
477        /* Set libpng to flush the output buffers every few lines, so that
478         * in case of a rude crash we don't lose very much data.
479         */
480 -      png_set_flush(png_ptr, FLUSH_DIST);
481 +      png_set_flush(povpng_info->png_ptr, FLUSH_DIST);
482  #endif /* PNG_WRITE_FLUSH_SUPPORTED */
483  
484        break;
485 @@ -628,7 +641,7 @@
486      case APPEND_MODE:
487  
488  #if defined(PNG_WRITE_FLUSH_SUPPORTED)
489 -      if (setjmp(png_ptr->jmpbuf))
490 +      if (setjmp(povpng_info->png_ptr->jmpbuf))
491        {
492          /* If we get here, we had a problem writing the file */
493  
494 @@ -638,7 +651,7 @@
495            handle->buffer = NULL;
496          }
497  
498 -        png_destroy_write_struct(&png_ptr, &info_ptr);
499 +        png_destroy_write_struct(&(povpng_info->png_ptr), &(povpng_info->info_ptr));
500  
501          fclose(handle->file);
502          handle->file = NULL;
503 @@ -649,8 +662,8 @@
504        /* Write out the data in the PNG/zlib buffers, and set automatic
505         * flushing for every few scanlines, in case of a rude crash.
506         */
507 -      png_write_flush(png_ptr);
508 -      png_set_flush(png_ptr, FLUSH_DIST);
509 +      png_write_flush(povpng_info->png_ptr);
510 +      png_set_flush(povpng_info->png_ptr, FLUSH_DIST);
511  #else  /* !PNG_WRITE_FLUSH_SUPPORTED */
512        fflush(handle->file);
513  #endif /* PNG_WRITE_FLUSH_SUPPORTED */
514 @@ -664,7 +677,7 @@
515            handle->buffer = NULL;
516          }
517  
518 -        png_destroy_write_struct(&png_ptr, &info_ptr);
519 +        png_destroy_write_struct(&(povpng_info->png_ptr), &(povpng_info->info_ptr));
520  
521          return(0);
522        }
523 @@ -672,14 +685,14 @@
524        /* Delete the temporary data file.  Note that the new output file
525         * is all ready to go - nothing needs to be done here.
526         */
527 -      if (tmp_fp != NULL)
528 +      if (povpng_info->tmp_fp != NULL)
529        {
530 -        fclose(tmp_fp);
531 -        tmp_fp = NULL;
532 +        fclose(povpng_info->tmp_fp);
533 +        povpng_info->tmp_fp = NULL;
534  
535 -        if (DELETE_FILE(tmp_fname) == DELETE_FILE_ERR)
536 +        if (DELETE_FILE(povpng_info->tmp_fname) == DELETE_FILE_ERR)
537          {
538 -          Warning(0.0,"Can't delete temporary PNG file %s.  Please delete it.\n",tmp_fname);
539 +          Warning(0.0,"Can't delete temporary PNG file %s.  Please delete it.\n",povpng_info->tmp_fname);
540          }
541        }
542    }
543 @@ -723,6 +736,9 @@
544    register int col, j;
545    int himask;
546    int color;
547 +  POVPNG_INFO *povpng_info;
548 +  
549 +  povpng_info = (POVPNG_INFO *)(handle->private);
550  
551  
552    /*
553 @@ -745,142 +761,142 @@
554  
555        himask = 0xFF ^ ((1 << (8 - opts.OutputQuality)) - 1);
556  
557 -      if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
558 +      if ((povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
559        {
560 -        for (col = j = 0; col < handle->width; col++, j += png_stride)
561 +        for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
562          {
563            color = (png_byte)floor((line_data[col][RED]*0.30 +
564                                     line_data[col][GREEN]*0.59 +
565                                     line_data[col][BLUE]*0.11) * 255.0);
566  
567            /* Use left-bit replication (LBR) for bit depths < 8 */
568 -          row_ptr[j] = color & himask;
569 -          row_ptr[j] |= color >> opts.OutputQuality;
570 +          povpng_info->row_ptr[j] = color & himask;
571 +          povpng_info->row_ptr[j] |= color >> opts.OutputQuality;
572  
573            /* Handle Alpha here if needed - must use exact bit replication
574             * instead of truncation or 100... termination
575             */
576 -          if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
577 +          if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
578            {
579              color = 255 - (int)floor(line_data[col][TRANSM] * 255.0);
580  
581 -            row_ptr[j + 1] = color & himask;
582 -            row_ptr[j + 1] |= color >> opts.OutputQuality;
583 +            povpng_info->row_ptr[j + 1] = color & himask;
584 +            povpng_info->row_ptr[j + 1] |= color >> opts.OutputQuality;
585            }
586          }
587        }
588        else
589        {
590 -        for (col = j = 0; col < handle->width; col++, j += png_stride)
591 +        for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
592          {
593            color = (int)floor(line_data[col][RED]   * 255.0);
594  
595 -          row_ptr[j] = color & himask;
596 -          row_ptr[j] |= color >> opts.OutputQuality;
597 +          povpng_info->row_ptr[j] = color & himask;
598 +          povpng_info->row_ptr[j] |= color >> opts.OutputQuality;
599  
600            color = (int)floor(line_data[col][GREEN] * 255.0);
601  
602 -          row_ptr[j + 1] = color & himask;
603 -          row_ptr[j + 1] |= color >> opts.OutputQuality;
604 +          povpng_info->row_ptr[j + 1] = color & himask;
605 +          povpng_info->row_ptr[j + 1] |= color >> opts.OutputQuality;
606  
607            color = (int)floor(line_data[col][BLUE]  * 255.0);
608  
609 -          row_ptr[j + 2] = color & himask;
610 -          row_ptr[j + 2] |= color >> opts.OutputQuality;
611 +          povpng_info->row_ptr[j + 2] = color & himask;
612 +          povpng_info->row_ptr[j + 2] |= color >> opts.OutputQuality;
613  
614            /* Handle Alpha here if needed */
615 -          if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
616 +          if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
617            {
618              color = 255 - (int)floor(line_data[col][TRANSM] * 255.0);
619  
620 -            row_ptr[j + 3] = color & himask;
621 -            row_ptr[j + 3] |= color >> opts.OutputQuality;
622 +            povpng_info->row_ptr[j + 3] = color & himask;
623 +            povpng_info->row_ptr[j + 3] |= color >> opts.OutputQuality;
624            }
625          }
626        }
627        break;
628  
629      case 8:
630 -      if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
631 +      if ((povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
632        {
633 -        for (col = j = 0; col < handle->width; col++, j += png_stride)
634 +        for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
635          {
636 -          row_ptr[j] = (png_byte)floor((line_data[col][RED]*0.30 +
637 +          povpng_info->row_ptr[j] = (png_byte)floor((line_data[col][RED]*0.30 +
638                                          line_data[col][GREEN]*0.59 +
639                                          line_data[col][BLUE]*0.11) * 255.0);
640  
641            /* Handle Alpha here if needed */
642 -          if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
643 +          if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
644            {
645 -            row_ptr[j+1] = (png_byte)(255-floor(line_data[col][TRANSM]*255.0));
646 +            povpng_info->row_ptr[j+1] = (png_byte)(255-floor(line_data[col][TRANSM]*255.0));
647            }
648          }
649        }
650        else
651        {
652 -        for (col = j = 0; col < handle->width; col++, j += png_stride)
653 +        for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
654          {
655 -          row_ptr[j] = (png_byte)floor(line_data[col][RED]   * 255.0);
656 -          row_ptr[j + 1] = (png_byte)floor(line_data[col][GREEN] * 255.0);
657 -          row_ptr[j + 2] = (png_byte)floor(line_data[col][BLUE]  * 255.0);
658 +          povpng_info->row_ptr[j] = (png_byte)floor(line_data[col][RED]   * 255.0);
659 +          povpng_info->row_ptr[j + 1] = (png_byte)floor(line_data[col][GREEN] * 255.0);
660 +          povpng_info->row_ptr[j + 2] = (png_byte)floor(line_data[col][BLUE]  * 255.0);
661  
662            /* Handle Alpha here if needed */
663 -          if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
664 +          if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
665            {
666 -            row_ptr[j+3] = (png_byte)(255-floor(line_data[col][TRANSM]*255.0));
667 +            povpng_info->row_ptr[j+3] = (png_byte)(255-floor(line_data[col][TRANSM]*255.0));
668            }
669          }
670        }
671        break;
672  
673      case 16:
674 -      if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
675 +      if ((povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
676        {
677 -        for (col = j = 0; col < handle->width; col++, j += png_stride)
678 +        for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
679          {
680            color = (int)floor((line_data[col][RED]*0.30 +
681                                line_data[col][GREEN]*0.59 +
682                                line_data[col][BLUE]*0.11) * 65535.0);
683  
684 -          row_ptr[j] = color >> 8;
685 -          row_ptr[j + 1] = color & 0xFF;
686 +          povpng_info->row_ptr[j] = color >> 8;
687 +          povpng_info->row_ptr[j + 1] = color & 0xFF;
688  
689            /* Handle Alpha here if needed */
690 -          if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
691 +          if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
692            {
693              color = 65535 - (int)floor(line_data[col][TRANSM]  * 65535.0);
694  
695 -            row_ptr[j + 2] = color >> 8;
696 -            row_ptr[j + 3] = color & 0xFF;
697 +            povpng_info->row_ptr[j + 2] = color >> 8;
698 +            povpng_info->row_ptr[j + 3] = color & 0xFF;
699            }
700          }
701        }
702        else
703        {
704 -        for (col = j = 0; col < handle->width; col++, j += png_stride)
705 +        for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
706          {
707            color = (int)floor(line_data[col][RED]   * 65535.0);
708  
709 -          row_ptr[j] = color >> 8;
710 -          row_ptr[j + 1] = color & 0xFF;
711 +          povpng_info->row_ptr[j] = color >> 8;
712 +          povpng_info->row_ptr[j + 1] = color & 0xFF;
713  
714            color = (int)floor(line_data[col][GREEN] * 65535.0);
715  
716 -          row_ptr[j + 2] = color >> 8;
717 -          row_ptr[j + 3] = color & 0xFF;
718 +          povpng_info->row_ptr[j + 2] = color >> 8;
719 +          povpng_info->row_ptr[j + 3] = color & 0xFF;
720  
721            color = (int)floor(line_data[col][BLUE]  * 65535.0);
722  
723 -          row_ptr[j + 4] = color >> 8;
724 -          row_ptr[j + 5] = color & 0xFF;
725 +          povpng_info->row_ptr[j + 4] = color >> 8;
726 +          povpng_info->row_ptr[j + 5] = color & 0xFF;
727  
728            /* Handle Alpha here if needed */
729 -          if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
730 +          if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
731            {
732              color = 65535 - (int)floor(line_data[col][TRANSM]  * 65535.0);
733  
734 -            row_ptr[j + 6] = color >> 8;
735 -            row_ptr[j + 7] = color & 0xFF;
736 +            povpng_info->row_ptr[j + 6] = color >> 8;
737 +            povpng_info->row_ptr[j + 7] = color & 0xFF;
738            }
739          }
740        }
741 @@ -890,60 +906,60 @@
742        /* Handle shifting for arbitrary output bit depth */
743        himask = 0xFF ^ ((1 << (16 - opts.OutputQuality)) - 1);
744  
745 -      if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
746 +      if ((povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
747        {
748 -        for (col = j = 0; col < handle->width; col++, j += png_stride)
749 +        for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
750          {
751            color = (int)floor((line_data[col][RED]*0.30 +
752                                line_data[col][GREEN]*0.59 +
753                                line_data[col][BLUE]*0.11) * 65535.0);
754  
755 -          row_ptr[j] = color >> 8;
756 -          row_ptr[j + 1] = color & himask;
757 +          povpng_info->row_ptr[j] = color >> 8;
758 +          povpng_info->row_ptr[j + 1] = color & himask;
759  
760 -          if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
761 +          if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
762            {
763              color = 65535 - (int)floor(line_data[col][TRANSM] * 65535.0);
764  
765 -            row_ptr[j + 2] = color >> 8;
766 -            row_ptr[j + 3] = color & himask;
767 -            row_ptr[j + 3] |= color >> opts.OutputQuality;
768 +            povpng_info->row_ptr[j + 2] = color >> 8;
769 +            povpng_info->row_ptr[j + 3] = color & himask;
770 +            povpng_info->row_ptr[j + 3] |= color >> opts.OutputQuality;
771            }
772          }
773        }
774        else
775        {
776 -        for (col = j = 0; col < handle->width; col++, j += png_stride)
777 +        for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
778          {
779            color = (int)floor(line_data[col][RED]   * 65535.0);
780  
781 -          row_ptr[j] = color >> 8;
782 -          row_ptr[j + 1] = color & himask;
783 +          povpng_info->row_ptr[j] = color >> 8;
784 +          povpng_info->row_ptr[j + 1] = color & himask;
785  
786            color = (int)floor(line_data[col][GREEN] * 65535.0);
787  
788 -          row_ptr[j + 2] = color >> 8;
789 -          row_ptr[j + 3] = color & himask;
790 +          povpng_info->row_ptr[j + 2] = color >> 8;
791 +          povpng_info->row_ptr[j + 3] = color & himask;
792  
793            color = (int)floor(line_data[col][BLUE]  * 65535.0);
794  
795 -          row_ptr[j + 4] = color >> 8;
796 -          row_ptr[j + 5] = color & himask;
797 +          povpng_info->row_ptr[j + 4] = color >> 8;
798 +          povpng_info->row_ptr[j + 5] = color & himask;
799  
800            /* Handle Alpha here if needed */
801 -          if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
802 +          if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
803            {
804              color = 65535 - (int)floor(line_data[col][TRANSM]  * 65535.0);
805  
806 -            row_ptr[j + 6] = color >> 8;
807 -            row_ptr[j + 7] = color & himask;
808 -            row_ptr[j + 7] |= color >> opts.OutputQuality;
809 +            povpng_info->row_ptr[j + 6] = color >> 8;
810 +            povpng_info->row_ptr[j + 7] = color & himask;
811 +            povpng_info->row_ptr[j + 7] |= color >> opts.OutputQuality;
812            }
813          }
814        }
815    }
816  
817 -  if (setjmp(png_ptr->jmpbuf))
818 +  if (setjmp(povpng_info->png_ptr->jmpbuf))
819    {
820      /* If we get here, we had a problem writing the file */
821      fclose(handle->file);
822 @@ -953,7 +969,7 @@
823    }
824  
825    /* Write out a scanline */
826 -  png_write_row(png_ptr, row_ptr);
827 +  png_write_row(povpng_info->png_ptr, povpng_info->row_ptr);
828  
829    /* Close and reopen file (if not stdout) for integrity in case we crash */
830    if (handle->buffer_size == 0 && !(opts.Options & TO_STDOUT))
831 @@ -995,8 +1011,11 @@
832  static int Read_Png_Line(FILE_HANDLE *handle, COLOUR *line_data, int *line_number)
833  {
834    register int col, j, step;
835 +  POVPNG_INFO *povpng_info;
836 +  
837 +  povpng_info = (POVPNG_INFO *)(handle->private);
838  
839 -  if (setjmp(o_png_ptr->jmpbuf))
840 +  if (setjmp(povpng_info->o_png_ptr->jmpbuf))
841    {
842      /* If we get here, we had a problem reading the file, which probably
843       * means that we have read all the available data, rather than a real
844 @@ -1006,29 +1025,29 @@
845      return(0);
846    }
847  
848 -  if (setjmp(png_ptr->jmpbuf))
849 +  if (setjmp(povpng_info->png_ptr->jmpbuf))
850    {
851      /* If we get here, we had a problem writing the new file */
852      Status_Info("\n");
853  
854      fclose(handle->file);
855      handle->file = NULL;
856 -    fclose(tmp_fp);
857 -    tmp_fp = NULL;
858 +    fclose(povpng_info->tmp_fp);
859 +    povpng_info->tmp_fp = NULL;
860  
861      if (DELETE_FILE(handle->filename) != DELETE_FILE_ERR)
862      {
863 -      RENAME_FILE(tmp_fname,handle->filename); /* Move original file back */
864 +      RENAME_FILE(povpng_info->tmp_fname,handle->filename); /* Move original file back */
865      }
866  
867      return(-1);
868    }
869  
870    /* Read in another row if available */
871 -  png_read_row(o_png_ptr, row_ptr, NULL);
872 +  png_read_row(povpng_info->o_png_ptr, povpng_info->row_ptr, NULL);
873  
874    /* We won't get here if there was a read error */
875 -  png_write_row(png_ptr, row_ptr);
876 +  png_write_row(povpng_info->png_ptr, povpng_info->row_ptr);
877  
878    if (*line_number % 32 == 31)
879      Status_Info(".");
880 @@ -1042,33 +1061,33 @@
881     */
882  
883    /* How many bytes in a sample */
884 -  step = (info_ptr->bit_depth <= 8) ? 1 : 2;
885 +  step = (povpng_info->info_ptr->bit_depth <= 8) ? 1 : 2;
886  
887 -  if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
888 +  if ((povpng_info->info_ptr->color_type & PNG_COLOR_MASK_COLOR) == PNG_COLOR_TYPE_GRAY)
889    {
890 -    for (col = j = 0; col < handle->width; col++, j += png_stride)
891 +    for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
892      {
893 -      line_data[col][RED] = (DBL)row_ptr[j] / 255.0;
894 -      line_data[col][GREEN] = (DBL)row_ptr[j] / 255.0;
895 -      line_data[col][BLUE] = (DBL)row_ptr[j] / 255.0;
896 +      line_data[col][RED] = (DBL)(povpng_info->row_ptr[j]) / 255.0;
897 +      line_data[col][GREEN] = (DBL)(povpng_info->row_ptr[j]) / 255.0;
898 +      line_data[col][BLUE] = (DBL)(povpng_info->row_ptr[j]) / 255.0;
899  
900 -      if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
901 +      if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
902        {
903 -        line_data[col][TRANSM] = (DBL)(255 - row_ptr[j + step]) / 255.0;
904 +        line_data[col][TRANSM] = (DBL)(255 - povpng_info->row_ptr[j + step]) / 255.0;
905        }
906      }
907    }
908    else
909    {
910 -    for (col = j = 0; col < handle->width; col++, j += png_stride)
911 +    for (col = j = 0; col < handle->width; col++, j += povpng_info->png_stride)
912      {
913 -      line_data[col][RED] = (DBL)row_ptr[j] / 255.0;
914 -      line_data[col][GREEN] = (DBL)row_ptr[j + step] / 255.0;
915 -      line_data[col][BLUE] = (DBL)row_ptr[j + 2*step] / 255.0;
916 +      line_data[col][RED] = (DBL)(povpng_info->row_ptr[j]) / 255.0;
917 +      line_data[col][GREEN] = (DBL)(povpng_info->row_ptr[j + step]) / 255.0;
918 +      line_data[col][BLUE] = (DBL)(povpng_info->row_ptr[j + 2*step]) / 255.0;
919  
920 -      if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
921 +      if (povpng_info->info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
922        {
923 -        line_data[col][TRANSM] = (DBL)(255 - row_ptr[j + 3*step]) / 255.0;
924 +        line_data[col][TRANSM] = (DBL)(255 - povpng_info->row_ptr[j + 3*step]) / 255.0;
925        }
926      }
927    }
928 @@ -1077,9 +1096,9 @@
929     * the next row!
930     */
931  #if defined(PNG_READ_oFFS_SUPPORTED)
932 -  *line_number = info_ptr->y_offset + png_ptr->row_number - 1;
933 +  *line_number = povpng_info->info_ptr->y_offset + povpng_info->png_ptr->row_number - 1;
934  #else
935 -  *line_number = png_ptr->row_number - 1;
936 +  *line_number = povpng_info->png_ptr->row_number - 1;
937  #endif
938  
939    return(1);
940 @@ -1127,6 +1146,9 @@
941                     "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
942  #endif
943  #endif
944 +  POVPNG_INFO *povpng_info;
945 +  
946 +  povpng_info = (POVPNG_INFO *)(handle->private);
947  
948    /* Why are we here? */
949  
950 @@ -1137,18 +1159,18 @@
951  
952    if (handle->mode == WRITE_MODE || handle->mode == APPEND_MODE)
953    {
954 -    if (png_ptr != NULL)
955 +    if (povpng_info->png_ptr != NULL)
956      {
957 -      if (setjmp(png_ptr->jmpbuf))
958 +      if (setjmp(povpng_info->png_ptr->jmpbuf))
959        {
960          /* If we get here, we had a problem writing the file */
961  
962 -        png_destroy_write_struct(&png_ptr, &info_ptr);
963 +        png_destroy_write_struct(&(povpng_info->png_ptr), &(povpng_info->info_ptr));
964  
965 -        if (row_ptr != NULL)
966 +        if (povpng_info->row_ptr != NULL)
967          {
968 -          POV_FREE(row_ptr);
969 -          row_ptr = NULL;
970 +          POV_FREE(povpng_info->row_ptr);
971 +          povpng_info->row_ptr = NULL;
972          }
973  
974          if (handle->file != NULL)
975 @@ -1166,19 +1188,19 @@
976          Error("Error writing PNG file.");
977        }
978  
979 -      if(png_ptr->row_number < png_ptr->num_rows)
980 +      if(povpng_info->png_ptr->row_number < povpng_info->png_ptr->num_rows)
981        {
982           /* finished prematurely - trick into thinking done*/
983 -         png_ptr->num_rows = png_ptr->row_number;
984 -         png_write_finish_row(png_ptr);
985 +         povpng_info->png_ptr->num_rows = povpng_info->png_ptr->row_number;
986 +         png_write_finish_row(povpng_info->png_ptr);
987        }
988  
989  #ifdef POV_COMMENTS /* temporarily skip comment writing code */
990 -      if (info_ptr != NULL)
991 +      if (povpng_info->info_ptr != NULL)
992        {
993  #if defined(PNG_WRITE_tIME_SUPPORTED)
994 -        png_convert_from_time_t(&info_ptr->mod_time, tstart);
995 -        info_ptr->valid = PNG_INFO_tIME;
996 +        png_convert_from_time_t(&(povpng_info->info_ptr->mod_time), tstart);
997 +        povpng_info->info_ptr->valid = PNG_INFO_tIME;
998  #endif /* PNG_WRITE_tIME_SUPPORTED */
999  
1000  #if defined(PNG_WRITE_tEXt_SUPPORTED)
1001 @@ -1214,9 +1236,9 @@
1002          /* Print the image "creation" time in RFC 1123 format */
1003          text_ptr[++index].key = "Creation Time";
1004          sprintf(bigtext, "%02d %3s %4d %02d:%02d:%02d GMT",
1005 -                info_ptr->mod_time.day, months[info_ptr->mod_time.month],
1006 -                info_ptr->mod_time.year, info_ptr->mod_time.hour, 
1007 -                info_ptr->mod_time.minute, info_ptr->mod_time.second);
1008 +                povpng_info->info_ptr->mod_time.day, months[povpng_info->info_ptr->mod_time.month],
1009 +                povpng_info->info_ptr->mod_time.year, povpng_info->info_ptr->mod_time.hour, 
1010 +                povpng_info->info_ptr->mod_time.minute, povpng_info->info_ptr->mod_time.second);
1011          text_ptr[index].text_length = strlen(bigtext);
1012          text_ptr[index].text = (char *)POV_MALLOC(text_ptr[index].text_length + 1, "PNG comment");
1013          strcpy(text_ptr[index].text, bigtext);
1014 @@ -1290,8 +1312,8 @@
1015        }
1016  #endif  /* POV_COMMENTS */ 
1017  
1018 -      png_write_end(png_ptr, info_ptr);
1019 -      png_destroy_write_struct(&png_ptr, &info_ptr);
1020 +      png_write_end(povpng_info->png_ptr, povpng_info->info_ptr);
1021 +      png_destroy_write_struct(&(povpng_info->png_ptr), &(povpng_info->info_ptr));
1022  
1023  #ifdef POV_COMMENTS
1024        if (text_ptr != NULL)
1025 @@ -1311,10 +1333,10 @@
1026  
1027      }
1028  
1029 -    if (row_ptr != NULL)
1030 +    if (povpng_info->row_ptr != NULL)
1031      {
1032 -      POV_FREE(row_ptr);
1033 -      row_ptr = NULL;
1034 +      POV_FREE(povpng_info->row_ptr);
1035 +      povpng_info->row_ptr = NULL;
1036      }
1037  
1038      if (handle->file != NULL && !(opts.Options & TO_STDOUT))
1039 @@ -1331,9 +1353,9 @@
1040    }
1041    else /* READ_MODE */
1042    {
1043 -    if (o_png_ptr != NULL)
1044 +    if (povpng_info->o_png_ptr != NULL)
1045      {
1046 -      png_destroy_read_struct(&o_png_ptr, (png_infopp)NULL, (png_infopp)NULL);
1047 +      png_destroy_read_struct(&(povpng_info->o_png_ptr), (png_infopp)NULL, (png_infopp)NULL);
1048      }
1049    }
1050  }
1051
This page took 0.256414 seconds and 3 git commands to generate.