mirror of
https://github.com/swaywm/sway.git
synced 2025-04-07 04:47:46 +03:00
Add password buffer, refactor rendering/surfaces
This commit is contained in:
parent
1fe3cb8965
commit
066143adef
9 changed files with 262 additions and 51 deletions
21
swaylock/render.c
Normal file
21
swaylock/render.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <wayland-client.h>
|
||||
#include "cairo.h"
|
||||
#include "background-image.h"
|
||||
#include "swaylock/swaylock.h"
|
||||
|
||||
void render_frame(struct swaylock_surface *surface) {
|
||||
struct swaylock_state *state = surface->state;
|
||||
surface->current_buffer = get_next_buffer(state->shm,
|
||||
surface->buffers, surface->width, surface->height);
|
||||
cairo_t *cairo = surface->current_buffer->cairo;
|
||||
if (state->args.mode == BACKGROUND_MODE_SOLID_COLOR) {
|
||||
cairo_set_source_u32(cairo, state->args.color);
|
||||
cairo_paint(cairo);
|
||||
} else {
|
||||
render_background_image(cairo, surface->image,
|
||||
state->args.mode, surface->width, surface->height);
|
||||
}
|
||||
wl_surface_attach(surface->surface, surface->current_buffer->buffer, 0, 0);
|
||||
wl_surface_damage(surface->surface, 0, 0, surface->width, surface->height);
|
||||
wl_surface_commit(surface->surface);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue