[SDL] SDL_BlitSurface on MacOSX 10.3.9
Michael Ryan Bannon
mrbannon at swen.uwaterloo.ca
Tue Jul 11 07:33:51 PDT 2006
I've tried this solution (setenv("SDL_ALTIVEC_BLIT_FEATURES", "0", 1)) and
it didn't solve the problem.
Thanks,
Ryan
"Bob Ippolito" <bob at redivi.com> wrote in message
news:83E18EFA-1E4F-4E14-9993-9ED3F5F883AD at redivi.com...
>
> On Jul 10, 2006, at 3:31 PM, Sam Lantinga wrote:
>
>>> Michael Ryan Bannon wrote:
>>>> So, is this a bug in SDL or am I doing something wrong? Has
>>>> anybody tested
>>>> the code?
>>
>>> I do see weird behavior here on 10.4.6 PPC with the following
>>> stripped
>>> down version of your code:
>>
>>> ----------
>>> #include <SDL/SDL.h>
>>> #include <SDL_image/SDL_image.h>
>>
>>> int main(int argc, char*argv[])
>>> {
>>> SDL_Init(SDL_INIT_VIDEO);
>>> SDL_Surface* pSurfaceOne = IMG_Load("1.jpg");
>>> SDL_Surface* pConversionSurface =
>>> SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 1, 32, 0xff000000, 0x00ff0000,
>>> 0x0000ff00, 0x00000000);
>>> SDL_Surface* pSurfaceOneConverted = SDL_ConvertSurface
>>> (pSurfaceOne,
>>> pConversionSurface->format, SDL_SWSURFACE);
>>> SDL_Surface* pDisplaySurface = SDL_SetVideoMode(800, 600, 32,
>>> SDL_SWSURFACE);
>>> SDL_SetAlpha(pSurfaceOneConverted, SDL_SRCALPHA, 254);
>>> SDL_BlitSurface(pSurfaceOneConverted, NULL, pDisplaySurface,
>>> NULL);
>>> SDL_Flip(pDisplaySurface);
>>> SDL_Delay(2000);
>>> return 0;
>>> }
>>> ----------
>>
>>> The source surface is blitted into the correct destination rectangle,
>>> but shifted 4 (not 5) pixels to the right. In the first four
>>> columns of
>>> the destination rectangle, the first four columns of the source are
>>> duplicated.
>>
>>> It seems that the per-surface-alpha blitter has trouble with this
>>> 32-bit
>>> RGBx pixel format. It works correctly if you set the alpha value
>>> to 255
>>> instead of 254 (I suppose a different blitter gets used in that
>>> case).
>>
>> Could it be a bug in the Altivec blitters?
>
> That's possible. setenv("SDL_ALTIVEC_BLIT_FEATURES", "0", 1) will
> turn them off.
>
> -bob
More information about the SDL
mailing list