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 409 - LBM loading doesn't work for some images
Summary: LBM loading doesn't work for some images
Status: RESOLVED FIXED
Alias: None
Product: SDL_image
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-04 13:15 UTC by Dennis Payne
Modified: 2007-07-19 21:38 UTC (History)
0 users

See Also:


Attachments
sample image contributed by dulsi (54.38 KB, application/octet-stream)
2007-07-14 10:51 UTC, Sam Lantinga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Payne 2007-03-04 13:15:42 UTC
I found some images used in a Bard's Tale Construction Set game that don't load properly.  When the LBM is a packed bitmap the number of planes are set to one.  This causes the number of colors in the palette to be set to 2.  Here is a patch to fix the problem.  I think it is correct but I don't have a lot of LBM files to test with.  Some broken LBMs can be found in Bard's Lore I found at http://bardstale.brotherhood.de/talefiles/cs/files/index.html


--- IMG_lbm.c.orig	2007-03-04 15:56:51.000000000 -0500
+++ IMG_lbm.c	2007-03-04 15:58:45.000000000 -0500
@@ -297,7 +297,8 @@
 			Image->format->palette->colors[i].g = Image->format->palette->colors[i%nbcolors].g;
 			Image->format->palette->colors[i].b = Image->format->palette->colors[i%nbcolors].b;
 		}
-		Image->format->palette->ncolors = nbrcolorsfinal;
+		if ( !pbm )
+			Image->format->palette->ncolors = nbrcolorsfinal;
 	}
 
 	/* Get the bitmap */
Comment 1 Sam Lantinga 2007-07-12 20:21:52 UTC
Can you attach a sample image?
Comment 2 Sam Lantinga 2007-07-14 10:51:44 UTC
Created attachment 226 [details]
sample image contributed by dulsi
Comment 3 Sam Lantinga 2007-07-19 21:38:44 UTC
I tried contacting the author of the previous patch that introduced this bug, but got no response.

Unless someone comes up with a problem with this, I'm checking this in as subversion revision 3341

Thanks!