1 | /*
|
---|
2 | * Copyright © 2014 Keith Packard
|
---|
3 | *
|
---|
4 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
5 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
6 | * the above copyright notice appear in all copies and that both that copyright
|
---|
7 | * notice and this permission notice appear in supporting documentation, and
|
---|
8 | * that the name of the copyright holders not be used in advertising or
|
---|
9 | * publicity pertaining to distribution of the software without specific,
|
---|
10 | * written prior permission. The copyright holders make no representations
|
---|
11 | * about the suitability of this software for any purpose. It is provided "as
|
---|
12 | * is" without express or implied warranty.
|
---|
13 | *
|
---|
14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
---|
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
---|
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
---|
20 | * OF THIS SOFTWARE.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef _GLAMOR_TRANSFORM_H_
|
---|
24 | #define _GLAMOR_TRANSFORM_H_
|
---|
25 |
|
---|
26 | void
|
---|
27 | glamor_set_destination_drawable(DrawablePtr drawable,
|
---|
28 | int box_x,
|
---|
29 | int box_y,
|
---|
30 | Bool do_drawable_translate,
|
---|
31 | Bool center_offset,
|
---|
32 | GLint matrix_uniform_location,
|
---|
33 | int *p_off_x,
|
---|
34 | int *p_off_y);
|
---|
35 |
|
---|
36 | void
|
---|
37 | glamor_set_color(PixmapPtr pixmap,
|
---|
38 | CARD32 pixel,
|
---|
39 | GLint uniform);
|
---|
40 |
|
---|
41 | Bool
|
---|
42 | glamor_set_texture_pixmap(PixmapPtr texture);
|
---|
43 |
|
---|
44 | Bool
|
---|
45 | glamor_set_texture(PixmapPtr texture,
|
---|
46 | int off_x,
|
---|
47 | int off_y,
|
---|
48 | GLint offset_uniform,
|
---|
49 | GLint size_uniform);
|
---|
50 |
|
---|
51 | Bool
|
---|
52 | glamor_set_solid(PixmapPtr pixmap,
|
---|
53 | GCPtr gc,
|
---|
54 | Bool use_alu,
|
---|
55 | GLint uniform);
|
---|
56 |
|
---|
57 | Bool
|
---|
58 | glamor_set_tiled(PixmapPtr pixmap,
|
---|
59 | GCPtr gc,
|
---|
60 | GLint offset_uniform,
|
---|
61 | GLint size_uniform);
|
---|
62 |
|
---|
63 | Bool
|
---|
64 | glamor_set_stippled(PixmapPtr pixmap,
|
---|
65 | GCPtr gc,
|
---|
66 | GLint fg_uniform,
|
---|
67 | GLint offset_uniform,
|
---|
68 | GLint size_uniform);
|
---|
69 |
|
---|
70 | /*
|
---|
71 | * Vertex shader bits that transform X coordinates to pixmap
|
---|
72 | * coordinates using the matrix computed above
|
---|
73 | */
|
---|
74 |
|
---|
75 | #define GLAMOR_DECLARE_MATRIX "uniform vec4 v_matrix;\n"
|
---|
76 | #define GLAMOR_X_POS(x) #x " *v_matrix.x + v_matrix.y"
|
---|
77 | #define GLAMOR_Y_POS(y) #y " *v_matrix.z + v_matrix.w"
|
---|
78 | #if 0
|
---|
79 | #define GLAMOR_POS(dst,src) \
|
---|
80 | " " #dst ".x = " #src ".x * v_matrix.x + v_matrix.y;\n" \
|
---|
81 | " " #dst ".y = " #src ".y * v_matrix.z + v_matrix.w;\n" \
|
---|
82 | " " #dst ".z = 0.0;\n" \
|
---|
83 | " " #dst ".w = 1.0;\n"
|
---|
84 | #endif
|
---|
85 | #define GLAMOR_POS(dst,src) \
|
---|
86 | " " #dst ".xy = " #src ".xy * v_matrix.xz + v_matrix.yw;\n" \
|
---|
87 | " " #dst ".zw = vec2(0.0,1.0);\n"
|
---|
88 |
|
---|
89 | #endif /* _GLAMOR_TRANSFORM_H_ */
|
---|