Refactored shuhaowu code, found bottleneck at w.FlushImage()