From d874058a8c7ea0a4464fe817fc8c597d7d1a6af0 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 9 Feb 2012 10:09:14 -0800 Subject: [PATCH] Initial glyph support. --- protocols/rdp/src/rdp_glyph.c | 75 +++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/protocols/rdp/src/rdp_glyph.c b/protocols/rdp/src/rdp_glyph.c index bfb311ad..c8a73979 100644 --- a/protocols/rdp/src/rdp_glyph.c +++ b/protocols/rdp/src/rdp_glyph.c @@ -43,18 +43,87 @@ #include "rdp_glyph.h" void guac_rdp_glyph_new(rdpContext* context, rdpGlyph* glyph) { + + /* Allocate buffer */ guac_client* client = ((rdp_freerdp_context*) context)->client; - guac_client_log_info(client, "guac_rdp_glyph_new()"); + guac_socket* socket = client->socket; + guac_layer* layer = guac_client_alloc_buffer(client); + + int x, y, i; + int stride; + unsigned char* image_buffer; + unsigned char* image_buffer_row; + + unsigned char* data = glyph->aj; + int width = glyph->cx; + int height = glyph->cy; + + cairo_surface_t* surface; + + /* Init Cairo buffer */ + stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width); + image_buffer = malloc(height*stride); + image_buffer_row = image_buffer; + + /* Copy image data from image data to buffer */ + for (y = 0; ylayer = layer; + } void guac_rdp_glyph_draw(rdpContext* context, rdpGlyph* glyph, int x, int y) { + guac_client* client = ((rdp_freerdp_context*) context)->client; - guac_client_log_info(client, "guac_rdp_glyph_draw()"); + const guac_layer* current_layer = ((rdp_guac_client_data*) client->data)->current_surface; + + /* 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); + } void guac_rdp_glyph_free(rdpContext* context, rdpGlyph* glyph) { guac_client* client = ((rdp_freerdp_context*) context)->client; - guac_client_log_info(client, "guac_rdp_glyph_free()"); + guac_client_free_buffer(client, ((guac_rdp_glyph*) glyph)->layer); } void guac_rdp_glyph_begindraw(rdpContext* context,