From 7a6644c0da9f5614f46e98876bedd918c7e99110 Mon Sep 17 00:00:00 2001 From: mpasteven <> Date: Sun, 6 Nov 2016 23:26:28 +0100 Subject: fix cursor on big endian systems Fixed bugs: - https://launchpad.net/bugs/1639611 (bzr r15221) --- src/sp-cursor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/sp-cursor.cpp') diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp index 16659d1cf..4b9f1cc2d 100644 --- a/src/sp-cursor.cpp +++ b/src/sp-cursor.cpp @@ -108,6 +108,13 @@ GdkPixbuf *sp_cursor_pixbuf_from_xpm(char const *const *xpm, GdkColor const& bla } } +#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(pixmap_buffer), GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * sizeof(guint32), free_cursor_data, NULL); } -- cgit v1.2.3