picker flickers during ambience rain redraws — needs double-buffering #3
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
queue
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/fzt-picker#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
With the GDI ambience rain layer active (added to
frontend/cgo/picker.go), the picker window exhibits mild flicker on each 10 Hz repaint. Nelson can tolerate the current level but it should be smoothed out.Cause
paintWindowpaints directly to the window DC in a single-buffered fashion each WM_PAINT:FillRect(client, baseBg)— wipes the whole frameFillRect(cellRect, dropColor)— stamps dropsFillRect(for highlights) +ExtTextOutin transparent modeAt 10 Hz, the visible window briefly shows intermediate states between steps 1–3 before all draws complete. That's the perceptible flicker.
Fix
Double-buffer via a compatible DC + bitmap:
CreateCompatibleDC(hdc)+CreateCompatibleBitmap(hdc, clientW, clientH)SelectObject(memDC, bmp)memDC(no visible flicker because offscreen)BitBlt(hdc, 0, 0, w, h, memDC, 0, 0, SRCCOPY)— single atomic blit to windowAlternative: paint only the dirty region (per invalidated rect) rather than the full client. Useful if rain updates are per-drop deltas instead of full-grid repaints. Current sim returns a full grid from
GridCopy()so per-cell dirty tracking would need extra state.Files
frontend/cgo/picker.go—paintWindowfunction (single biggest change)Context
Part of the ambience-in-picker feature (GDI rain layer). Flicker is tolerable — filing now so the follow-up is tracked; don't block the main feature landing on this.