Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#63 closed defect (fixed)

User bitmaps with more than 16 colors in their palette fail to load in toolbar

Reported by: gyoung Owned by: StevenHL
Priority: major Milestone: Release_3.05_beta7
Component: fm/2 base Version:
Keywords: Cc:

Description

I tried to load David's new unlock.bmp by defining a new button on the toolbar and installing the bitmap as a "user-defined bitmap". The button always comes up as a text button. If I change the color palette to 16 colors the bitmap works. If I compile it into the resources with the original palette it works. the code that is failing is below. I don't see what is going wrong.

/* We now position the stream on the color table information...............*/ rc = fseek(File,ulOffset,SEEK_SET); if(rc)

{

Runtime_Error(pszSrcFile, LINE, "LoadBitmapFromFile?"); goto ExitLoadBMP;

ulOffset is coming from one of the following. In this case it is from case 1.

(case 1 only one sub format in file)

f2 = pbih2->cbFix > sizeof(*pbih); 1.x or 2.x bitmap /* We will need to read the color table. Thus we position the stream...*/ /* so that the next read will read IT. This, of course, depends on the.*/ /* type of the bitmap (old vs new), note that in the NEW case, we can..*/ /* not be certain of the size of the bitmap header.....................*/ ulOffset = (f2) ? sizeof(*pbfh2) + pbih->cbFix - sizeof(*pbih2) :

sizeof(*pbfh);

(case 2 multiple sub formats)

f2 = pbih2->cbFix > sizeof(*pbih); /* as before, we calculate where to position the stream in order to ...*/ /* read the color table information....................................*/ ulOffset = ulOffsetTemp; ulOffset+= (f2) ? sizeof(*pbafh2) + pbih2->cbFix - sizeof(*pbih2):

sizeof(*pbafh);

I know this because I filled the file with doserror checks see attached loadbitmap.c and this is where it fails. The next higher doserror call is immediately before the call to calculate the stream position.

When I load fm2 I get the error at line 222 and then 2 errors at line 66. The second 2 errors are caused by trying to load a bitmap that could not be processed. One in the toolbar and one in the button edit dialog.

code that fails on line 66

--- open the file File = _fsopen(pszFileName,"r",SH_DENYWR); if(!File)

Attachments (1)

loadbmp.c (11.3 KB) - added by gyoung 13 years ago.

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by gyoung

comment:1 Changed 13 years ago by gyoung

  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 13 years ago by gyoung

  • Milestone set to Release_3.05_beta7
Note: See TracTickets for help on using tickets.