Ignore ROP, assume invert unless ROP an easy operation.

This commit is contained in:
Michael Jumper 2012-12-13 15:01:11 -08:00
parent e0f4ed892b
commit e0a08b5461

View File

@ -158,9 +158,6 @@ void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) {
/* Layer for actual transfer */ /* Layer for actual transfer */
guac_layer* buffer; guac_layer* buffer;
/* Transfer function (if necessary) */
guac_transfer_function transfer;
/* /*
* Warn that rendering is a fallback, as the server should not be sending * Warn that rendering is a fallback, as the server should not be sending
* this order. * this order.
@ -186,7 +183,7 @@ void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) {
case 0xAA: case 0xAA:
break; break;
/* If operation is just SRC, send background only */ /* If operation is just a copy, send foreground only */
case 0xCC: case 0xCC:
case 0xF0: case 0xF0:
guac_protocol_send_rect(client->socket, current_layer, guac_protocol_send_rect(client->socket, current_layer,
@ -195,9 +192,9 @@ void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) {
guac_protocol_send_cfill(client->socket, guac_protocol_send_cfill(client->socket,
GUAC_COMP_OVER, current_layer, GUAC_COMP_OVER, current_layer,
(patblt->backColor >> 16) & 0xFF, (patblt->foreColor >> 16) & 0xFF,
(patblt->backColor >> 8 ) & 0xFF, (patblt->foreColor >> 8 ) & 0xFF,
(patblt->backColor ) & 0xFF, (patblt->foreColor ) & 0xFF,
0xFF); 0xFF);
break; break;
@ -212,40 +209,19 @@ void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) {
0xFF, 0xFF, 0xFF, 0xFF); 0xFF, 0xFF, 0xFF, 0xFF);
break; break;
/* Otherwise, use transfer */ /* Otherwise, invert entire rect */
default: default:
/* Allocate buffer for transfer */ /* Allocate buffer for transfer */
buffer = guac_client_alloc_buffer(client); buffer = guac_client_alloc_buffer(client);
/* Get reasonable transfer function for ROP */
switch (patblt->bRop) {
/* PATINVERT */
case 0x5A:
transfer = GUAC_TRANSFER_BINARY_XOR;
break;
/* PATPAINT */
case 0xFB:
transfer = GUAC_TRANSFER_BINARY_OR;
break;
default:
transfer = guac_rdp_rop3_transfer_function(
client, patblt->bRop);
}
/* Send rectangle stroke */ /* Send rectangle stroke */
guac_protocol_send_rect(client->socket, buffer, guac_protocol_send_rect(client->socket, buffer,
0, 0, patblt->nWidth, patblt->nHeight); 0, 0, patblt->nWidth, patblt->nHeight);
/* Fill rectangle with back color only */ /* Fill rectangle with fore color only */
guac_protocol_send_cfill(client->socket, GUAC_COMP_OVER, buffer, guac_protocol_send_cfill(client->socket, GUAC_COMP_OVER, buffer,
(patblt->backColor >> 16) & 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
(patblt->backColor >> 8 ) & 0xFF,
(patblt->backColor ) & 0xFF,
0xFF);
/* Transfer */ /* Transfer */
guac_protocol_send_transfer(client->socket, guac_protocol_send_transfer(client->socket,
@ -253,8 +229,8 @@ void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) {
/* ... from buffer */ /* ... from buffer */
buffer, 0, 0, patblt->nWidth, patblt->nHeight, buffer, 0, 0, patblt->nWidth, patblt->nHeight,
/* ... using specified transfer function */ /* ... inverting */
transfer, GUAC_TRANSFER_BINARY_XOR,
/* ... to current layer */ /* ... to current layer */
current_layer, patblt->nLeftRect, patblt->nTopRect); current_layer, patblt->nLeftRect, patblt->nTopRect);