nanosvg icon indicating copy to clipboard operation
nanosvg copied to clipboard

nsvg__xformInverse clobbers the input matrix with non-invertible input

Open mrshpot opened this issue 6 years ago • 1 comments

When xformInverse detects a non-invertible matrix it sets the input 't' to identity instead of the output 'inv'.

static void nsvg__xformInverse(float* inv, float* t)
{
	double invdet, det = (double)t[0] * t[3] - (double)t[2] * t[1];
	if (det > -1e-6 && det < 1e-6) {
		nsvg__xformIdentity(t); // <- should be xformIdentity(inv)
		return;
	}
	<...>
}

mrshpot avatar Dec 29 '17 11:12 mrshpot

Agree. "inv" expected to be returned else it will be undefined.

SergeySlice avatar Jul 05 '18 19:07 SergeySlice