Some optimazation when drawing a line