When the bitmap is large, you get this exception:
Here are the sample parameter values:
pixelWidth 4391
pixelHeight 5159
x1 1197
y1 3400
x2 1197
y2 3516
I believe the issue is due to this snippet:
int index = x1s + ((y1 * pixelWidth) << PRECISION_SHIFT);
// Walk the line!
var inc = (pixelWidth << PRECISION_SHIFT) + incx;
for (int y = y1; y <= y2; ++y)
{
pixels[index >> PRECISION_SHIFT] = color;
index += inc;
}
y1 * pixelWidth grows pretty fast, so after PRESIZION_SHIFT it overflows easily (in this case it was just making the number negative.
It probably should be modified to read:
int index = x1s;
int baseValue = (y1 * pixelWidth);
// Walk the line!
var inc = (pixelWidth << PRECISION_SHIFT) + incx;
for (int y = y1; y <= y2; ++y)
{
pixels[baseValue + (index >> PRECISION_SHIFT)] = color;
index += inc;
}
Here are the sample parameter values:
pixelWidth 4391
pixelHeight 5159
x1 1197
y1 3400
x2 1197
y2 3516
I believe the issue is due to this snippet:
int index = x1s + ((y1 * pixelWidth) << PRECISION_SHIFT);
// Walk the line!
var inc = (pixelWidth << PRECISION_SHIFT) + incx;
for (int y = y1; y <= y2; ++y)
{
pixels[index >> PRECISION_SHIFT] = color;
index += inc;
}
y1 * pixelWidth grows pretty fast, so after PRESIZION_SHIFT it overflows easily (in this case it was just making the number negative.
It probably should be modified to read:
int index = x1s;
int baseValue = (y1 * pixelWidth);
// Walk the line!
var inc = (pixelWidth << PRECISION_SHIFT) + incx;
for (int y = y1; y <= y2; ++y)
{
pixels[baseValue + (index >> PRECISION_SHIFT)] = color;
index += inc;
}