- /* Colorize glyph */
- guac_protocol_send_rect(client->socket, ((guac_rdp_glyph*) glyph)->layer,
- 0, 0, glyph->cx, glyph->cy);
-
- guac_protocol_send_cfill(client->socket,
- GUAC_COMP_ATOP, ((guac_rdp_glyph*) glyph)->layer,
- guac_client_data->foreground.red,
- guac_client_data->foreground.green,
- guac_client_data->foreground.blue,
- 255);
-
- /* Draw glyph */
- guac_protocol_send_copy(client->socket,
- ((guac_rdp_glyph*) glyph)->layer, 0, 0, glyph->cx, glyph->cy,
- GUAC_COMP_OVER, current_layer, x, y);
+ /* Use glyph as mask */
+ cairo_mask_surface(
+ guac_client_data->glyph_cairo,
+ ((guac_rdp_glyph*) glyph)->surface, x, y);
+
+ /* Fill rectangle with foreground */
+ cairo_rectangle(guac_client_data->glyph_cairo, x, y, glyph->cx, glyph->cy);
+ cairo_fill(guac_client_data->glyph_cairo);