From 30ee4d8b20c8ba5bd5ca9978b4783101bebdc0d8 Mon Sep 17 00:00:00 2001 From: Sameeh Jubran Date: Wed, 7 Sep 2016 15:15:53 +0300 Subject: [PATCH] Fix handling of monochrome cursors * Allow for 1bpp bitmap followed by 1bpp XOR map. Based on a patch by Sandy Stutsman Signed-off-by: Sameeh Jubran Acked-by: Frediano Ziglio --- qxldod/QxlDod.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp index a2cc509..943d25a 100755 --- a/qxldod/QxlDod.cpp +++ b/qxldod/QxlDod.cpp @@ -4359,6 +4359,7 @@ NTSTATUS QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi UINT8 *now; UINT8 *end; int line_size; + int num_images = 1; cursor_cmd = CursorCmd(); cursor_cmd->type = QXL_CURSOR_SET; @@ -4382,14 +4383,16 @@ NTSTATUS QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi cursor->header.height = (UINT16)pSetPointerShape->Height; if (cursor->header.type == SPICE_CURSOR_TYPE_MONO) { line_size = ALIGN(cursor->header.width, 8) >> 3; + cursor->data_size = line_size * pSetPointerShape->Height * 2; + num_images = 2; } else { line_size = cursor->header.width << 2; + cursor->data_size = line_size * pSetPointerShape->Height; } cursor->header.hot_spot_x = (UINT16)pSetPointerShape->XHot; cursor->header.hot_spot_y = (UINT16)pSetPointerShape->YHot; - cursor->data_size = line_size * pSetPointerShape->Height; DbgPrint(TRACE_LEVEL_INFORMATION, ("<--> %s %d::%d::%d::%d::%d\n", __FUNCTION__, cursor->header.width, cursor->header.height, cursor->header.hot_spot_x, cursor->header.hot_spot_y, cursor->data_size)); chunk = &cursor->chunk; @@ -4400,8 +4403,7 @@ NTSTATUS QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi src = (UINT8*)pSetPointerShape->pPixels; now = chunk->data; end = (UINT8 *)res + CURSOR_ALLOC_SIZE; - - src_end = src + (pSetPointerShape->Pitch * pSetPointerShape->Height * (pSetPointerShape->Flags.Monochrome ? 2 : 1)); + src_end = src + (pSetPointerShape->Pitch * pSetPointerShape->Height * num_images); for (; src != src_end; src += pSetPointerShape->Pitch) { PutBytesAlign(&chunk, &now, &end, src, line_size, PAGE_SIZE, 1);