summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorSubhransu Mohanty <sub.mohanty@samsung.com>2015-04-17 11:19:59 +0900
committerCedric BAIL <cedric@osg.samsung.com>2015-04-17 10:52:16 +0200
commitee99232b36118eb4c132667f9dd8277681fa4e49 (patch)
tree502f15231471b755c0033813166646b2338fd8a8 /src/lib/eina
parentc9232109f04efa5b38853950dc9c7cc67882b211 (diff)
eina: updated matrix_translate, matrix_scale and matrix_rotate implementation to do compose of the matrix in not identity matrix.
This is a late change that has been discussing on the ML as we don't want to release an API, we can't make faster. Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_matrix.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/src/lib/eina/eina_matrix.c b/src/lib/eina/eina_matrix.c
index dc2e65cc21..61ee824b7a 100644
--- a/src/lib/eina/eina_matrix.c
+++ b/src/lib/eina/eina_matrix.c
@@ -419,29 +419,33 @@ eina_matrix3_f16p16_compose(const Eina_Matrix3_F16p16 *m1,
419EAPI void 419EAPI void
420eina_matrix3_translate(Eina_Matrix3 *m, double tx, double ty) 420eina_matrix3_translate(Eina_Matrix3 *m, double tx, double ty)
421{ 421{
422 MATRIX_XX(m) = 1; 422 Eina_Matrix3 tmp;
423 MATRIX_XY(m) = 0; 423 MATRIX_XX(&tmp) = 1;
424 MATRIX_XZ(m) = tx; 424 MATRIX_XY(&tmp) = 0;
425 MATRIX_YX(m) = 0; 425 MATRIX_XZ(&tmp) = tx;
426 MATRIX_YY(m) = 1; 426 MATRIX_YX(&tmp) = 0;
427 MATRIX_YZ(m) = ty; 427 MATRIX_YY(&tmp) = 1;
428 MATRIX_ZX(m) = 0; 428 MATRIX_YZ(&tmp) = ty;
429 MATRIX_ZY(m) = 0; 429 MATRIX_ZX(&tmp) = 0;
430 MATRIX_ZZ(m) = 1; 430 MATRIX_ZY(&tmp) = 0;
431 MATRIX_ZZ(&tmp) = 1;
432 eina_matrix3_compose(m, &tmp, m);
431} 433}
432 434
433EAPI void 435EAPI void
434eina_matrix3_scale(Eina_Matrix3 *m, double sx, double sy) 436eina_matrix3_scale(Eina_Matrix3 *m, double sx, double sy)
435{ 437{
436 MATRIX_XX(m) = sx; 438 Eina_Matrix3 tmp;
437 MATRIX_XY(m) = 0; 439 MATRIX_XX(&tmp) = sx;
438 MATRIX_XZ(m) = 0; 440 MATRIX_XY(&tmp) = 0;
439 MATRIX_YX(m) = 0; 441 MATRIX_XZ(&tmp) = 0;
440 MATRIX_YY(m) = sy; 442 MATRIX_YX(&tmp) = 0;
441 MATRIX_YZ(m) = 0; 443 MATRIX_YY(&tmp) = sy;
442 MATRIX_ZX(m) = 0; 444 MATRIX_YZ(&tmp) = 0;
443 MATRIX_ZY(m) = 0; 445 MATRIX_ZX(&tmp) = 0;
444 MATRIX_ZZ(m) = 1; 446 MATRIX_ZY(&tmp) = 0;
447 MATRIX_ZZ(&tmp) = 1;
448 eina_matrix3_compose(m, &tmp, m);
445} 449}
446 450
447EAPI void 451EAPI void
@@ -458,15 +462,17 @@ eina_matrix3_rotate(Eina_Matrix3 *m, double rad)
458 s = _sin(rad); 462 s = _sin(rad);
459#endif 463#endif
460 464
461 MATRIX_XX(m) = c; 465 Eina_Matrix3 tmp;
462 MATRIX_XY(m) = -s; 466 MATRIX_XX(&tmp) = c;
463 MATRIX_XZ(m) = 0; 467 MATRIX_XY(&tmp) = -s;
464 MATRIX_YX(m) = s; 468 MATRIX_XZ(&tmp) = 0;
465 MATRIX_YY(m) = c; 469 MATRIX_YX(&tmp) = s;
466 MATRIX_YZ(m) = 0; 470 MATRIX_YY(&tmp) = c;
467 MATRIX_ZX(m) = 0; 471 MATRIX_YZ(&tmp) = 0;
468 MATRIX_ZY(m) = 0; 472 MATRIX_ZX(&tmp) = 0;
469 MATRIX_ZZ(m) = 1; 473 MATRIX_ZY(&tmp) = 0;
474 MATRIX_ZZ(&tmp) = 1;
475 eina_matrix3_compose(m, &tmp, m);
470} 476}
471 477
472EAPI void 478EAPI void