int mouse_button_mask;
/**
- * Cairo surface which will receive all drawn glyphs.
+ * Cairo surface which will receive all TRANSPARENT glyphs.
+ */
+ cairo_surface_t* trans_glyph_surface;
+
+ /**
+ * Cairo surface which will receive all OPAQUE glyphs.
+ */
+ cairo_surface_t* opaque_glyph_surface;
+
+ /**
+ * The current Cairo surface which will receive all drawn glyphs,
+ * depending on whether we are currently drawing transparent or
+ * opaque glyphs.
*/
cairo_surface_t* glyph_surface;
/**
- * Cairo instance for drawing to glyph surface.
+ * Cairo instance for drawing to the current glyph surface.
*/
cairo_t* glyph_cairo;
guac_protocol_send_size(client->socket, GUAC_DEFAULT_LAYER,
settings->width, settings->height);
- /* Create glyph surface and cairo instance */
- guac_client_data->glyph_surface = cairo_image_surface_create(
+ /* Create glyph surfaces */
+ guac_client_data->opaque_glyph_surface = cairo_image_surface_create(
CAIRO_FORMAT_RGB24, settings->width, settings->height);
- guac_client_data->glyph_cairo = cairo_create(
- guac_client_data->glyph_surface);
+ guac_client_data->trans_glyph_surface = cairo_image_surface_create(
+ CAIRO_FORMAT_ARGB32, settings->width, settings->height);
/* Success */
return 0;
/* Fill background with color if specified */
if (width != 0 && height != 0) {
+ /* Prepare for opaque glyphs */
+ guac_client_data->glyph_surface =
+ guac_client_data->opaque_glyph_surface;
+
+ /* Create cairo instance */
+ guac_client_data->glyph_cairo = cairo_create(
+ guac_client_data->glyph_surface);
+
/* Convert background color */
bgcolor = freerdp_color_convert_var(bgcolor,
context->instance->settings->color_depth, 32,
}
+ /* Otherwise, prepare for transparent glyphs */
+ else {
+
+ /* Select transparent glyph surface */
+ guac_client_data->glyph_surface =
+ guac_client_data->trans_glyph_surface;
+
+ guac_client_data->glyph_cairo = cairo_create(
+ guac_client_data->glyph_surface);
+
+ /* Clear surface */
+ cairo_set_operator(guac_client_data->glyph_cairo,
+ CAIRO_OPERATOR_SOURCE);
+
+ cairo_set_source_rgba(guac_client_data->glyph_cairo, 0, 0, 0, 0);
+ cairo_paint(guac_client_data->glyph_cairo);
+
+ /* Restore operator */
+ cairo_set_operator(guac_client_data->glyph_cairo,
+ CAIRO_OPERATOR_OVER);
+
+ }
+
/* Prepare for glyph drawing */
cairo_set_source_rgb(guac_client_data->glyph_cairo,
( fgcolor & 0x0000FF ) / 255.0,
/* Destroy surface */
cairo_surface_destroy(surface);
+ /* Destroy cairo instance */
+ cairo_destroy(guac_client_data->glyph_cairo);
+
}