From 5f719c8ea327c30cb927dbbd1f161ea767db08aa Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 9 Jul 2024 11:38:40 +0200 Subject: [PATCH] transform: Implement transform_point() for dihedrals No longer using the default path and risking rounding issues. --- gsk/gsktransform.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gsk/gsktransform.c b/gsk/gsktransform.c index 84436c1bcc..912b2a837e 100644 --- a/gsk/gsktransform.c +++ b/gsk/gsktransform.c @@ -2432,11 +2432,23 @@ gsk_transform_transform_point (GskTransform *self, } break; + case GSK_FINE_TRANSFORM_CATEGORY_2D_DIHEDRAL: + { + GdkDihedral dihedral; + float xx, xy, yx, yy, dx, dy, scale_x, scale_y; + + gsk_transform_to_dihedral (self, &dihedral, &scale_x, &scale_y, &dx, &dy); + gdk_dihedral_get_mat2 (dihedral, &xx, &xy, &yx, &yy); + + *out_point = GRAPHENE_POINT_INIT ((xx * point->x + xy * point->y) * scale_x + dx, + (yx * point->x + yy * point->y) * scale_y + dy); + } + break; + case GSK_FINE_TRANSFORM_CATEGORY_UNKNOWN: case GSK_FINE_TRANSFORM_CATEGORY_ANY: case GSK_FINE_TRANSFORM_CATEGORY_3D: case GSK_FINE_TRANSFORM_CATEGORY_2D: - case GSK_FINE_TRANSFORM_CATEGORY_2D_DIHEDRAL: default: { graphene_matrix_t mat;