 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Garak
Joined: 27 Jul 2005 Posts: 46
|
Posted: Tue Nov 22, 2005 1:40 am Post subject: SDL - Loading/Displaying Small Images |
|
|
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 |
|
| Back to top |
|
 |
rinco
Joined: 21 Jan 2005 Posts: 255 Location: Canberra, Australia
|
Posted: Tue Nov 22, 2005 1:55 pm Post subject: |
|
|
I reckon the problem lies in the hwaccelerated blitting... non-screen hwsurface blits use this:
| Code: | 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);
|
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). |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|