| Summary: | SDL_CalculatePitch() too small | ||
|---|---|---|---|
| Product: | SDL | Reporter: | libsdl-bugtracker |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | trivial | ||
| Priority: | P2 | ||
| Version: | 1.2.13 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
|
Description
libsdl-bugtracker
2010-04-21 00:27:20 UTC
Already mentioned by Sylvain Hellegouarch[1] in 2003, who got poor answers. [1]http://lists.libsdl.org/pipermail/sdl-libsdl.org/2003-April/034932.html Do you have a specific example of where this is a problem? The places where I've seen bitmap data used, the pixels are packed in as tightly as possible and the final scanline is aligned on a byte or 4 byte boundary. To access single pixels, you unpack the bits out of the scanline in order. For an example, look at the "Bitmap data" section in the BMP file format: http://en.wikipedia.org/wiki/BMP_file_format I think what you're talking about is an 8 bpp image with a limited palette. See example above: when using a 5 pixel-broad surface with 1 bit per pixel 4 bytes instead of 8 are allocated. If you try to manipulate the last $SURFACE_HEIGHT pixels you will run into memory violation, because no memory was allocated for them. With color depth other than 1 and 4 there is no problem (both not allowed by SDL, so that nobody really runs into problems, but the implementation is incorrect nevertheless) If this is actually a problem for someone, please reopen this bug. For now, I'll close it, since I have lots of other things I need to do. |