Skip to content

Reduce bezel redraw work and release CGColors - #327

Open
emanuelst wants to merge 2 commits into
TermiT:masterfrom
emanuelst:experiment/cache-bezel-background
Open

Reduce bezel redraw work and release CGColors#327
emanuelst wants to merge 2 commits into
TermiT:masterfrom
emanuelst:experiment/cache-bezel-background

Conversation

@emanuelst

@emanuelst emanuelst commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Caches the bezel background until its size, opacity, or color changes, and releases temporary CGColor objects after layer assignment. No behavior or appearance changes are intended.

AI-assisted; reviewed and tested locally.

@TermiT

TermiT commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Thanks for this — the background caching is correct, MRC-safe, and merges cleanly.

One request before merging: while you're in BezelWindow.m, could you also fix the CGColor leaks in -update? The CGColorCreateGenericRGB(...) results used for the background/border there (around lines 136–138, plus the similar ones in init) are never CFRelease'd, so they leak on every window update. Since -update runs on every bezel refresh, CFRelease-ing those is arguably a bigger per-update win than the pattern-image cache itself, and it fits naturally alongside this change.

Minor note on framing: the bezel is orderOut'd (hidden) while idle, so this reduces redraw cost while the bezel is on screen rather than idle CPU. The constant idle CPU in #282 is the ~1s pasteboard-polling timer, so I'd like to keep #282 open for that separately. But this is a solid improvement for active-bezel redraws — happy to merge once the CGColor releases are folded in.

@emanuelst
emanuelst force-pushed the experiment/cache-bezel-background branch from eec8b71 to 2da5e78 Compare August 9, 2026 18:09
@emanuelst

emanuelst commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the feedback! I added the CGColor releases.

@emanuelst emanuelst changed the title Cache Flycut's bezel background to reduce idle CPU usage Reduce bezel redraw work and release CGColors Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants