diff options
author | William McKinnon <[email protected]> | 2022-08-13 02:14:23 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-08-13 02:14:23 -0400 |
commit | cf1ed777ae56f677bcc0f832c52c04dc65be18ce (patch) | |
tree | 523dc4848d5cda83366bf8ccd6fc8cb453566a11 /sway/desktop/render.c | |
parent | 06f19c81a4d20651a9e4bb503fed77b278e1d027 (diff) |
Add official fx renderer (#3)
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r-- | sway/desktop/render.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 02397c05..5559b0d8 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -17,6 +17,7 @@ #include "log.h" #include "config.h" #include "sway/config.h" +#include "sway/desktop/fx_renderer.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" #include "sway/layers.h" @@ -52,7 +53,8 @@ static int scale_length(int length, int offset, float scale) { static void scissor_output(struct wlr_output *wlr_output, pixman_box32_t *rect) { - struct wlr_renderer *renderer = wlr_output->renderer; + struct sway_output *output = wlr_output->data; + struct fx_renderer *renderer = output->server->renderer; assert(renderer); struct wlr_box box = { @@ -69,7 +71,7 @@ static void scissor_output(struct wlr_output *wlr_output, wlr_output_transform_invert(wlr_output->transform); wlr_box_transform(&box, &box, transform, ow, oh); - wlr_renderer_scissor(renderer, &box); + fx_renderer_scissor(&box); } static void set_scale_filter(struct wlr_output *wlr_output, @@ -100,8 +102,8 @@ static void render_texture(struct wlr_output *wlr_output, pixman_region32_t *output_damage, struct wlr_texture *texture, const struct wlr_fbox *src_box, const struct wlr_box *dst_box, const float matrix[static 9], float alpha) { - struct wlr_renderer *renderer = wlr_output->renderer; struct sway_output *output = wlr_output->data; + struct fx_renderer *renderer = output->server->renderer; pixman_region32_t damage; pixman_region32_init(&damage); @@ -119,9 +121,9 @@ static void render_texture(struct wlr_output *wlr_output, scissor_output(wlr_output, &rects[i]); set_scale_filter(wlr_output, texture, output->scale_filter); if (src_box != NULL) { - wlr_render_subtexture_with_matrix(renderer, texture, src_box, matrix, alpha); + fx_render_subtexture_with_matrix(renderer, texture, src_box, matrix, alpha); } else { - wlr_render_texture_with_matrix(renderer, texture, matrix, alpha); + fx_render_texture_with_matrix(renderer, texture, matrix, alpha); } } @@ -162,8 +164,7 @@ static void render_surface_iterator(struct sway_output *output, } scale_box(&dst_box, wlr_output->scale); - render_texture(wlr_output, output_damage, texture, - &src_box, &dst_box, matrix, alpha); + render_texture(wlr_output, output_damage, texture, &src_box, &dst_box, matrix, alpha); wlr_presentation_surface_sampled_on_output(server.presentation, surface, wlr_output); @@ -1027,7 +1028,8 @@ static void render_seatops(struct sway_output *output, void output_render(struct sway_output *output, struct timespec *when, pixman_region32_t *damage) { struct wlr_output *wlr_output = output->wlr_output; - struct wlr_renderer *renderer = output->server->renderer; + struct wlr_renderer *wlr_renderer = output->server->wlr_renderer; + struct fx_renderer *renderer = output->server->renderer; struct sway_workspace *workspace = output->current.active_workspace; if (workspace == NULL) { @@ -1039,7 +1041,7 @@ void output_render(struct sway_output *output, struct timespec *when, fullscreen_con = workspace->current.fullscreen; } - wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); + fx_renderer_begin(renderer, wlr_output->width, wlr_output->height); if (debug.damage == DAMAGE_RERENDER) { int width, height; @@ -1053,7 +1055,7 @@ void output_render(struct sway_output *output, struct timespec *when, } if (debug.damage == DAMAGE_HIGHLIGHT) { - wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); + fx_renderer_clear((float[]){1, 1, 0, 1}); } if (output_has_opaque_overlay_layer_surface(output)) { @@ -1067,7 +1069,7 @@ void output_render(struct sway_output *output, struct timespec *when, pixman_box32_t *rects = pixman_region32_rectangles(damage, &nrects); for (int i = 0; i < nrects; ++i) { scissor_output(wlr_output, &rects[i]); - wlr_renderer_clear(renderer, clear_color); + fx_renderer_clear(clear_color); } if (fullscreen_con->view) { @@ -1099,7 +1101,7 @@ void output_render(struct sway_output *output, struct timespec *when, pixman_box32_t *rects = pixman_region32_rectangles(damage, &nrects); for (int i = 0; i < nrects; ++i) { scissor_output(wlr_output, &rects[i]); - wlr_renderer_clear(renderer, clear_color); + fx_renderer_clear(clear_color); } render_layer_toplevel(output, damage, @@ -1139,9 +1141,11 @@ render_overlay: render_drag_icons(output, damage, &root->drag_icons); renderer_end: - wlr_renderer_scissor(renderer, NULL); + fx_renderer_scissor(NULL); + wlr_renderer_begin(wlr_renderer, wlr_output->width, wlr_output->height); wlr_output_render_software_cursors(wlr_output, damage); - wlr_renderer_end(renderer); + wlr_renderer_end(wlr_renderer); + fx_renderer_end(); int width, height; wlr_output_transformed_resolution(wlr_output, &width, &height); |