[SDL] SDL_BlitSurface on MacOSX 10.3.9

Michael Ryan Bannon mrbannon at swen.uwaterloo.ca
Mon Jul 10 12:36:36 PDT 2006


Thanks for trying it out.  I guess I have a couple options as workarounds. 
But I guess it's rooted in an SDL problem?

Thanks,

Ryan


"Christian Walther" <cwalther at gmx.ch> wrote in message 
news:e8u9l2$a6r$1 at sea.gmane.org...
> 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).
>
> I currently don't have time to debug this. You might want to work around
> it by using a 24-bit RGB or 32-bit xRGB pixel format, these work.
>
>  -Christian 







More information about the SDL mailing list