Complete rewrite LineBresenham with common function.