Allow the use of unpaletted BMPs for the font -- treat them as mono. (In

fact, they have no attributes at all, nor is the cursor ever visible.)
This commit is contained in:
William McBrine
2007-07-05 01:21:03 +00:00
parent ea0d0ea724
commit f7324dfb4e
2 changed files with 15 additions and 10 deletions

View File

@@ -13,7 +13,7 @@
#include "pdcsdl.h"
RCSID("$Id: pdcdisp.c,v 1.25 2007/07/03 00:11:46 wmcbrine Exp $")
RCSID("$Id: pdcdisp.c,v 1.26 2007/07/05 01:21:03 wmcbrine Exp $")
#include <stdlib.h>
#include <string.h>
@@ -88,6 +88,9 @@ static void _set_attr(chtype ch)
{
short newfg, newbg;
if (SP->mono)
return;
PDC_pair_content(PAIR_NUMBER(ch), &newfg, &newbg);
newfg |= (ch & A_BOLD) ? 8 : 0;
@@ -129,6 +132,9 @@ void PDC_gotoyx(int row, int col)
PDC_LOG(("PDC_gotoyx() - called: row %d col %d from row %d col %d\n",
row, col, SP->cursrow, SP->curscol));
if (SP->mono)
return;
oldrow = SP->cursrow;
oldcol = SP->curscol;
@@ -178,6 +184,9 @@ static void _highlight(SDL_Rect *src, SDL_Rect *dest, chtype ch)
{
short col = SP->line_color;
if (SP->mono)
return;
if (ch & A_UNDERLINE)
{
if (col != -1)

View File

@@ -13,7 +13,7 @@
#include "pdcsdl.h"
RCSID("$Id: pdcscrn.c,v 1.24 2007/07/03 18:39:28 wmcbrine Exp $")
RCSID("$Id: pdcscrn.c,v 1.25 2007/07/05 01:21:03 wmcbrine Exp $")
#include "deffont.h"
#include "deficon.h"
@@ -84,15 +84,13 @@ int PDC_scr_open(int argc, char **argv)
return ERR;
}
if (!pdc_font->format->palette)
{
fprintf(stderr, "Font must have a palette\n");
return ERR;
}
SP->mono = !pdc_font->format->palette;
pdc_fheight = pdc_font->h / 8;
pdc_fwidth = pdc_font->w / 32;
pdc_flastc = pdc_font->format->palette->ncolors - 1;
if (!SP->mono)
pdc_flastc = pdc_font->format->palette->ncolors - 1;
if (pdc_own_screen && !pdc_icon)
{
@@ -160,8 +158,6 @@ int PDC_scr_open(int argc, char **argv)
PDC_reset_prog_mode();
SP->mono = FALSE;
pdc_lastscr = newwin(SP->lines, SP->cols, 0, 0);
wattrset(pdc_lastscr, (chtype)(-1));
werase(pdc_lastscr);