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;
guac_client* client;
CLRCONV* clrconv;
} rdp_freerdp_context;
extern CLRCONV guac_rdp_clrconv;
#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_memblt(rdpContext* context, MEMBLT_ORDER* memblt);
void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect);
void guac_rdp_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette);
#endif

View File

@ -72,13 +72,6 @@ const char* GUAC_CLIENT_ARGS[] = {
NULL
};
CLRCONV guac_rdp_clrconv = {
.alpha = 1,
.invert = 0,
.rgb555 = 0,
.palette = NULL
};
boolean rdp_freerdp_pre_connect(freerdp* instance) {
rdpContext* context = instance->context;
@ -88,6 +81,15 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
rdpGlyph* glyph;
rdpPointer* pointer;
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 */
instance->context->cache = cache_new(instance->settings);
@ -121,8 +123,9 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
graphics_register_pointer(context->graphics, pointer);
/* 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->PatBlt = guac_rdp_gdi_patblt;
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,
bitmap->width, bitmap->height,
context->instance->settings->color_depth,
32, (HCLRCONV) &guac_rdp_clrconv);
32, ((rdp_freerdp_context*) context)->clrconv);
/* If not ephemeral, send to client */
if (!bitmap->ephemeral) {
@ -102,6 +102,9 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
/* Store converted image in bitmap */
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) {
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);
}

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;
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;
@ -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;
}