X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fpcx.c;h=b075940c8447a0a273938c63cb0ce5ddc325b6ad;hb=a8b2caa1d373c84c1b3fc2f615370c2a319051ca;hp=a5fd0c92819bef9931867f43d0eda76f744886b6;hpb=d4665f01d15ba3679f378819710a84d6c2348a9c;p=rocksndiamonds.git diff --git a/src/pcx.c b/src/pcx.c index a5fd0c92..b075940c 100644 --- a/src/pcx.c +++ b/src/pcx.c @@ -11,10 +11,14 @@ * pcx.c * ***********************************************************/ +#ifndef TARGET_SDL + #include "pcx.h" #include "image.h" #include "misc.h" +#define PCX_DEBUG FALSE + #define PCX_MAGIC 0x0a /* first byte in a PCX image file */ #define PCX_LAST_VERSION 5 /* last acceptable version number */ #define PCX_ENCODING 1 /* PCX encoding method */ @@ -152,6 +156,7 @@ Image *Read_PCX_to_Image(char *filename) { /* PCX file is too short to contain a valid PCX header */ fclose(file); + errno_pcx = PCX_FileInvalid; return NULL; } @@ -188,14 +193,16 @@ Image *Read_PCX_to_Image(char *filename) width < 0 || height < 0) { free(file_buffer); + errno_pcx = PCX_FileInvalid; return NULL; } +#if PCX_DEBUG if (options.verbose) { printf("%s is a %dx%d PC Paintbrush image with %d bitplanes\n", - filename, pcx.xmax, pcx.ymax, + filename, width, height, pcx.color_planes); printf("depth: %d\n", pcx.bits_per_pixel); printf("color_planes: %d\n", pcx.color_planes); @@ -204,6 +211,7 @@ Image *Read_PCX_to_Image(char *filename) (pcx.palette_type == 1 ? "color" : pcx.palette_type == 2 ? "grayscale" : "undefined")); } +#endif /* allocate new image structure */ image = newImage(width, height, depth); @@ -216,6 +224,7 @@ Image *Read_PCX_to_Image(char *filename) { free(file_buffer); freeImage(image); + errno_pcx = PCX_FileInvalid; return NULL; } @@ -245,8 +254,12 @@ Image *Read_PCX_to_Image(char *filename) if (image->rgb.color_used[i]) image->rgb.used++; +#if PCX_DEBUG if (options.verbose) printf("Read_PCX_to_Image: %d colors found\n", image->rgb.used); +#endif return image; } + +#endif /* !TARGET_SDL */