We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4359 - SDL_CalculatePitch() returns zero for 1 and 4 bits per pixel formats
Summary: SDL_CalculatePitch() returns zero for 1 and 4 bits per pixel formats
Status: RESOLVED DUPLICATE of bug 4785
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.9
Hardware: x86_64 Linux
: P2 minor
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-05 18:14 UTC by DafabHoid
Modified: 2019-09-11 14:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DafabHoid 2018-11-05 18:14:15 UTC
Calling SDL_CalculatePitch() with one of the pixel formats INDEX1MSB, INDEX1LSB, INDEX4MSB, INDEX4LSB returns zero.
This makes it impossible to create a surface with one of those formats, because SDL_CreateRGBSurfaceWithFormat returns a surface with a pitch of 0 and a pixels array malloc'ed with size 0. For obvious reasons such a surface can't be blitted nor converted and is therefore not usable.

The reason is that SDL_BYTESPERPIXEL() returns 0 for those formats, which is probably a problem in some other areas as well. I do not know if SDL plans to still support those formats, as they do not seem to be very popular, but in its current state they are just unusable.
Comment 1 Sylvain 2019-09-11 14:13:22 UTC
This is duplicate of bug 4785

*** This bug has been marked as a duplicate of bug 4785 ***