~siretart/lcd4linux/debian

« back to all changes in this revision

Viewing changes to drv_Image.c

  • Committer: Reinhard Tartler
  • Date: 2011-04-27 17:28:49 UTC
  • mfrom: (0.1.1 upstream)
  • Revision ID: siretart@tauware.de-20110427172849-mj5cj5a0igpcc9fn
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: drv_Image.c 773 2007-02-25 12:39:09Z michael $
2
 
 * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/drv_Image.c $
 
1
/* $Id: drv_Image.c 840 2007-09-09 12:17:42Z michael $
 
2
 * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_Image.c $
3
3
 *
4
4
 * new style Image (PPM/PNG) Driver for LCD4Linux 
5
5
 *
6
 
 * Copyright (C) 2003 Michael Reinelt <reinelt@eunet.at>
 
6
 * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at>
7
7
 * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
8
8
 *
9
9
 * This file is part of LCD4Linux.
80
80
 
81
81
static char Name[] = "Image";
82
82
 
83
 
static enum { PPM, PNG } Format;
 
83
static enum { NIL, PPM, PNG } Format;
84
84
 
85
85
static int pixel = -1;          /* pointsize in pixel */
86
86
static int pgap = 0;            /* gap between points */
114
114
 
115
115
    if (bitbuf == NULL) {
116
116
        if ((bitbuf = malloc(xsize * ysize * sizeof(*bitbuf))) == NULL) {
117
 
            error("%s: malloc(%d) failed: %s", Name, (int) xsize * ysize * sizeof(*bitbuf), strerror(errno));
 
117
            error("%s: malloc() failed: %s", Name, strerror(errno));
118
118
            return -1;
119
119
        }
120
120
    }
121
121
 
122
122
    if (rowbuf == NULL) {
123
123
        if ((rowbuf = malloc(3 * xsize * sizeof(*rowbuf))) == NULL) {
124
 
            error("Raster: malloc(%d) failed: %s", (int) 3 * xsize * sizeof(*rowbuf), strerror(errno));
 
124
            error("Raster: malloc() failed: %s", strerror(errno));
125
125
            return -1;
126
126
        }
127
127
    }
266
266
        drv_IMG_flush_PNG();
267
267
#endif
268
268
        break;
 
269
    default:
 
270
        break;
269
271
    }
270
272
}
271
273
 
315
317
        return -1;
316
318
    }
317
319
 
 
320
    Format = NIL;
 
321
 
 
322
#ifdef WITH_PPM
318
323
    if (strcmp(s, "PPM") == 0) {
319
324
        Format = PPM;
320
 
    } else if (strcmp(s, "PNG") == 0) {
 
325
    }
 
326
#endif
 
327
 
 
328
#ifdef WITH_PNG
 
329
    if (strcmp(s, "PNG") == 0) {
321
330
        Format = PNG;
322
 
    } else {
 
331
    }
 
332
#endif
 
333
 
 
334
    if (Format == NIL) {
323
335
        error("%s: bad %s.Format '%s' from %s", Name, section, s, cfg_source());
324
336
        free(s);
325
337
        return -1;
411
423
/* list models */
412
424
int drv_IMG_list(void)
413
425
{
414
 
    printf("PPM PNG");
 
426
#ifdef WITH_PPM
 
427
    printf("PPM ");
 
428
#endif
 
429
#ifdef WITH_PNG
 
430
    printf("PNG ");
 
431
#endif
415
432
    return 0;
416
433
}
417
434
 
422
439
{
423
440
    int ret;
424
441
 
425
 
    info("%s: %s", Name, "$Rev: 773 $");
 
442
    info("%s: %s", Name, "$Rev: 840 $");
426
443
 
427
444
    /* real worker functions */
428
445
    drv_generic_graphic_real_blit = drv_IMG_blit;