diff options
Diffstat (limited to 'drv_Image.c')
-rw-r--r-- | drv_Image.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/drv_Image.c b/drv_Image.c index fb317b9..7f8a005 100644 --- a/drv_Image.c +++ b/drv_Image.c @@ -1,9 +1,9 @@ -/* $Id: drv_Image.c 773 2007-02-25 12:39:09Z michael $ - * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/drv_Image.c $ +/* $Id: drv_Image.c 840 2007-09-09 12:17:42Z michael $ + * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Image.c $ * * new style Image (PPM/PNG) Driver for LCD4Linux * - * Copyright (C) 2003 Michael Reinelt <reinelt@eunet.at> + * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at> * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> * * This file is part of LCD4Linux. @@ -80,7 +80,7 @@ static char Name[] = "Image"; -static enum { PPM, PNG } Format; +static enum { NIL, PPM, PNG } Format; static int pixel = -1; /* pointsize in pixel */ static int pgap = 0; /* gap between points */ @@ -114,14 +114,14 @@ static int drv_IMG_flush_PPM(void) if (bitbuf == NULL) { if ((bitbuf = malloc(xsize * ysize * sizeof(*bitbuf))) == NULL) { - error("%s: malloc(%d) failed: %s", Name, (int) xsize * ysize * sizeof(*bitbuf), strerror(errno)); + error("%s: malloc() failed: %s", Name, strerror(errno)); return -1; } } if (rowbuf == NULL) { if ((rowbuf = malloc(3 * xsize * sizeof(*rowbuf))) == NULL) { - error("Raster: malloc(%d) failed: %s", (int) 3 * xsize * sizeof(*rowbuf), strerror(errno)); + error("Raster: malloc() failed: %s", strerror(errno)); return -1; } } @@ -266,6 +266,8 @@ static void drv_IMG_flush(void) drv_IMG_flush_PNG(); #endif break; + default: + break; } } @@ -315,11 +317,21 @@ static int drv_IMG_start(const char *section) return -1; } + Format = NIL; + +#ifdef WITH_PPM if (strcmp(s, "PPM") == 0) { Format = PPM; - } else if (strcmp(s, "PNG") == 0) { + } +#endif + +#ifdef WITH_PNG + if (strcmp(s, "PNG") == 0) { Format = PNG; - } else { + } +#endif + + if (Format == NIL) { error("%s: bad %s.Format '%s' from %s", Name, section, s, cfg_source()); free(s); return -1; @@ -411,7 +423,12 @@ static int drv_IMG_start(const char *section) /* list models */ int drv_IMG_list(void) { - printf("PPM PNG"); +#ifdef WITH_PPM + printf("PPM "); +#endif +#ifdef WITH_PNG + printf("PNG "); +#endif return 0; } @@ -422,7 +439,7 @@ int drv_IMG_init(const char *section, const __attribute__ ((unused)) { int ret; - info("%s: %s", Name, "$Rev: 773 $"); + info("%s: %s", Name, "$Rev: 840 $"); /* real worker functions */ drv_generic_graphic_real_blit = drv_IMG_blit; |