[info-performer] Small ENDIANness Bug in libpfdu/objfnt.c under Linux

New Message Reply Date view Thread view Subject view Author view

From: Alexander Lechner (alexander.lechner++at++vertigo-systems.de)
Date: 06/04/2002 09:38:28


Hi all,

I think there is a small bug in function 'fixrow' in libpfdu/objfnt.c,
Performer 2.5 under Linux/IRIX.
When using textured fonts the LuminanceAlpha texture of the font results
in being completely dark. This is due to oring the pixel with 0xFF00.
This is ok in BIG ENDIAN, whereas in LITTLE ENDIAN it sets the Alpha
mask to opaque and leaves the pixel (luminance) dark.
A possible fix follows below.

static void
fixrow(unsigned short *sptr, int n)
{
     while(n--) {
         /* set intensity to max */
#ifdef __LITTLE_ENDIAN
                *sptr = (*sptr<<8) | 0x00ff;
#else
                *sptr |=0xff00;
#endif
         sptr++;
     }
}

Someone can verify this?

Regards,

Alex

--
alexander.lechner++at++vertigo-systems.de


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Jun 04 2002 - 09:37:52 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.