summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJames Simmons <jsimmons@maxwell.earthlink.net>2003-02-23 21:47:29 -0800
committerJames Simmons <jsimmons@maxwell.earthlink.net>2003-02-23 21:47:29 -0800
commit33ab600b975419dd0e2e33750e6ee14e9ff0a5d6 (patch)
treed04bcef45185bee3aa670dc06dfc6931ecfb0954 /scripts
parent7a00c8d329d04d563905f824dd8744dd4d90e750 (diff)
[FBDEV] Minor fixes for logo code.
[FBCON] More optimizations for drawing a string of characters. [VGACON] Using more code from video/vga.h. [VGA] Changes membase to unsigned long to support 64 bit platforms.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pnmtologo.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/scripts/pnmtologo.c b/scripts/pnmtologo.c
index 7c82ee9eab6d..8964097b3c7d 100644
--- a/scripts/pnmtologo.c
+++ b/scripts/pnmtologo.c
@@ -110,6 +110,12 @@ static unsigned int get_number(FILE *fp)
return val;
}
+static unsigned int get_number255(FILE *fp, unsigned int maxval)
+{
+ unsigned int val = get_number(fp);
+ return (255*val+maxval/2)/maxval;
+}
+
static void read_image(void)
{
FILE *fp;
@@ -137,8 +143,8 @@ static void read_image(void)
case '5':
case '6':
/* Binary PBM/PGM/PPM */
- die("%s: Binary PNM is not supported.\n"
- "Use pnmnoraw(1) to convert it to ASCII.\n", filename);
+ die("%s: Binary PNM is not supported\n"
+ "Use pnmnoraw(1) to convert it to ASCII PNM\n", filename);
default:
die("%s is not a PNM file\n", filename);
@@ -172,7 +178,7 @@ static void read_image(void)
for (i = 0; i < logo_height; i++)
for (j = 0; j < logo_width; j++)
logo_data[i][j].red = logo_data[i][j].green =
- logo_data[i][j].blue = 255*get_number(fp)/maxval;
+ logo_data[i][j].blue = get_number255(fp, maxval);
break;
case '3':
@@ -180,9 +186,9 @@ static void read_image(void)
maxval = get_number(fp);
for (i = 0; i < logo_height; i++)
for (j = 0; j < logo_width; j++) {
- logo_data[i][j].red = 255*get_number(fp)/maxval;
- logo_data[i][j].green = 255*get_number(fp)/maxval;
- logo_data[i][j].blue = 255*get_number(fp)/maxval;
+ logo_data[i][j].red = get_number255(fp, maxval);
+ logo_data[i][j].green = get_number255(fp, maxval);
+ logo_data[i][j].blue = get_number255(fp, maxval);
}
break;
}
@@ -306,7 +312,9 @@ static void write_logo_vga16(void)
if (is_equal(logo_data[i][j], clut_vga16[k]))
break;
if (k == 16)
- die("Image must use the 16 console colors only\n");
+ die("Image must use the 16 console colors only\n"
+ "Use ppmquant(1) -map clut_vga16.ppm to reduce the number "
+ "of colors\n");
}
/* write file header */
@@ -344,7 +352,8 @@ static void write_logo_clut224(void)
break;
if (k == logo_clutsize) {
if (logo_clutsize == MAX_LINUX_LOGO_COLORS)
- die("Image has more than %d colors\n",
+ die("Image has more than %d colors\n"
+ "Use ppmquant(1) to reduce the number of colors\n",
MAX_LINUX_LOGO_COLORS);
logo_clut[logo_clutsize++] = logo_data[i][j];
}