[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] [PATCH] Surface.set_at() on BIG ENDIAN machines
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] [PATCH] Surface.set_at() on BIG ENDIAN machines
- From: Rene Dudfield <renesd@xxxxxxxxx>
- Date: Thu, 12 Jan 2006 15:17:39 +1100
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Wed, 11 Jan 2006 23:17:42 -0500
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=esWpN+xDWq2cHydMGoJj0UrT6ekCQTutbDMjNZ5UJwnd2Yw4bBLxv+MvplpJr6b3AHQin+qtFGbzQvziqmYhRCEqncDm16umIdHqsaGqEh/ssowT7o9KRhVRHKR3bQwJyGeNFMmBYi8l5jKCLiiVlm0Yn1XQlaSvDRu5bXNDnFM=
- In-reply-to: <1136634941.4974.28.camel@localhost>
- References: <1136634941.4974.28.camel@localhost>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hey,
thanks for that. I have put applied the patch in cvs*1
Can someone on big endian(powerpc macosx, solaris etc) please try out
cvs to test if this works for them?
Cheers,
1* except I changed it to use the preprocessor to avoid the if at runtime.
#if (SDL_BYTEORDER == SDL_LIL_ENDIAN)
*(byte_buf + (format->Rshift >> 3)) = rgb[0];
*(byte_buf + (format->Gshift >> 3)) = rgb[1];
*(byte_buf + (format->Bshift >> 3)) = rgb[2];
#else
*(byte_buf + 2 - (format->Rshift >> 3)) = rgb[0];
*(byte_buf + 2 - (format->Gshift >> 3)) = rgb[1];
*(byte_buf + 2 - (format->Bshift >> 3)) = rgb[2];
#endif
On 1/7/06, Ivo Danihelka <ivo@xxxxxxxxxxxxx> wrote:
> Hi,
>
> there seems to be bug in function Surface.set_at(). This bug appears
> with 24-bit color depth Surface on BIG ENDIAN machines.
>
> I've attached patch for CVS version of pygame. The nicer solution would
> be also to remove the code duplicities between src/draw.c:set_at() and
> src/sruface.c:surf_set_at().
>
> The other attached file "testSetAt.py" is simple script that should show
> the bug. Please, try it on PowerPC machines.
> Its correct output should be:
> ==========
> bytes per pixel: 3
> old color expected: (100, 200, 255, 255)
> old color: (100, 200, 255, 255)
> new color expected: (10, 20, 30, 255)
> new color: (10, 20, 30, 255)
> ==========
>
> Note that function Surface.get_at() is correct, and you can use
> Surface.fill(color, (position, (1,1))) instead of
> Surface.set_at(position, color).
>
> --
> Ivo Danihelka
>
>
>