Quote Originally Posted by Lifepower
The Bresenham's algorithm has branching in the inner loop, which may be slower; your routine, on the other hand, may produce non-solid lines because you advance on both axes simultaneously, which may give errors with lack of precision.

The alternative I suggested produces Bresenham looking lines without branching in the inner loop and is faster than both - it has one less increment in the inner loop than your routine and suffers less with lack of precision. The only drawback is slightly higher setup cost (max and min functions can be branch less, by the way). It requires minimal modifications to your code, so I suggest you try it.
Hi Lifepower,
I can see your point that your alternative may be faster in the inner loop as it only has 1 increment instead of 2.

On the other hand, my unmodified version shouldn't produce non-solid lines due to the fact that the primary? span will produce a increment of -1 or +1 only for that variable.

I may try modifying my code to see if I can do as you suggested anyhow.

cheers,
Paul