Mercurial > dwindows
comparison os2/dw.c @ 1699:df7ca5c4fa5b
Removed some code to workaround a buggy version of GBM on OS/2.
Moved the GBM debug messages into #ifdef DEBUG
The version of GBM that comes with my version of eCS is very buggy.
It fails to load most PNG images and once it fails to load a PNG
other types start failing as well. Installing the latest version
into c:\OS2\DLL corrects the issues and PNG/JPG files work fine.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 03 May 2012 09:04:13 +0000 |
parents | e31c7e389b2f |
children | 4487f6bc9e8b |
comparison
equal
deleted
inserted
replaced
1698:e31c7e389b2f | 1699:df7ca5c4fa5b |
---|---|
6768 _gbm_query_n_filetypes(&ft); | 6768 _gbm_query_n_filetypes(&ft); |
6769 | 6769 |
6770 for(z=0;z<ft;z++) | 6770 for(z=0;z<ft;z++) |
6771 { | 6771 { |
6772 /* Read the file header */ | 6772 /* Read the file header */ |
6773 if((err = _gbm_read_header(file, fd, z, &gbm, "")) == 0 && gbm.bpp > 1) | 6773 if((err = _gbm_read_header(file, fd, z, &gbm, "")) == 0) |
6774 break; | 6774 break; |
6775 } | 6775 } |
6776 | 6776 |
6777 /* If we failed to load the header */ | 6777 /* If we failed to load the header */ |
6778 if(err) | 6778 if(err) |
6779 { | 6779 { |
6780 #ifdef DEBUG | |
6780 dw_debug("GBM: Read header type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err)); | 6781 dw_debug("GBM: Read header type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err)); |
6782 #endif | |
6781 _gbm_io_close(fd); | 6783 _gbm_io_close(fd); |
6782 return 0; | 6784 return 0; |
6783 } | 6785 } |
6784 | 6786 |
6785 /* if less than 24-bit, then have palette */ | 6787 /* if less than 24-bit, then have palette */ |
6787 { | 6789 { |
6788 gbmrgb = alloca(sizeof(GBMRGB)); | 6790 gbmrgb = alloca(sizeof(GBMRGB)); |
6789 /* Read the palette from the file */ | 6791 /* Read the palette from the file */ |
6790 if((err = _gbm_read_palette(fd, z, &gbm, gbmrgb)) != 0) | 6792 if((err = _gbm_read_palette(fd, z, &gbm, gbmrgb)) != 0) |
6791 { | 6793 { |
6794 #ifdef DEBUG | |
6792 dw_debug("GBM: Read palette type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err)); | 6795 dw_debug("GBM: Read palette type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err)); |
6796 #endif | |
6793 _gbm_io_close(fd); | 6797 _gbm_io_close(fd); |
6794 return 0; | 6798 return 0; |
6795 } | 6799 } |
6796 } | 6800 } |
6797 else | 6801 else |
6799 | 6803 |
6800 /* Save the dimension for return */ | 6804 /* Save the dimension for return */ |
6801 *width = gbm.w; | 6805 *width = gbm.w; |
6802 *height = gbm.h; | 6806 *height = gbm.h; |
6803 byteswidth = (((gbm.w*gbm.bpp + 31)/32)*4); | 6807 byteswidth = (((gbm.w*gbm.bpp + 31)/32)*4); |
6804 /*dw_debug("Read header %dx%d bpp %d bytes wide %d bytes total %d \"%s\"\n", *width, *height, gbm.bpp, byteswidth, byteswidth * gbm.h, file);*/ | |
6805 | 6808 |
6806 /* Allocate a buffer to store the image */ | 6809 /* Allocate a buffer to store the image */ |
6807 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)byteswidth * gbm.h, | 6810 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)byteswidth * gbm.h, |
6808 PAG_READ | PAG_WRITE | PAG_COMMIT); | 6811 PAG_READ | PAG_WRITE | PAG_COMMIT); |
6809 | 6812 |
6810 /* Read the data into our buffer */ | 6813 /* Read the data into our buffer */ |
6811 if((err = _gbm_read_data(fd, z, &gbm, BitmapFileBegin)) != 0) | 6814 if((err = _gbm_read_data(fd, z, &gbm, BitmapFileBegin)) != 0) |
6812 { | 6815 { |
6816 #ifdef DEBUG | |
6813 dw_debug("GBM: Read data type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err)); | 6817 dw_debug("GBM: Read data type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err)); |
6818 #endif | |
6814 _gbm_io_close(fd); | 6819 _gbm_io_close(fd); |
6815 DosFreeMem(BitmapFileBegin); | 6820 DosFreeMem(BitmapFileBegin); |
6816 return 0; | 6821 return 0; |
6817 } | 6822 } |
6818 | 6823 |