[PATCH v2 spice-gtk 1/2] cursor-channel.c: add cursor print function for debugging only (ifdefed)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 gtk/channel-cursor.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
index d1d2c34..66e91df 100644
--- a/gtk/channel-cursor.c
+++ b/gtk/channel-cursor.c
@@ -246,6 +246,35 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
 
 /* ------------------------------------------------------------------ */
 
+#ifdef DEBUG_CURSOR
+static void print_cursor(display_cursor *cursor, const guint8 *data)
+{
+    int x, y, bpl;
+    const guint8 *xor, *and;
+
+    bpl = (cursor->hdr.width + 7) / 8;
+    and = data;
+    xor = and + bpl * cursor->hdr.height;
+
+    printf("data (%d x %d):\n", cursor->hdr.width, cursor->hdr.height);
+    for (y = 0 ; y < cursor->hdr.height; ++y) {
+        for (x = 0 ; x < cursor->hdr.width / 8; x++) {
+            printf("%02X", and[x]);
+        }
+        and += bpl;
+        printf("\n");
+    }
+    printf("xor:\n");
+    for (y = 0 ; y < cursor->hdr.height; ++y) {
+        for (x = 0 ; x < cursor->hdr.width / 8; ++x) {
+            printf("%02X", xor[x]);
+        }
+        xor += bpl;
+        printf("\n");
+    }
+}
+#endif
+
 static void mono_cursor(display_cursor *cursor, const guint8 *data)
 {
     const guint8 *xor, *and;
@@ -256,6 +285,9 @@ static void mono_cursor(display_cursor *cursor, const guint8 *data)
     and = data;
     xor = and + bpl * cursor->hdr.height;
     dest  = (uint8_t *)cursor->data;
+#ifdef DEBUG_CURSOR
+    print_cursor(cursor, data);
+#endif
     for (y = 0; y < cursor->hdr.height; y++) {
         bit = 0x80;
         for (x = 0; x < cursor->hdr.width; x++, dest += 4) {
-- 
1.8.3.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]