diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 17:12:10 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 17:12:10 +0300 |
| commit | b7944e4bbfa64a6bb1a1d9e1f172827dde53aed2 (patch) | |
| tree | d73ff8e368039f67f824ad2dc9130643ef4947ae /src/common/backend.c | |
| parent | ac6f9f5e7711521455b83ceb843a25e091646d43 (diff) | |
Read back the last presented CPU frame
wsap_term writes PNG screenshots for its debug server and keeps its own
copy of the frame because YASL had no readback.
yasl_surface_read_pixels() copies the frame from the last successful
present, or reports its extent when the buffer is too small. X11 and
Cocoa keep it in their single CPU target until the next draw starts;
X11 now also forgets it when a resize replaces the target, and Cocoa
records the presented extent because a resize can change the size before
the next draw. Wayland remembers which buffer it committed and forgets it
when a draw reuses that buffer.
The backend test checks the copy on Wayland and X11, and that draws that
never present do not show through. The Cocoa path is not built or run
here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/common/backend.c')
| -rw-r--r-- | src/common/backend.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/backend.c b/src/common/backend.c index b15233f..bb5ae33 100644 --- a/src/common/backend.c +++ b/src/common/backend.c @@ -322,6 +322,15 @@ bool yasl_surface_poll_event(struct yasl_surface *s, struct yasl_event *ev) return input_queue_pop(&s->input, ev); } +bool yasl_surface_read_pixels(struct yasl_surface *s, uint32_t *out, size_t cap, + struct yasl_vector2i *size) +{ + if (!size) return false; + *size = (struct yasl_vector2i){0}; + if (!s || (!out && cap) || !s->display->ops->surface_read_pixels) return false; + return s->display->ops->surface_read_pixels(s, out, cap, size); +} + bool yasl_surface_set_pointer_mode(struct yasl_surface *s, enum yasl_pointer_mode mode) { if (!s || (mode != YASL_POINTER_NORMAL && mode != YASL_POINTER_RELATIVE)) |
