Easier blit question

well I gave up on HW scaling of RGB, now I just want to put my RGB buffer on
screen fast and with maximum of 10 CPU cycles :slight_smile:

The following code doesn’t work for me :frowning:

SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *DisplaySurface = SDL_GetVideoSurface();

SDL_Surface *FrameSurface;
SDL_Rect srcrect = {0, 0, nWidth, nHeight}; // nWidth = 352, nHeight = 288
SDL_Rect dstrec = {0,0, 352, 288};

FrameSurface = SDL_CreateRGBSurfaceFrom((void *)pFrameBuffer, nWidth,
nHeight, nBpp, 2048, 0xff0000, 0x00ff00, 0x0000ff, 0);
SDL_SetAlpha(FrameSurface, 0, 128);

SDL_BlitSurface(FrameSurface, &srcrect, DisplaySurface, &dstrec);

SDL_FreeSurface(FrameSurface);

any help?

Michael Zayats

“Michael Zayats” wrote:

FrameSurface = SDL_CreateRGBSurfaceFrom((void *)pFrameBuffer, nWidth,
nHeight, nBpp, 2048, 0xff0000, 0x00ff00, 0x0000ff, 0);

make sure those masks correspond to the screen format as well

SDL_SetAlpha(FrameSurface, 0, 128);

pass SDL_SRCALPHA in the flags parameter, not zero. it’s documented