~hp/d2tk

c9371e1538d55268402c0f6bec08952cbd5284bf — Hanspeter Portner 11 months ago 1fdb0ba
Fix analyzer warning
2 files changed, 4 insertions(+), 6 deletions(-)

M meson_options.txt
M src/backend_nanovg.c
M meson_options.txt => meson_options.txt +1 -1
@@ 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')

M src/backend_nanovg.c => src/backend_nanovg.c +3 -5
@@ 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;
	}