- unsigned nchans = png_get_channels(priv->png, priv->info);
- if(nchans==4 && data.fmt==RGB)
- png_set_strip_alpha(priv->png);
+ data.data = new char[data.stride*data.height];
+
+ if(interlace==PNG_INTERLACE_ADAM7)
+ {
+ // ADAM7 requires all rows to be loaded at once
+ unsigned n_passes = png_set_interlace_handling(priv->png);
+ rows = new png_byte *[data.height];
+ for(unsigned y=0; y<data.height; ++y)
+ rows[y] = reinterpret_cast<png_byte *>(data.data+data.stride*(data.height-1-y));