Commit Graph
4 Commits
Author SHA1 Message Date
me0nline bbc6768b78 perf(overlay): pre-allocate persistent DIB section and handle WM_SETCURSOR
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().
2026-09-08 23:26:26 +02:00
me0nline f20a6129f6 perf(overlay): replace O(N) Python pixel loop with numpy vectorised premultiply
_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.
2026-09-08 23:17:10 +02:00
me0nline 4eeb96d5b6 fix(overlay): declare complete 64-bit ctypes prototypes for GDI/User32 2026-09-08 23:05:49 +02:00
me0nline 9bade210f5 feat(overlay): add Win32 32-bit ARGB layered window overlay 2026-09-08 23:05:04 +02:00