From c9371e1538d55268402c0f6bec08952cbd5284bf Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Sun, 14 May 2023 21:40:39 +0200 Subject: [PATCH] Fix analyzer warning --- meson_options.txt | 2 +- src/backend_nanovg.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index bcb49a5..e625b38 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -55,4 +55,4 @@ option('use-fontconfig', value : 'disabled', yield : true) -option('version', type : 'string', value : '0.1.1327') +option('version', type : 'string', value : '0.1.1329') diff --git a/src/backend_nanovg.c b/src/backend_nanovg.c index d5203cb..70653b9 100644 --- a/src/backend_nanovg.c +++ b/src/backend_nanovg.c @@ -371,20 +371,18 @@ _d2tk_nanovg_surf_draw(NVGcontext *ctx, int img, d2tk_coord_t xo, d2tk_coord_t w = W; d2tk_coord_t h = H; - float scale = 1.f; if(h != rect->h) { - scale = (float)rect->h / h; + const float scale = (float)rect->h / h; w *= scale; h = rect->h; } if(w > rect->w) { - const float scale_t = (float)rect->w / w; - scale *= scale_t; - h *= scale_t; + const float scale = (float)rect->w / w; + h *= scale; w = rect->w; } -- 2.38.5