diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-29 15:33:19 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-29 15:33:19 +0300 |
commit | b1a03400b2d32cf3d82defe15ebe64a3cdcf6981 (patch) | |
tree | ec56e8c36de779659dfb95c1761c5891d4b37cde /src/ui/listwidget.c | |
parent | 2578441c43544205991467720afdfdd0df1ecf4e (diff) |
VisBuf: Increase buffer size for scrolling; fixed glitches
Instead of 1.5x coverage, the buffer now has a full 2x.
Diffstat (limited to 'src/ui/listwidget.c')
-rw-r--r-- | src/ui/listwidget.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c index 942c46dd..95a59090 100644 --- a/src/ui/listwidget.c +++ b/src/ui/listwidget.c | |||
@@ -361,17 +361,18 @@ static void draw_ListWidget_(const iListWidget *d) { | |||
361 | /* TODO: This seems to draw two items per each shift of the visible region, even though | 361 | /* TODO: This seems to draw two items per each shift of the visible region, even though |
362 | one should be enough. Probably an off-by-one error in the calculation of the | 362 | one should be enough. Probably an off-by-one error in the calculation of the |
363 | invalid range. */ | 363 | invalid range. */ |
364 | iAssert(d->visBuf->buffers[0].texture); | 364 | iForIndices(i, d->visBuf->buffers) { |
365 | iAssert(d->visBuf->buffers[1].texture); | 365 | iAssert(d->visBuf->buffers[i].texture); |
366 | iAssert(d->visBuf->buffers[2].texture); | 366 | } |
367 | const int bg[3] = { w->bgColor, w->bgColor, w->bgColor }; | 367 | const int bg[iElemCount(d->visBuf->buffers)] = { |
368 | // const int bg[3] = { red_ColorId, magenta_ColorId, blue_ColorId }; | 368 | w->bgColor, w->bgColor, w->bgColor, w->bgColor |
369 | }; | ||
369 | const int bottom = numItems_ListWidget(d) * d->itemHeight; | 370 | const int bottom = numItems_ListWidget(d) * d->itemHeight; |
370 | const iRangei vis = { d->scrollY / d->itemHeight * d->itemHeight, | 371 | const iRangei vis = { d->scrollY / d->itemHeight * d->itemHeight, |
371 | ((d->scrollY + bounds.size.y) / d->itemHeight + 1) * d->itemHeight }; | 372 | ((d->scrollY + bounds.size.y) / d->itemHeight + 1) * d->itemHeight }; |
372 | reposition_VisBuf(d->visBuf, vis); | 373 | reposition_VisBuf(d->visBuf, vis); |
373 | /* Check which parts are invalid. */ | 374 | /* Check which parts are invalid. */ |
374 | iRangei invalidRange[3]; | 375 | iRangei invalidRange[iElemCount(d->visBuf->buffers)]; |
375 | invalidRanges_VisBuf(d->visBuf, (iRangei){ 0, bottom }, invalidRange); | 376 | invalidRanges_VisBuf(d->visBuf, (iRangei){ 0, bottom }, invalidRange); |
376 | iForIndices(i, d->visBuf->buffers) { | 377 | iForIndices(i, d->visBuf->buffers) { |
377 | iVisBufTexture *buf = &d->visBuf->buffers[i]; | 378 | iVisBufTexture *buf = &d->visBuf->buffers[i]; |