summaryrefslogtreecommitdiffstats
path: root/swaylock/render.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-04-03 14:31:30 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-04-04 18:47:48 -0400
commit066143adef7adc6e76e43e1990db2f75fe984b42 (patch)
treef9509c14f04399bf02d2cc31ff62869a07691543 /swaylock/render.c
parentLink swaylock to xkbcommon (diff)
downloadsway-066143adef7adc6e76e43e1990db2f75fe984b42.tar.gz
sway-066143adef7adc6e76e43e1990db2f75fe984b42.tar.zst
sway-066143adef7adc6e76e43e1990db2f75fe984b42.zip
Add password buffer, refactor rendering/surfaces
Diffstat (limited to 'swaylock/render.c')
-rw-r--r--swaylock/render.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/swaylock/render.c b/swaylock/render.c
new file mode 100644
index 00000000..8fc47281
--- /dev/null
+++ b/swaylock/render.c
@@ -0,0 +1,21 @@
1#include <wayland-client.h>
2#include "cairo.h"
3#include "background-image.h"
4#include "swaylock/swaylock.h"
5
6void render_frame(struct swaylock_surface *surface) {
7 struct swaylock_state *state = surface->state;
8 surface->current_buffer = get_next_buffer(state->shm,
9 surface->buffers, surface->width, surface->height);
10 cairo_t *cairo = surface->current_buffer->cairo;
11 if (state->args.mode == BACKGROUND_MODE_SOLID_COLOR) {
12 cairo_set_source_u32(cairo, state->args.color);
13 cairo_paint(cairo);
14 } else {
15 render_background_image(cairo, surface->image,
16 state->args.mode, surface->width, surface->height);
17 }
18 wl_surface_attach(surface->surface, surface->current_buffer->buffer, 0, 0);
19 wl_surface_damage(surface->surface, 0, 0, surface->width, surface->height);
20 wl_surface_commit(surface->surface);
21}