summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-20 15:48:59 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-20 15:48:59 +0200
commitb51981e0d853f84d18bc5366894fd57764ae60de (patch)
tree58417ee3f9eef4721733ffb9ae195b6df57f4e45
parent362b47a3671a9c9edf51be8249e5ab0d2beb2f97 (diff)
VisBuf: Debug utility
-rw-r--r--src/ui/visbuf.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/ui/visbuf.c b/src/ui/visbuf.c
index 8a66c300..0f9e1092 100644
--- a/src/ui/visbuf.c
+++ b/src/ui/visbuf.c
@@ -132,16 +132,24 @@ void validate_VisBuf(iVisBuf *d) {
132 } 132 }
133} 133}
134 134
135//#define DEBUG_SCALE 0.5f
136
135void draw_VisBuf(const iVisBuf *d, iInt2 topLeft) { 137void draw_VisBuf(const iVisBuf *d, iInt2 topLeft) {
136 SDL_Renderer *render = renderer_Window(get_Window()); 138 SDL_Renderer *render = renderer_Window(get_Window());
137 iForIndices(i, d->buffers) { 139 iForIndices(i, d->buffers) {
138 const iVisBufTexture *buf = d->buffers + i; 140 const iVisBufTexture *buf = d->buffers + i;
139 SDL_RenderCopy(render, 141 SDL_Rect dst = { topLeft.x,
140 buf->texture, 142 topLeft.y + buf->origin,
141 NULL, 143 d->texSize.x,
142 &(SDL_Rect){ topLeft.x, 144 d->texSize.y };
143 topLeft.y + buf->origin, 145#if defined (DEBUG_SCALE)
144 d->texSize.x, 146 dst.w *= DEBUG_SCALE;
145 d->texSize.y }); 147 dst.h *= DEBUG_SCALE;
148 dst.x *= DEBUG_SCALE;
149 dst.y *= DEBUG_SCALE;
150 dst.x += get_Window()->root->rect.size.x / 4;
151 dst.y += get_Window()->root->rect.size.y / 4;
152#endif
153 SDL_RenderCopy(render, buf->texture, NULL, &dst);
146 } 154 }
147} 155}