Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with image buffers not being displayed properly #1795

Merged
merged 3 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions matron/src/hardware/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,9 @@ bool screen_surface_get_extents(screen_surface_t *s, screen_surface_extents_t *e

void screen_surface_display(screen_surface_t *s, double x, double y) {
cairo_surface_t *image = (cairo_surface_t *)s;

surface_may_have_color = true;
tlubke marked this conversation as resolved.
Show resolved Hide resolved

int width = cairo_image_surface_get_width(image);
int height = cairo_image_surface_get_height(image);

Expand Down
12 changes: 12 additions & 0 deletions matron/src/weaver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,18 @@ int _screen_clear(lua_State *l) {
lua_check_num_args(0);
screen_event_clear();
lua_settop(l, 0);

// Since screen_event_clear() only puts item a request into a queue it turns
// out that the clearing of the screen can actually not be finished until
// after the next screen command has started. This is especially apparent
// if the next screen command is screen.display_image() for displaying
// a buffer. Frequently the end result is that the image buffer is not
// displayed at all or only part of it becomes visible. Therefore need to
// execute a command that gets a return value to make sure that the screen
// has finished being cleared before this function returns. Using
// _screen_current_point() here completely fixes the problem.
_screen_current_point(l);

return 0;
}

Expand Down