From b51981e0d853f84d18bc5366894fd57764ae60de Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 20 Mar 2021 15:48:59 +0200 Subject: VisBuf: Debug utility --- src/ui/visbuf.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/ui') 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) { } } +//#define DEBUG_SCALE 0.5f + void draw_VisBuf(const iVisBuf *d, iInt2 topLeft) { SDL_Renderer *render = renderer_Window(get_Window()); iForIndices(i, d->buffers) { const iVisBufTexture *buf = d->buffers + i; - SDL_RenderCopy(render, - buf->texture, - NULL, - &(SDL_Rect){ topLeft.x, - topLeft.y + buf->origin, - d->texSize.x, - d->texSize.y }); + SDL_Rect dst = { topLeft.x, + topLeft.y + buf->origin, + d->texSize.x, + d->texSize.y }; +#if defined (DEBUG_SCALE) + dst.w *= DEBUG_SCALE; + dst.h *= DEBUG_SCALE; + dst.x *= DEBUG_SCALE; + dst.y *= DEBUG_SCALE; + dst.x += get_Window()->root->rect.size.x / 4; + dst.y += get_Window()->root->rect.size.y / 4; +#endif + SDL_RenderCopy(render, buf->texture, NULL, &dst); } } -- cgit v1.2.3