Mail Archives: djgpp/1993/05/13/08:57:45
Hi,
again Wonkoo is right. There is a memory waste in the BCC2GRX v1.1 library.
You should replace the src/bccgrx.c __gr_set_up_modes()
with the following code:
void __gr_set_up_modes(void)
{
GR_DRIVER_MODE_ENTRY *tm, *gm;
int mode;
static int DidInit = FALSE;
if (__gr_INIT || DidInit) return;
MM = -1;
GrSetMode( GrCurrentMode()); /* Init grx */
GrGetDriverModes(&tm, &__gr_DATA);
if (__gr_DATA == NULL) {
__gr_modeindx = NULL;
MM = 0;
return;
}
gm = __gr_DATA;
mode = 1;
while (gm->width != 0) {
if (gm->BIOS_mode != 0xFF)
++mode;
gm += 1;
}
__gr_modeindx = (short *) malloc(sizeof(short) * mode);
if (__gr_modeindx == NULL) {
ERR = grError;
return;
}
gm = __gr_DATA;
__gr_modeindx[0] = -1; /* GR_default_graphics */
mode = 1;
while (gm->width != 0) {
if (gm->BIOS_mode != 0xFF)
__gr_modeindx[mode++] = gm-__gr_DATA;
gm += 1;
}
MM = mode - 1;
DidInit = TRUE;
}
The memory will be allocated only once now.
The whole initialisation of the BCC2GRX was reorganised stepping tom 1.0 to
1.1 . It wasn't ready when it reached public and isn't ready until now
(I'm very busy at the moment :-( ). I decided to give it away to overcome
the 256 color problem with 1.0 release.
I hope this patch helps you Wonkoo.
Hartmut
- Raw text -