Adding a constant yields quadratic time complexity which can
have quite a big impact on some scenes.
I used the file from T64901 for testing.
In the test file, the time it took to execute wm_draw_update
changed from 0.60s to 0.51s.
Maybe there is another bug, that caused the buffer to get
very large in the first place though. Not sure if that is
expected to happen. In any case, it would be good to get
rid of this quadratic behavior.