summaryrefslogtreecommitdiff
path: root/src/ui/visbuf.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-16 15:13:43 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-16 15:13:43 +0300
commit901c8d6248b8b0fe35adfec881fe00fc423fd8dd (patch)
tree77a323163fbaa6b5a0c36797b274d826d3b6f909 /src/ui/visbuf.c
parente635e4c2c58afd3a329875b3b044d0df717b20a2 (diff)
VisBuf: Only draw buffers that are within bounds
One of the four buffers will be always outside the viewport.
Diffstat (limited to 'src/ui/visbuf.c')
-rw-r--r--src/ui/visbuf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ui/visbuf.c b/src/ui/visbuf.c
index a9443b34..e9bfee58 100644
--- a/src/ui/visbuf.c
+++ b/src/ui/visbuf.c
@@ -219,7 +219,7 @@ void validate_VisBuf(iVisBuf *d) {
219 219
220//#define DEBUG_SCALE 0.5f 220//#define DEBUG_SCALE 0.5f
221 221
222void draw_VisBuf(const iVisBuf *d, iInt2 topLeft) { 222void draw_VisBuf(const iVisBuf *d, const iInt2 topLeft, const iRangei yClipBounds) {
223 SDL_Renderer *render = renderer_Window(get_Window()); 223 SDL_Renderer *render = renderer_Window(get_Window());
224 iForIndices(i, d->buffers) { 224 iForIndices(i, d->buffers) {
225 const iVisBufTexture *buf = d->buffers + i; 225 const iVisBufTexture *buf = d->buffers + i;
@@ -227,6 +227,9 @@ void draw_VisBuf(const iVisBuf *d, iInt2 topLeft) {
227 topLeft.y + buf->origin, 227 topLeft.y + buf->origin,
228 d->texSize.x, 228 d->texSize.x,
229 d->texSize.y }; 229 d->texSize.y };
230 if (dst.y >= yClipBounds.end || dst.y + dst.h < yClipBounds.start) {
231 continue; /* Outside the clipping area. */
232 }
230#if defined (DEBUG_SCALE) 233#if defined (DEBUG_SCALE)
231 dst.w *= DEBUG_SCALE; 234 dst.w *= DEBUG_SCALE;
232 dst.h *= DEBUG_SCALE; 235 dst.h *= DEBUG_SCALE;