diff options
author | infirit <[email protected]> | 2014-07-25 14:24:48 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-07-25 14:24:48 +0200 |
commit | 1e96ab6e11d74ad363cbe9a905065924edf56437 (patch) | |
tree | dce1dfb1b23734270dad6913833fa3491369e62a | |
parent | 8177977dca2a3b0805d78183bf9fe09637ca5bb5 (diff) | |
download | eom-1e96ab6e11d74ad363cbe9a905065924edf56437.tar.bz2 eom-1e96ab6e11d74ad363cbe9a905065924edf56437.tar.xz |
Fix calculation of reference matrices for transpose/transverse
The flip matrices were applied as if the source matrix were an
identity matrix instead of properly multiplicating them.
Based on eog commit f2a9be530668155e2a6ab31213f230b104f4832b
From Felix Riemann <[email protected]>
-rw-r--r-- | src/eom-transform.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/eom-transform.c b/src/eom-transform.c index ab6935d..8651915 100644 --- a/src/eom-transform.c +++ b/src/eom-transform.c @@ -357,7 +357,7 @@ eom_transform_new (EomTransformType type) EomTransformType eom_transform_get_transform_type (EomTransform *trans) { - cairo_matrix_t affine; + cairo_matrix_t affine, a1, a2; EomTransformPrivate *priv; g_return_val_if_fail (EOM_IS_TRANSFORM (trans), EOM_TRANSFORM_NONE); @@ -391,15 +391,19 @@ eom_transform_get_transform_type (EomTransform *trans) return EOM_TRANSFORM_FLIP_VERTICAL; } - cairo_matrix_init_rotate (&affine, EOM_DEG_TO_RAD(90)); - _eom_cairo_matrix_flip (&affine, &affine, TRUE, FALSE); + cairo_matrix_init_rotate (&a1, EOM_DEG_TO_RAD(90)); + cairo_matrix_init_identity (&a2); + _eom_cairo_matrix_flip (&a2, &a2, TRUE, FALSE); + cairo_matrix_multiply(&affine, &a1, &a2); if (_eom_cairo_matrix_equal (&affine, &priv->affine)) { return EOM_TRANSFORM_TRANSPOSE; } - cairo_matrix_init_rotate (&affine, EOM_DEG_TO_RAD(90)); - _eom_cairo_matrix_flip (&affine, &affine, FALSE, TRUE); - if (_eom_cairo_matrix_equal (&affine, &priv->affine)) { + /* A transversion is a 180° rotation followed by a transposition */ + /* Reuse the transposition from the previous step for this. */ + cairo_matrix_init_rotate (&a1, EOM_DEG_TO_RAD(180)); + cairo_matrix_multiply(&a2, &a1, &affine); + if (_eom_cairo_matrix_equal (&a2, &priv->affine)) { return EOM_TRANSFORM_TRANSVERSE; } |