mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-12 00:30:31 +00:00
hgr-utils: pcx2hr -- clean up whitespace, remove compiler warnings
This commit is contained in:
parent
9efa352160
commit
f39f91863b
@ -45,13 +45,11 @@ static int vmwGetPCXInfo(char *filename, int *xsize, int *ysize, int *type) {
|
||||
bpp=pcx_header[3];
|
||||
|
||||
if (debug) {
|
||||
|
||||
printf("Manufacturer: ");
|
||||
if (pcx_header[0]==10) printf("Zsoft\n");
|
||||
else printf("Unknown %i\n",pcx_header[0]);
|
||||
|
||||
printf("Version: ");
|
||||
|
||||
switch(version) {
|
||||
case 0: printf("2.5\n"); break;
|
||||
case 2: printf("2.8 w palette\n"); break;
|
||||
@ -90,12 +88,12 @@ static int vmwGetPCXInfo(char *filename, int *xsize, int *ysize, int *type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char colors[256];
|
||||
static unsigned char colors[256];
|
||||
|
||||
static int vmwLoadPCX(char *filename, unsigned char *framebuffer) {
|
||||
|
||||
int pcx_fd;
|
||||
int x,y,i,numacross,xsize,ysize,xmin,ymin;
|
||||
int x,i,numacross,xsize,ysize,xmin,ymin;
|
||||
unsigned int r,g,b;
|
||||
int xmax,ymax;
|
||||
unsigned char pcx_header[128];
|
||||
@ -126,7 +124,7 @@ static int vmwLoadPCX(char *filename, unsigned char *framebuffer) {
|
||||
xsize=((xmax-xmin)+1);
|
||||
ysize=((ymax-ymin)+1);
|
||||
|
||||
x=0; y=0;
|
||||
x=0;
|
||||
|
||||
while (x<xsize*ysize) {
|
||||
|
||||
@ -193,7 +191,6 @@ static int vmwLoadPCX(char *filename, unsigned char *framebuffer) {
|
||||
if ((r==0x1b) && (g==0xcb) && (b==0x1)) colors[i]=0x42; /* green */
|
||||
else fprintf(stderr,"Unknown color %i %x %x %x\n",i,r,g,b);
|
||||
|
||||
|
||||
// printf("%i: 0x%x %x %x\n",i,r,g,b);
|
||||
|
||||
}
|
||||
@ -218,11 +215,8 @@ static int make_bw_image(unsigned char *in_framebuffer,
|
||||
|
||||
int page,block,leaf;
|
||||
|
||||
unsigned char *pointer;
|
||||
unsigned char *pcx,*hgr;
|
||||
|
||||
pointer=in_framebuffer;
|
||||
|
||||
pcx=in_framebuffer;
|
||||
hgr=out_framebuffer;
|
||||
|
||||
@ -243,10 +237,10 @@ static int make_bw_image(unsigned char *in_framebuffer,
|
||||
leaf=(y/64);
|
||||
|
||||
yoffset=(page*1024) + (block*128) + (leaf*40);
|
||||
/*
|
||||
printf("%d %d = %x %x %x\n",x,y,fourteen_bits,yoffset,
|
||||
yoffset+(x*2));
|
||||
*/
|
||||
|
||||
// printf("%d %d = %x %x %x\n",x,y,fourteen_bits,yoffset,
|
||||
// yoffset+(x*2));
|
||||
|
||||
hgr=out_framebuffer+yoffset+(x*2);
|
||||
|
||||
*hgr=byte1;
|
||||
@ -267,12 +261,11 @@ static int make_color_image(unsigned char *in_framebuffer,
|
||||
unsigned char byte1,byte2;
|
||||
|
||||
int page,block,leaf;
|
||||
|
||||
unsigned char *pointer;
|
||||
unsigned char *pcx,*hgr;
|
||||
|
||||
pointer=in_framebuffer;
|
||||
#if 0
|
||||
unsigned char *pointer=in_framebuffer;
|
||||
|
||||
for(y=0;y<ysize;y++) {
|
||||
for(x=0;x<xsize;x++) {
|
||||
printf("%1x",*pointer);
|
||||
@ -296,7 +289,6 @@ static int make_color_image(unsigned char *in_framebuffer,
|
||||
|
||||
/* choose which palette */
|
||||
pal[i/4]+= (colors[*pcx]&0x80) - (colors[*pcx]&0x40);
|
||||
|
||||
pcx++;
|
||||
}
|
||||
byte1=(fourteen_bits&0x7f)|((pal[0]>0)<<7);
|
||||
@ -307,10 +299,10 @@ static int make_color_image(unsigned char *in_framebuffer,
|
||||
leaf=(y/64);
|
||||
|
||||
yoffset=(page*1024) + (block*128) + (leaf*40);
|
||||
/*
|
||||
printf("%d %d = %x %x %x\n",x,y,fourteen_bits,yoffset,
|
||||
yoffset+(x*2));
|
||||
*/
|
||||
|
||||
// printf("%d %d = %x %x %x\n",x,y,fourteen_bits,yoffset,
|
||||
// yoffset+(x*2));
|
||||
|
||||
hgr=out_framebuffer+yoffset+(x*2);
|
||||
|
||||
*hgr=byte1;
|
||||
@ -337,7 +329,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
filename=strdup(argv[1]);
|
||||
|
||||
|
||||
vmwGetPCXInfo(filename,&xsize,&ysize,&type);
|
||||
|
||||
in_framebuffer=calloc(xsize*ysize,sizeof(unsigned char));
|
||||
@ -361,7 +352,6 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr,"Warning, possibly truncating due to ysize: %d\n",ysize);
|
||||
}
|
||||
|
||||
|
||||
if (xsize==140) {
|
||||
make_color_image(in_framebuffer,out_framebuffer,xsize,ysize);
|
||||
}
|
||||
@ -374,7 +364,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
unsigned char header[4];
|
||||
|
||||
|
||||
/* assume HGR page 1 */
|
||||
int offset=8192;
|
||||
|
||||
@ -395,7 +384,6 @@ int main(int argc, char **argv) {
|
||||
free(out_framebuffer);
|
||||
free(in_framebuffer);
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user