1/*
2 * Copyright (C) 2011 Collabora Ltd.
3 *
4 *  This library is free software; you can redistribute it and/or
5 *  modify it under the terms of the GNU Lesser General Public License
6 *  as published by the Free Software Foundation; either version 2.1 of
7 *  the License, or (at your option) any later version.
8 *
9 *  This library is distributed in the hope that it will be useful,
10 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 *  Lesser General Public License for more details.
13 *
14 *  You should have received a copy of the GNU Lesser General Public
15 *  License along with this library; if not, write to the Free
16 *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 *  Boston, MA 02110-1301 USA
18 */
19
20#include "config.h"
21#include "TransformationMatrix.h"
22
23#include <cogl/cogl.h>
24
25namespace WebCore {
26
27TransformationMatrix::operator CoglMatrix() const
28{
29    CoglMatrix matrix;
30
31    matrix.xx = m11();
32    matrix.xy = m21();
33    matrix.xz = m31();
34    matrix.xw = m41();
35
36    matrix.yx = m12();
37    matrix.yy = m22();
38    matrix.yz = m32();
39    matrix.yw = m42();
40
41    matrix.zx = m13();
42    matrix.zy = m23();
43    matrix.zz = m33();
44    matrix.zw = m43();
45
46    matrix.wx = m14();
47    matrix.wy = m24();
48    matrix.wz = m34();
49    matrix.ww = m44();
50
51    return matrix;
52}
53
54TransformationMatrix::TransformationMatrix(const CoglMatrix* matrix)
55{
56    setMatrix(matrix->xx, matrix->yx, matrix->zx, matrix->wx,
57        matrix->xy, matrix->yy, matrix->zy, matrix->wy,
58        matrix->xz, matrix->yz, matrix->zz, matrix->wz,
59        matrix->xw, matrix->yw, matrix->zw, matrix->ww);
60}
61
62}
63