You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SDL doesn't allow BitsPerPixel smaller than 8 and cases are 1 and 4, which will never be matched
as surface.pitch is a multiple of 8 bits,1 byte respectively , 1 and 4 BitsPerPixel both result in 1 BytesPerPixel (see SDL_AllocFormat()) and therefore it doesn't make sense to treat them differently considering the byte aligning
to access single pixels via surface.pixels you use at least multiples sizeof(char), so that for a given surface.w insufficient memory is allocated at surface creation: (pitch+7)/8, (pitch+1)/2 (surface.w = 5, 1 BitsPerPixel, 1 BytesPerPixel produces pitch=1 (4 aligned) instead of pitch=5 (8 aligned))
On 2010-04-21 00:30:45 +0000, wrote:
Already mentioned by Sylvain Hellegouarch[1] in 2003, who got poor answers.
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.
I think what you're talking about is an 8 bpp image with a limited palette.
On 2010-04-24 04:46:56 +0000, wrote:
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)
On 2012-01-02 00:09:38 +0000, Sam Lantinga wrote:
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.
The text was updated successfully, but these errors were encountered:
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 1.2.13
Reported for operating system, platform: Linux, x86
Comments on the original bug report:
On 2010-04-21 00:27:20 +0000, wrote:
On 2010-04-21 00:30:45 +0000, wrote:
On 2010-04-23 02:04:30 +0000, Sam Lantinga wrote:
On 2010-04-24 04:46:56 +0000, wrote:
On 2012-01-02 00:09:38 +0000, Sam Lantinga wrote:
The text was updated successfully, but these errors were encountered: