compositor: Don't set DPMS state on start up
[profile/ivi/weston.git] / src / matrix.h
1 /*
2  * Copyright © 2008-2011 Kristian Høgsberg
3  * Copyright © 2012 Collabora, Ltd.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and
6  * its documentation for any purpose is hereby granted without fee, provided
7  * that the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of the copyright holders not be used in
10  * advertising or publicity pertaining to distribution of the software
11  * without specific, written prior permission.  The copyright holders make
12  * no representations about the suitability of this software for any
13  * purpose.  It is provided "as is" without express or implied warranty.
14  *
15  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
16  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
20  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  */
23
24 #ifndef WESTON_MATRIX_H
25 #define WESTON_MATRIX_H
26
27 struct weston_matrix {
28         float d[16];
29 };
30
31 struct weston_vector {
32         float f[4];
33 };
34
35 void
36 weston_matrix_init(struct weston_matrix *matrix);
37 void
38 weston_matrix_multiply(struct weston_matrix *m, const struct weston_matrix *n);
39 void
40 weston_matrix_scale(struct weston_matrix *matrix, float x, float y, float z);
41 void
42 weston_matrix_translate(struct weston_matrix *matrix,
43                         float x, float y, float z);
44 void
45 weston_matrix_transform(struct weston_matrix *matrix, struct weston_vector *v);
46
47 int
48 weston_matrix_invert(struct weston_matrix *inverse,
49                      const struct weston_matrix *matrix);
50
51 #ifdef UNIT_TEST
52 #  define MATRIX_TEST_EXPORT WL_EXPORT
53
54 int
55 matrix_invert(double *A, unsigned *p, const struct weston_matrix *matrix);
56
57 void
58 inverse_transform(const double *LU, const unsigned *p, float *v);
59
60 #else
61 #  define MATRIX_TEST_EXPORT static
62 #endif
63
64 #endif /* WESTON_MATRIX_H */