fix(render): better handler empty buffer

This commit is contained in:
Jeremy Attali 2019-12-29 00:07:11 -05:00
parent e8d377fc29
commit acf2379ba3

View File

@ -150,6 +150,13 @@ static void render_buffer(cairo_t *cr, struct swappy_state *state) {
wl_list_for_each(output, &state->outputs, link) {
struct swappy_buffer *buffer = output->buffer;
if (output->buffer == NULL) {
g_warning(
"screencopy buffer is empty, cannot draw it onto the paint area");
continue;
}
cairo_format_t format = get_cairo_format(buffer->format);
g_assert(format != CAIRO_FORMAT_INVALID);
@ -258,6 +265,9 @@ void render_state(struct swappy_state *state) {
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_paint(cr);
render_buffer(cr, state);
render_paints(cr, state);