app: in gimp_transform_matrix_generic(), apply matrix even if invalid

In gimp_transform_matrix_generic(), apply the resulting matrix even
if the transformation is invalid, since GimpGenericTransformTool
relies on the matrix to properly update the transform-grid widget.
This commit is contained in:
Ell
2019-02-04 04:58:34 -05:00
parent 7ed512040e
commit 59ef222c7f

View File

@ -441,8 +441,9 @@ gimp_transform_matrix_generic (GimpMatrix3 *matrix,
{ {
GimpMatrix3 trafo; GimpMatrix3 trafo;
gdouble coeff[8 * 9]; gdouble coeff[8 * 9];
gboolean negative; gboolean negative = -1;
gint i; gint i;
gboolean result = TRUE;
g_return_val_if_fail (matrix != NULL, FALSE); g_return_val_if_fail (matrix != NULL, FALSE);
g_return_val_if_fail (input_points != NULL, FALSE); g_return_val_if_fail (input_points != NULL, FALSE);
@ -494,21 +495,26 @@ gimp_transform_matrix_generic (GimpMatrix3 *matrix,
trafo.coeff[2][2]; trafo.coeff[2][2];
if (fabs (w) <= EPSILON) if (fabs (w) <= EPSILON)
return FALSE; result = FALSE;
neg = (w < 0.0); neg = (w < 0.0);
if (i == 0) if (negative < 0)
negative = neg; {
negative = neg;
}
else if (neg != negative) else if (neg != negative)
return FALSE; {
result = FALSE;
break;
}
} }
/* if the output points are all behind the camera, negate the matrix, which /* if the output points are all behind the camera, negate the matrix, which
* would map the input points to the corresponding points in front of the * would map the input points to the corresponding points in front of the
* camera. * camera.
*/ */
if (negative) if (negative > 0)
{ {
gint r; gint r;
gint c; gint c;
@ -525,7 +531,7 @@ gimp_transform_matrix_generic (GimpMatrix3 *matrix,
/* append the transformation to 'matrix' */ /* append the transformation to 'matrix' */
gimp_matrix3_mult (&trafo, matrix); gimp_matrix3_mult (&trafo, matrix);
return TRUE; return result;
} }
gboolean gboolean