Use transfer, not copy.

This commit is contained in:
Michael Jumper 2012-02-27 12:39:13 -08:00
parent 28a6bada49
commit b672cf4004
2 changed files with 34 additions and 15 deletions

View File

@ -41,7 +41,8 @@
#include <guacamole/protocol.h> #include <guacamole/protocol.h>
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
guac_composite_mode guac_rdp_rop3_composite_mode(guac_client* client, int rop3); guac_composite_mode guac_rdp_rop3_transfer_function(guac_client* client,
int rop3);
void guac_rdp_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt); void guac_rdp_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt);
void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt); void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt);

View File

@ -42,32 +42,35 @@
#include "client.h" #include "client.h"
#include "rdp_bitmap.h" #include "rdp_bitmap.h"
guac_composite_mode guac_rdp_rop3_composite_mode(guac_client* client, guac_transfer_function guac_rdp_rop3_transfer_function(guac_client* client,
int rop3) { int rop3) {
/* Translate supported ROP3 opcodes into composite modes */ /* Translate supported ROP3 opcodes into composite modes */
switch (rop3) { switch (rop3) {
/* "SRCINVERT" (src ^ dest) */ /* "SRCINVERT" (src ^ dest) */
case 0x66: return GUAC_COMP_BINARY_XOR; case 0x66: return GUAC_TRANSFER_BINARY_SRC;
/* "SRCAND" (src & dest) */ /* "SRCAND" (src & dest) */
case 0x88: return GUAC_COMP_BINARY_AND; case 0x88: return GUAC_TRANSFER_BINARY_AND;
/* "MERGEPAINT" !(src | dest)*/ /* "MERGEPAINT" !(src | dest)*/
case 0xBB: return GUAC_COMP_BINARY_NOR; case 0xBB: return GUAC_TRANSFER_BINARY_NOR;
/* "SRCCOPY" (src) */ /* "SRCCOPY" (src) */
case 0xCC: return GUAC_COMP_OVER; case 0xCC: return GUAC_TRANSFER_BINARY_SRC;
/* "SRCPAINT" (src | dest) */ /* "SRCPAINT" (src | dest) */
case 0xEE: return GUAC_COMP_BINARY_OR; case 0xEE: return GUAC_TRANSFER_BINARY_OR;
} }
/* Log warning if ROP3 opcode not supported */ /* Log warning if ROP3 opcode not supported */
guac_client_log_info (client, "guac_rdp_rop3_composite_mode: UNSUPPORTED opcode = 0x%02X", rop3); guac_client_log_info (client, "guac_rdp_rop3_transfer_function: "
return GUAC_COMP_OVER; "UNSUPPORTED opcode = 0x%02X", rop3);
/* Default to BINARY_SRC */
return GUAC_TRANSFER_BINARY_SRC;
} }
@ -126,13 +129,28 @@ void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) {
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
guac_rdp_bitmap* bitmap = (guac_rdp_bitmap*) memblt->bitmap; guac_rdp_bitmap* bitmap = (guac_rdp_bitmap*) memblt->bitmap;
if (bitmap->layer != NULL) if (bitmap->layer != NULL) {
/* If operation is just SRC, simply copy */
if (memblt->bRop == 0xCC)
guac_protocol_send_copy(socket, guac_protocol_send_copy(socket,
bitmap->layer, bitmap->layer,
memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight, memblt->nXSrc, memblt->nYSrc,
guac_rdp_rop3_composite_mode(client, memblt->bRop), memblt->nWidth, memblt->nHeight,
GUAC_COMP_OVER,
current_layer, memblt->nLeftRect, memblt->nTopRect); current_layer, memblt->nLeftRect, memblt->nTopRect);
/* Otherwise, use transfer */
else
guac_protocol_send_transfer(socket,
bitmap->layer,
memblt->nXSrc, memblt->nYSrc,
memblt->nWidth, memblt->nHeight,
guac_rdp_rop3_transfer_function(client, memblt->bRop),
current_layer, memblt->nLeftRect, memblt->nTopRect);
}
} }
void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) { void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) {