cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=572ffe7271f9de88c08df0d354d2ca078c8f6916

commit 572ffe7271f9de88c08df0d354d2ca078c8f6916
Author: Bryce Harrington <br...@osg.samsung.com>
Date:   Wed Feb 14 11:56:02 2018 -0800

    eina: use matrix compose in place of equivalent code in matrix multiply
    
    Summary:
    The eina_matrix3_compose and eina_matrix3_multiply API's are
    mathematically identical (even though the implementations are
    reversed... weird), except that the latter also includes a fastpath for
    identity matrices.
    
    Having two functionally equivalent APIs is redundant, so ideally one or
    the other would be dropped.  But in order avoid API breakage, just have
    one routine wrapper the other and eliminate the internal redundancy.
    
    (Note that the parameter signatures of the two routines are different -
    eina_matrix3_compose() takes the two input matrices first, and the
    output matrix last, while eina_matrix3_multiply() takes the parameters
    in the reverse order.  This inconsistency in the API style could result
    in accidentally erroneous usage and would be an argument for deprecation
    of one of the two APIs.)
    
    Signed-off-by: Bryce Harrington <br...@osg.samsung.com>
    
    Reviewers: cedric
    
    Reviewed By: cedric
    
    Differential Revision: https://phab.enlightenment.org/D5806
    
    Signed-off-by: Cedric Bail <ced...@osg.samsung.com>
---
 src/lib/eina/eina_matrix.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/lib/eina/eina_matrix.c b/src/lib/eina/eina_matrix.c
index e60989f971..1c848f3e98 100644
--- a/src/lib/eina/eina_matrix.c
+++ b/src/lib/eina/eina_matrix.c
@@ -1119,17 +1119,7 @@ eina_matrix3_multiply(Eina_Matrix3 *out, const 
Eina_Matrix3 *mat_a, const Eina_M
         return;
      }
 
-   MATRIX_XX(out) = MATRIX_XX(mat_b) * MATRIX_XX(mat_a) + MATRIX_YX(mat_b) * 
MATRIX_XY(mat_a) + MATRIX_ZX(mat_b) * MATRIX_XZ(mat_a);
-   MATRIX_XY(out) = MATRIX_XY(mat_b) * MATRIX_XX(mat_a) + MATRIX_YY(mat_b) * 
MATRIX_XY(mat_a) + MATRIX_ZY(mat_b) * MATRIX_XZ(mat_a);
-   MATRIX_XZ(out) = MATRIX_XZ(mat_b) * MATRIX_XX(mat_a) + MATRIX_YZ(mat_b) * 
MATRIX_XY(mat_a) + MATRIX_ZZ(mat_b) * MATRIX_XZ(mat_a);
-
-   MATRIX_YX(out) = MATRIX_XX(mat_b) * MATRIX_YX(mat_a) + MATRIX_YX(mat_b) * 
MATRIX_YY(mat_a) + MATRIX_ZX(mat_b) * MATRIX_YZ(mat_a);
-   MATRIX_YY(out) = MATRIX_XY(mat_b) * MATRIX_YX(mat_a) + MATRIX_YY(mat_b) * 
MATRIX_YY(mat_a) + MATRIX_ZY(mat_b) * MATRIX_YZ(mat_a);
-   MATRIX_YZ(out) = MATRIX_XZ(mat_b) * MATRIX_YX(mat_a) + MATRIX_YZ(mat_b) * 
MATRIX_YY(mat_a) + MATRIX_ZZ(mat_b) * MATRIX_YZ(mat_a);
-
-   MATRIX_ZX(out) = MATRIX_XX(mat_b) * MATRIX_ZX(mat_a) + MATRIX_YX(mat_b) * 
MATRIX_ZY(mat_a) + MATRIX_ZX(mat_b) * MATRIX_ZZ(mat_a);
-   MATRIX_ZY(out) = MATRIX_XY(mat_b) * MATRIX_ZX(mat_a) + MATRIX_YY(mat_b) * 
MATRIX_ZY(mat_a) + MATRIX_ZY(mat_b) * MATRIX_ZZ(mat_a);
-   MATRIX_ZZ(out) = MATRIX_XZ(mat_b) * MATRIX_ZX(mat_a) + MATRIX_YZ(mat_b) * 
MATRIX_ZY(mat_a) + MATRIX_ZZ(mat_b) * MATRIX_ZZ(mat_a);
+   eina_matrix3_compose(mat_a, mat_b, out);
 }
 
 EAPI void

-- 


Reply via email to