Sunday, January 24, 2016

FMod - Circumventing GDI+

The bottleneck for Abiathar's performance is graphics operations - bitmap scaling and layering are expensive operations with .NET and GDI+. My last improvement in that area was to switch the image format to 32bppPArgb, which did indeed produce a noticeable speedup.

Today, however, I made a larger change. After consulting the documentation for Bitmap.LockBits, I rewrote the tile render planes to use direct memory manipulation (with Marshal.Copy and pointer math) instead of DrawImage calls. The initial level rendering is now dramatically faster, almost instant for default levels at 100% zoom.

No comments:

Post a Comment