ARSD PNG memory usage

Joerg Joergonson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 19 09:14:29 PDT 2016


On Saturday, 18 June 2016 at 02:17:01 UTC, Adam D. Ruppe wrote:

I have an auto generator for pngs and 99% of the time it works, 
but every once in a while I get an error when loading the png's. 
Usually re-running the generator "fixes the problem" so it might 
be on my end. Regardless of where the problem stems, it would be 
nice to have more info why instead of a range violation. 
previousLine is null in the break.

All the png's generated are loadable by external app like 
ifranview, so they are not completely corrupt but possibly could 
have some thing that is screwing png.d up.


The code where the error happens is:

		case 3:
			auto arr = data.dup;
			foreach(i; 0 .. arr.length) {
				auto prev = i < bpp ? 0 : arr[i - bpp];
				arr[i] += cast(ubyte)
					/*std.math.floor*/( cast(int) (prev + previousLine[i]) / 2);
			}

Range violation at png.d(1815)

Any ideas?



More information about the Digitalmars-d-learn mailing list