- /* turn on interlace handling */
- if (info_ptr->interlace_type)
- number_passes = png_set_interlace_handling(png_ptr);
- else
- number_passes = 1;
-// printf("NP = %d ", number_passes);
+ /* turn on interlace handling */
+ int number_passes;
+ if (info_ptr->interlace_type)
+ number_passes = png_set_interlace_handling(png_ptr);
+ else
+ number_passes = 1;
+ // printf("NP = %d ", number_passes);
+
+ // don't use the object to prevent warnings from VC++ about "unportable
+ // interaction between setjmp and C++ object destruction" (this is a correct
+ // warning, of course!)
+ wxPNGReaderIter *iter = new wxPNGReaderIter(this);
+ for (int pass=0; pass< number_passes; pass++)
+ {
+ iter->upset();
+ int y=0;
+ do {
+ //(unsigned char *)iter.GetRow();
+ if (info_ptr->interlace_type) {
+ if (pass>0)
+ iter->GetRow(row_pointers, row_stride);
+ png_read_row(png_ptr, row_pointers, NULL);
+ }
+ else
+ png_read_row(png_ptr, row_pointers, NULL);