Minor simplification of Fl_Wayland_Graphics_Driver::cairo_init.

This commit is contained in:
ManoloFLTK 2022-06-13 16:37:25 +02:00
parent 394298aff4
commit d8eb1f9ca4

View File

@ -71,7 +71,6 @@ struct fl_wld_buffer *Fl_Wayland_Graphics_Driver::create_shm_buffer(int width, i
buffer->data_size = size; buffer->data_size = size;
buffer->width = width; buffer->width = width;
buffer->draw_buffer = new uchar[buffer->data_size]; buffer->draw_buffer = new uchar[buffer->data_size];
memset(buffer->draw_buffer, 0, buffer->data_size); // necessary for transparent windows
buffer->draw_buffer_needs_commit = false; buffer->draw_buffer_needs_commit = false;
//fprintf(stderr, "create_shm_buffer: %dx%d = %d\n", width, height, size); //fprintf(stderr, "create_shm_buffer: %dx%d = %d\n", width, height, size);
cairo_init(buffer, width, height, stride, Fl_Cairo_Graphics_Driver::cairo_format); cairo_init(buffer, width, height, stride, Fl_Cairo_Graphics_Driver::cairo_format);
@ -105,8 +104,7 @@ void Fl_Wayland_Graphics_Driver::cairo_init(struct fl_wld_buffer *buffer, int wi
return; return;
} }
cairo_surface_destroy(surf); cairo_surface_destroy(surf);
cairo_set_source_rgba(buffer->cairo_, 1.0, 1.0, 1.0, 0.); memset(buffer->draw_buffer, 0, buffer->data_size); // useful for transparent windows
cairo_paint(buffer->cairo_);
cairo_set_source_rgba(buffer->cairo_, .0, .0, .0, 1.0); // Black default color cairo_set_source_rgba(buffer->cairo_, .0, .0, .0, 1.0); // Black default color
cairo_save(buffer->cairo_); cairo_save(buffer->cairo_);
} }