diff options
author | ltoetsch <ltoetsch@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2001-03-16 16:40:17 +0000 |
---|---|---|
committer | ltoetsch <ltoetsch@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2001-03-16 16:40:17 +0000 |
commit | 3d24b9bd4612dd293bde38976798288ecb4e1722 (patch) | |
tree | 169f4a2f4abeba86179b873110769a0100e339ce /pixmap.c | |
parent | 8cb47a24a9ab1b5bbf81819d4567be4308db2b54 (diff) | |
download | lcd4linux-3d24b9bd4612dd293bde38976798288ecb4e1722.tar.gz |
[lcd4linux @ 2001-03-16 16:40:17 by ltoetsch]
implemented time bar
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@127 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'pixmap.c')
-rw-r--r-- | pixmap.c | 54 |
1 files changed, 50 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $Id: pixmap.c,v 1.5 2000/03/26 18:46:28 reinelt Exp $ +/* $Id: pixmap.c,v 1.6 2001/03/16 16:40:17 ltoetsch Exp $ * * generic pixmap driver * @@ -20,6 +20,9 @@ * * * $Log: pixmap.c,v $ + * Revision 1.6 2001/03/16 16:40:17 ltoetsch + * implemented time bar + * * Revision 1.5 2000/03/26 18:46:28 reinelt * * bug in pixmap.c that leaded to empty bars fixed @@ -67,10 +70,12 @@ #include <stdlib.h> #include <stdio.h> +#include <time.h> #include "display.h" #include "pixmap.h" #include "fontmap.h" +#include "debug.h" static int ROWS=0; static int COLS=0; @@ -136,6 +141,10 @@ int pix_put (int row, int col, char *text) int pix_bar (int type, int row, int col, int max, int len1, int len2) { int x, y, len, rev; + static int *valbuf = NULL; + static int init = 0; + static time_t old; + time_t now; row*=YRES; col*=XRES; @@ -150,9 +159,24 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2) if (len1<1) len1=1; else if (len1>max) len1=max; - - if (len2<1) len2=1; - else if (len2>max) len2=max; + + if (type == BAR_T) { + if (init == 0 && valbuf == 0) { + valbuf = calloc(len2, sizeof(int)); + if (valbuf == NULL) { + error("Couldn't allocte valbuf"); + init = -1; + return -1; + } + init = 1; + debug("valbuf ok, len2=%d", len2); + time(&old); + } + } + else { + if (len2<1) len2=1; + else if (len2>max) len2=max; + } rev=0; @@ -185,6 +209,28 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2) } break; + case BAR_T: + len1=max-len1; + rev=1; + time(&now); + if (now == old) { + valbuf[len2-1] += len1; + valbuf[len2-1] /= 2; + } + else { + for (; old < now; old++) + for (x=1; x<len2; x++) + valbuf[x-1]=valbuf[x]; + valbuf[len2-1] = len1; + } + for (x=0; x<len2; x++) { + len = valbuf[x]; + for (y=0; y<max; y++) { + LCDpixmap[(row+y)*COLS+col+x]=y<len?!rev:rev; + } + } + break; + } return 0; } |