Non-static clrconv, handle palette updates.

This commit is contained in:
Michael Jumper 2012-02-08 12:32:27 -08:00
parent 058c3cf55a
commit f7928c2574
5 changed files with 29 additions and 13 deletions

View File

@ -70,10 +70,9 @@ typedef struct rdp_freerdp_context {
rdpContext _p; rdpContext _p;
guac_client* client; guac_client* client;
CLRCONV* clrconv;
} rdp_freerdp_context; } rdp_freerdp_context;
extern CLRCONV guac_rdp_clrconv;
#endif #endif

View File

@ -45,5 +45,6 @@ void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt);
void guac_rdp_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt); void guac_rdp_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt);
void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt); void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt);
void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect); void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect);
void guac_rdp_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette);
#endif #endif

View File

@ -72,13 +72,6 @@ const char* GUAC_CLIENT_ARGS[] = {
NULL NULL
}; };
CLRCONV guac_rdp_clrconv = {
.alpha = 1,
.invert = 0,
.rgb555 = 0,
.palette = NULL
};
boolean rdp_freerdp_pre_connect(freerdp* instance) { boolean rdp_freerdp_pre_connect(freerdp* instance) {
rdpContext* context = instance->context; rdpContext* context = instance->context;
@ -88,6 +81,15 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
rdpGlyph* glyph; rdpGlyph* glyph;
rdpPointer* pointer; rdpPointer* pointer;
rdpPrimaryUpdate* primary; rdpPrimaryUpdate* primary;
CLRCONV* clrconv;
/* Init color conversion structure */
clrconv = xnew(CLRCONV);
clrconv->alpha = 1;
clrconv->invert = 0;
clrconv->rgb555 = 0;
clrconv->palette = xnew(rdpPalette);
((rdp_freerdp_context*) context)->clrconv = clrconv;
/* Init FreeRDP cache */ /* Init FreeRDP cache */
instance->context->cache = cache_new(instance->settings); instance->context->cache = cache_new(instance->settings);
@ -121,8 +123,9 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
graphics_register_pointer(context->graphics, pointer); graphics_register_pointer(context->graphics, pointer);
/* Set up GDI */ /* Set up GDI */
primary = instance->update->primary; instance->update->Palette = guac_rdp_gdi_palette_update;
primary = instance->update->primary;
primary->DstBlt = guac_rdp_gdi_dstblt; primary->DstBlt = guac_rdp_gdi_dstblt;
primary->PatBlt = guac_rdp_gdi_patblt; primary->PatBlt = guac_rdp_gdi_patblt;
primary->ScrBlt = guac_rdp_gdi_scrblt; primary->ScrBlt = guac_rdp_gdi_scrblt;

View File

@ -64,7 +64,7 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
unsigned char* image_buffer = freerdp_image_convert(bitmap->data, NULL, unsigned char* image_buffer = freerdp_image_convert(bitmap->data, NULL,
bitmap->width, bitmap->height, bitmap->width, bitmap->height,
context->instance->settings->color_depth, context->instance->settings->color_depth,
32, (HCLRCONV) &guac_rdp_clrconv); 32, ((rdp_freerdp_context*) context)->clrconv);
/* If not ephemeral, send to client */ /* If not ephemeral, send to client */
if (!bitmap->ephemeral) { if (!bitmap->ephemeral) {
@ -102,6 +102,9 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
/* Store converted image in bitmap */ /* Store converted image in bitmap */
bitmap->data = image_buffer; bitmap->data = image_buffer;
/* Not stored in a layer */
((guac_rdp_bitmap*) bitmap)->layer = NULL;
} }
} }
@ -127,6 +130,9 @@ void guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap) {
void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap) { void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap) {
guac_client* client = ((rdp_freerdp_context*) context)->client; guac_client* client = ((rdp_freerdp_context*) context)->client;
/* Free layer, if any */
if (((guac_rdp_bitmap*) bitmap)->layer != NULL)
guac_client_free_buffer(client, ((guac_rdp_bitmap*) bitmap)->layer); guac_client_free_buffer(client, ((guac_rdp_bitmap*) bitmap)->layer);
} }

View File

@ -65,7 +65,8 @@ void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect
guac_client* client = ((rdp_freerdp_context*) context)->client; guac_client* client = ((rdp_freerdp_context*) context)->client;
uint32 color = freerdp_color_convert(opaque_rect->color, uint32 color = freerdp_color_convert(opaque_rect->color,
context->instance->settings->color_depth, 32, &guac_rdp_clrconv); context->instance->settings->color_depth, 32,
((rdp_freerdp_context*) context)->clrconv);
const guac_layer* current_layer = ((rdp_guac_client_data*) client->data)->current_surface; const guac_layer* current_layer = ((rdp_guac_client_data*) client->data)->current_surface;
@ -80,4 +81,10 @@ void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect
} }
void guac_rdp_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette) {
CLRCONV* clrconv = ((rdp_freerdp_context*) context)->clrconv;
clrconv->palette->count = palette->number;
clrconv->palette->entries = palette->entries;
}