spice-gtk/0005-cursor-channel.c-add-cursor-print-function-for-debug.patch

64 lines
1.9 KiB
Diff

From 421cfdab3bc123c7a8d31946be2b6b6e34ac0e0a Mon Sep 17 00:00:00 2001
From: Alon Levy <alevy@redhat.com>
Date: Fri, 18 Oct 2013 14:36:22 +0300
Subject: [PATCH 5/6] cursor-channel.c: add cursor print function for debugging
only (ifdefed)
---
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