Simple and naive fix to make rendering more stable when drawing lines

The rendering flickers quite a lot when drawing lines.  Here is a very simple and naive fix to make the rendering more stable.