Confused about flipping

Based on an axample I saw on the web, I put together a test for
changing pixel data. it was very slow. I think I have changed it to
work faster (now it only draws to the screen once) but, as that I am
not a programmer, it doesn’t work any more. what am I doing wrong.
see attached.


-------------- next part --------------
A non-text attachment was scrubbed…
Name: main.cpp
Type: text/x-c++src
Size: 2080 bytes
Desc: not available