Greetings,
Small images do not seem to load correctly in SDL. When I load an image with a width of less then 35 pixels or so, the image gets drawn to the screen incorrectly, almost like the pixel data is off by a little bit. From what I an tell, the width and height both need to be a minimum of somewhere around 48 x 300 or so. I also noticed a weird effect where if the height is not big enough, I cannot use an SDL color key to make a transparent background for an image. The image will draw to the screen, but it does not have a transparent background, the transparent color is drawn as well.
Here are some rough numbers I have noticed:
Width <= 35, height anything – Image is drawn incorrectly, as if pixels are off. I print image height and width to screen, and SDL surface has correct values
Width >= 48, height <= 300 – Image draws to screen correctly, but transparent background color is ignored.
I have tried using SDL_Image to load the same files in a PNG format, but the same problem occurs. Any ideas as to what could be causing this problem?
Garak
SDL - Loading/Displaying Small Images
I reckon the problem lies in the hwaccelerated blitting... non-screen hwsurface blits use this:
Perhaps it was a bit presumptious of me to assume the source buffer width and destination buffer width are block aligned, and the data to be quad aligned. I'll submit a fix tonight (ie: fall back to a sw blit).
Code: Select all
sceGuCopyImage(current_video->hidden->tpsm,
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
src->pitch / src->format->BytesPerPixel, src->pixels,
dstrect->x, dstrect->y, dst->pitch / dst->format->BytesPerPixel,
dst->pixels);