summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libflash/matrix.cc
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/libflash/matrix.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libflash/matrix.cc68
1 files changed, 68 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libflash/matrix.cc b/core/multimedia/opieplayer/libflash/matrix.cc
new file mode 100644
index 0000000..0d8c82c
--- a/dev/null
+++ b/core/multimedia/opieplayer/libflash/matrix.cc
@@ -0,0 +1,68 @@
1/////////////////////////////////////////////////////////////
2// Flash Plugin and Player
3// Copyright (C) 1998,1999 Olivier Debon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19///////////////////////////////////////////////////////////////
20// Author : Olivier Debon <odebon@club-internet.fr>
21//
22
23#include "matrix.h"
24
25#ifdef RCSID
26static char *rcsid = "$Id$";
27#endif
28
29Matrix::Matrix()
30{
31 a = 1.0;
32 d = 1.0;
33 b = c = 0.0;
34 tx = ty = 0;
35}
36
37Matrix Matrix::operator*(Matrix m)
38{
39 Matrix mat;
40
41 mat.a = this->a * m.a + this->b * m.c;
42 mat.b = this->a * m.b + this->b * m.d;
43 mat.c = this->c * m.a + this->d * m.c;
44 mat.d = this->c * m.b + this->d * m.d;
45
46 mat.tx = this->getX(m.tx,m.ty);
47 mat.ty = this->getY(m.tx,m.ty);
48
49 return mat;
50}
51
52Matrix Matrix::invert()
53{
54 Matrix mat;
55 float det;
56
57 det = a*d-b*c;
58
59 mat.a = d/det;
60 mat.b = -b/det;
61 mat.c = -c/det;
62 mat.d = a/det;
63
64 mat.tx = - (long)(mat.a * tx + mat.b * ty);
65 mat.ty = - (long)(mat.c * tx + mat.d * ty);
66
67 return mat;
68}