1. Handled WM_SETCURSOR explicitly in the window procedure, setting IDC_HAND
when dragging/hovering and returning 1 to prevent Windows from displaying
an hourglass/wait cursor.
2. Pre-allocated persistent memory DC, DIB section, and buffer pointer in
_init_gdi_resources() instead of allocating and freeing them 60 times/sec
in draw_frame(), eliminating GDI handle churn.
3. Added cleanup of DIB/DC handles and class unregistration in destroy().
_premultiply_bgra() was iterating over every RGBA pixel in a pure-Python
for-loop at 60 FPS (144x110 sprite = ~950k iterations/sec). This was the
primary cause of UI hangs.
New implementation uses numpy:
- np.frombuffer + reshape to view raw bytes as (H*W, 4) uint8 array
- Fancy-index column reorder [2,1,0,3] for R,G,B,A -> B,G,R,A in one op
- float32 alpha / 255 premultiplication via broadcasting
- tobytes() to emit the final DIB data
Roughly 100x faster than the previous loop, freeing the main thread to
sustain 60 FPS without freezing.