@Dave S That didn't take too long :)
Here it is... should work just find on macOS or Windows
That is actually terrible code with terrible looking and terrible performance. It has a LOT of flicker and uses a LOT of procesing. As this is mostly used in portable devices, it will made a noticeable decrease in the battery life.
Under any circumstances is a good idea to redraw ALL of the image just to ad a line of a few pixels. You shoud use caching and/or invalidating ONLY the modifyed part of the picture.