UIImageScanlineFloodfill
UIImageScanlineFloodfill copied to clipboard
Random crash (exc bad access)
Hi guys. Thank you for the algorithm.
I have found out that it crashes randomly when running on device with one particular picture.
If you fix this line
if (y<height)
{
byteIndex = (bytesPerRow * MIN(height,roundf(y + 1))) + roundf(x) * bytesPerPixel;
color = getColorCode(byteIndex, imageData);
to
if (y<height-2)
{
byteIndex = (bytesPerRow * MIN(height,roundf(y + 1))) + roundf(x) * bytesPerPixel;
color = getColorCode(byteIndex, imageData);
It is stable.
I have no idea why does it happen, but it does :)
cheers.
It is more stable, but still happening to me.