Taking a look at this myself. The issue is related to cursors and is
either an issue in:

 * Inkscape
 * GDK
 * XRender

Since the star cursor in Inkscape shows the color to be drawn,
including alpha. Using the color `FFDD8833` (which is kind of a tan
color) appears on the star cursor itself as a sky blue. The actual
color being shown on the cursor is `#3388DD` (or ARGB #FF3388DD).
Changing in Inkscape the `FF` (which should be red, but is alpha) makes
the blue in the cursor a bit transparent.

I am definitely certain that the issue is in Inkscape only. Other
programs such as GIMP and anything else do not have any cursor issues
at all from what I can tell. If GDK or XRender were at fault, likely
more than just a single program would be broken.

The only place in the Inkscape code which loads cursors is
`sp_cursor_pixbuf_from_xpm`. The `RGBA` struct has a static cast to a
`guint32` which bitshifts in values accordingly. However part of the
function `sp_cursor_pixbuf_from_xpm` contains the following:

    guint32 *pixmap_buffer = new guint32[width * height];

However, before returning this buffer is `reinterpret_cast`ed such as
the following:

    return
    gdk_pixbuf_new_from_data(reinterpret_cast<guchar*>(pixmap_buffer),
    GDK_COLORSPACE_RGB, TRUE, 8, width, height, width *
    sizeof(guint32), free_cursor_data, NULL);

Looking at the documentation for `gdk_pixbuf_new_from_data`, the data
for this call is just specified as _Image data in 8-bit/sample packed
format_.

I wrote the attached patch which essentially byte swaps the value
before this function returns. The cursors are drawn correctly and
Inkscape can now be used much more easily. If a contributor agreement
is required then I would accept giving away my copyright for the code
contained in this patch.

Description: Swap before return sp_cursor_pixbuf_from_xpm on big endian.
 This byte swaps before the return in sp_cursor_pixbuf_from_xpm on big
 endian systems so that the cursor is made visible on these systems.
Author: Steven Gawroriski <[email protected]>

---

Origin: other
Bug-Debian: https://bugs.debian.org/841853

--- inkscape-0.91.orig/src/sp-cursor.cpp
+++ inkscape-0.91/src/sp-cursor.cpp
@@ -106,6 +106,14 @@ GdkPixbuf *sp_cursor_pixbuf_from_xpm(gch
             pixmap_buffer[y * width + x] = (it == colorMap.end()) ? 0u : it->second;
         }
     }
+    
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+    for (int i = 0, n = width * height; i < n; i++)
+    {
+        guint32 v = pixmap_buffer[i];
+        pixmap_buffer[i] = ((v & 0xFF) << 24) | (((v >> 8) & 0xFF) << 16) | (((v >> 16) & 0xFF) << 8) | ((v >> 24) & 0xFF);
+    }
+#endif
 
     return gdk_pixbuf_new_from_data(reinterpret_cast<guchar*>(pixmap_buffer), GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * sizeof(guint32), free_cursor_data, NULL);
 }

Reply via email to