X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fanalogtv.c;h=31fe02f3b1f8bc8655aa5eb9e62b6a47375f5a2f;hb=bc7b7a8eb122206d239ec0e693676bcce31be1aa;hp=85ced09c9a1a14dd8829e96c9a86d5f8bf6ec0c4;hpb=e4fa2ac140f7bc56571373a7b7eb585fa4500e38;p=xscreensaver diff --git a/hacks/analogtv.c b/hacks/analogtv.c index 85ced09c..31fe02f3 100644 --- a/hacks/analogtv.c +++ b/hacks/analogtv.c @@ -1,4 +1,4 @@ -/* analogtv, Copyright (c) 2003 Trevor Blackwell +/* analogtv, Copyright (c) 2003, 2004 Trevor Blackwell * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -264,8 +264,9 @@ analogtv_alloc_image(analogtv *it) if (!it->image) { it->image = XCreateImage(it->dpy, it->xgwa.visual, it->xgwa.depth, ZPixmap, 0, 0, it->usewidth, it->useheight, 8, 0); - it->image->data = (char *)calloc(it->image->height, it->image->bytes_per_line); + it->image->data = (char *)malloc(it->image->height * it->image->bytes_per_line); } + memset (it->image->data, 0, it->image->height * it->image->bytes_per_line); } @@ -851,7 +852,7 @@ void analogtv_setup_sync(analogtv_input *input, int do_cb, int do_ssavi) { int i,lineno,vsync; - char *sig; + signed char *sig; int synclevel = do_ssavi ? ANALOGTV_WHITE_LEVEL : ANALOGTV_SYNC_LEVEL; @@ -1565,6 +1566,9 @@ analogtv_draw(analogtv *it) #endif XSync(it->dpy,0); + + /* Small delay to avoid hogging the CPU. */ + usleep (10000); } analogtv_input * @@ -1719,9 +1723,9 @@ void analogtv_add_signal(analogtv *it, analogtv_reception *rec) double *ps=it->rx_signal; double *pe=it->rx_signal + ANALOGTV_SIGNAL_LEN; double *p=ps; - char *ss=&inp->signal[0][0]; - char *se=&inp->signal[0][0] + ANALOGTV_SIGNAL_LEN; - char *s=ss + ((unsigned)rec->ofs % ANALOGTV_SIGNAL_LEN); + signed char *ss=&inp->signal[0][0]; + signed char *se=&inp->signal[0][0] + ANALOGTV_SIGNAL_LEN; + signed char *s=ss + ((unsigned)rec->ofs % ANALOGTV_SIGNAL_LEN); int i; int ec=it->channel_change_cycles; double level=rec->level;