[Spice-devel] [PATCH v3 16/28] Fix handling of monochrome cursors

Sameeh Jubran sameeh at daynix.com
Wed Sep 7 13:10:34 UTC 2016


* Allow for 1bpp bitmap followed by 1bpp XOR map.

Based on a patch by Sandy Stutsman <sstutsma at redhat.com>

Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
---
 qxldod/QxlDod.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index e91ef7e..39822f4 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -4411,6 +4411,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;
@@ -4434,14 +4435,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;
@@ -4452,8 +4455,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);
-- 
2.7.0.windows.1



More information about the Spice-devel mailing list