1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
#ifndef SCENE_FX_RENDER_PASS_H
#define SCENE_FX_RENDER_PASS_H
#include <stdbool.h>
#include <wlr/render/pass.h>
#include <wlr/render/interface.h>
struct fx_gles_render_pass {
struct wlr_render_pass base;
struct fx_framebuffer *buffer;
struct fx_effect_framebuffers *fx_effect_framebuffers;
struct wlr_output *output;
float projection_matrix[9];
struct fx_render_timer *timer;
};
enum corner_location { TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT, ALL };
/**
* Begin a new render pass with the supplied destination buffer.
*
* Callers must call wlr_render_pass_submit() once they are done with the
* render pass.
*/
struct fx_gles_render_pass *fx_renderer_begin_buffer_pass(struct wlr_renderer *wlr_renderer,
struct wlr_buffer *wlr_buffer, struct wlr_output *output,
const struct wlr_buffer_pass_options *options);
struct fx_gradient {
float degree;
/* The full area the gradient fit too, for borders use the window size */
struct wlr_box range;
/* The center of the gradient, {0.5, 0.5} for normal*/
float origin[2];
/* 1 = Linear, 2 = Conic */
int linear;
/* Whether or not to blend the colors */
int blend;
int count;
float *colors;
};
struct fx_render_texture_options {
struct wlr_render_texture_options base;
const struct wlr_box *clip_box; // Used to clip csd. Ignored if NULL
int corner_radius;
bool has_titlebar;
bool discard_transparent;
float dim;
struct wlr_render_color dim_color;
};
struct fx_render_rect_options {
struct wlr_render_rect_options base;
// TODO: Add effects here in the future
};
struct fx_render_rect_grad_options {
struct wlr_render_rect_options base;
struct fx_gradient gradient;
};
struct fx_render_box_shadow_options {
struct wlr_box box;
struct wlr_box window_box;
int window_corner_radius;
/* Clip region, leave NULL to disable clipping */
const pixman_region32_t *clip;
float blur_sigma;
int corner_radius;
struct wlr_render_color color;
};
struct fx_render_rounded_rect_options {
struct wlr_render_rect_options base;
int corner_radius;
enum corner_location corner_location;
};
struct fx_render_rounded_rect_grad_options {
struct wlr_render_rect_options base;
struct fx_gradient gradient;
int corner_radius;
enum corner_location corner_location;
};
struct fx_render_rounded_border_corner_options {
struct wlr_render_rect_options base;
int corner_radius;
int border_thickness;
enum corner_location corner_location;
};
struct fx_render_rounded_grad_border_corner_options {
struct wlr_render_rect_options base;
struct fx_gradient gradient;
int corner_radius;
int border_thickness;
enum corner_location corner_location;
};
struct fx_render_blur_pass_options {
struct fx_render_texture_options tex_options;
pixman_region32_t *opaque_region;
struct fx_framebuffer *current_buffer;
struct blur_data *blur_data;
bool use_optimized_blur;
bool ignore_transparent;
};
/**
* Render a fx texture.
*/
void fx_render_pass_add_texture(struct fx_gles_render_pass *render_pass,
const struct fx_render_texture_options *options);
/**
* Render a rectangle.
*/
void fx_render_pass_add_rect(struct fx_gles_render_pass *render_pass,
const struct fx_render_rect_options *options);
/**
* Render a rectangle with a gradient.
*/
void fx_render_pass_add_rect_grad(struct fx_gles_render_pass *render_pass,
const struct fx_render_rect_grad_options *options);
/**
* Render a rounded rectangle.
*/
void fx_render_pass_add_rounded_rect(struct fx_gles_render_pass *render_pass,
const struct fx_render_rounded_rect_options *options);
/**
* Render a border corner.
*/
void fx_render_pass_add_rounded_rect_grad(struct fx_gles_render_pass *render_pass,
const struct fx_render_rounded_rect_grad_options *options);
/**
* Render a border corner.
*/
void fx_render_pass_add_rounded_border_corner(struct fx_gles_render_pass *render_pass,
const struct fx_render_rounded_border_corner_options *options);
/**
* Render a border corner.
*/
void fx_render_pass_add_rounded_grad_border_corner(struct fx_gles_render_pass *render_pass,
const struct fx_render_rounded_grad_border_corner_options *options);
/**
* Render a box shadow.
*/
void fx_render_pass_add_box_shadow(struct fx_gles_render_pass *pass,
const struct fx_render_box_shadow_options *options);
/**
* Render blur.
*/
void fx_render_pass_add_blur(struct fx_gles_render_pass *pass,
struct fx_render_blur_pass_options *fx_options);
/**
* Render optimized blur.
*/
void fx_render_pass_add_optimized_blur(struct fx_gles_render_pass *pass,
struct fx_render_blur_pass_options *fx_options);
/**
* Render from one buffer to another
*/
void fx_renderer_read_to_buffer(struct fx_gles_render_pass *pass,
pixman_region32_t *region, struct fx_framebuffer *dst_buffer,
struct fx_framebuffer *src_buffer, bool transformed_region);
#endif
|