Fix for big endian machines.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@35587 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2012-09-21 20:32:05 +00:00
parent 225596d228
commit 2e13792007
2 changed files with 16 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2012-09-21 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/x11/XGServerWindow.m (-imagecursor:::): Fix Xcursor
specific code for big endian machines.
2012-08-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/cairo/CairoFontEnumerator.m: Allow for Windows default

View file

@ -4348,7 +4348,9 @@ xgps_cursor_image(Display *xdpy, Drawable draw, const unsigned char *data,
}
// FIXME: Factor this out
// Convert RGBA unpacked to BGRA packed
// Convert RGBA unpacked to ARGB packed
// NB Packed ARGB values are layed out as ARGB on big endian systems
// and as BDRA on low endian systems
{
NSInteger stride;
NSInteger x, y;
@ -4362,14 +4364,16 @@ xgps_cursor_image(Display *xdpy, Drawable draw, const unsigned char *data,
for (x = 0; x < w; x++)
{
NSInteger i = (y * stride) + (x * 4);
#if GS_WORDS_BIGENDIAN
unsigned char d = cdata[i + 3];
cdata[i + 3] = cdata[i + 2];
cdata[i + 2] = cdata[i + 1];
cdata[i + 1] = cdata[i];
cdata[i] = d;
#else
unsigned char d = cdata[i];
#if GS_WORDS_BIGENDIAN
cdata[i] = cdata[i + 1];
cdata[i + 1] = cdata[i + 2];
cdata[i + 2] = cdata[i + 3];
cdata[i + 3] = d;
#else
cdata[i] = cdata[i + 2];
//cdata[i + 1] = cdata[i + 1];
cdata[i + 2] = d;