diff options
Diffstat (limited to 'Meter.c')
-rw-r--r-- | Meter.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -289,10 +289,18 @@ static const char* const GraphMeterMode_dotsAscii[] = { }; static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { + const char* caption = Meter_getCaption(this); + attrset(CRT_colors[METER_TEXT]); + const int captionLen = 3; + mvaddnstr(y, x, caption, captionLen); + x += captionLen; + w -= captionLen; + if (w <= 0) + return; + const Machine* host = this->host; GraphData* data = &this->drawData; - assert(w > 0); if ((size_t)w * 2 > data->nValues) { size_t oldNValues = data->nValues; data->nValues = MAXIMUM(oldNValues + (oldNValues / 2), (size_t)w * 2); @@ -315,13 +323,6 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { GraphMeterMode_pixPerRow = PIXPERROW_ASCII; } - const char* caption = Meter_getCaption(this); - attrset(CRT_colors[METER_TEXT]); - int captionLen = 3; - mvaddnstr(y, x, caption, captionLen); - x += captionLen; - w -= captionLen; - if (!timercmp(&host->realtime, &(data->time), <)) { int globalDelay = this->host->settings->delay; struct timeval delay = { .tv_sec = globalDelay / 10, .tv_usec = (globalDelay % 10) * 100000L }; |