This commit is contained in:
Bor Grošelj Simić 2018-07-03 23:19:47 +00:00 committed by GitHub
commit 02213e6ef6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,8 @@ const float TYPE_INDICATOR_BORDER_THICKNESS = M_PI / 128.0f;
void render_frame(struct swaylock_surface *surface) { void render_frame(struct swaylock_surface *surface) {
struct swaylock_state *state = surface->state; struct swaylock_state *state = surface->state;
static bool first_render = true;
int buffer_width = surface->width * surface->scale; int buffer_width = surface->width * surface->scale;
int buffer_height = surface->height * surface->scale; int buffer_height = surface->height * surface->scale;
if (buffer_width == 0 || buffer_height == 0) { if (buffer_width == 0 || buffer_height == 0) {
@ -30,12 +32,15 @@ void render_frame(struct swaylock_surface *surface) {
cairo_t *cairo = surface->current_buffer->cairo; cairo_t *cairo = surface->current_buffer->cairo;
cairo_identity_matrix(cairo); cairo_identity_matrix(cairo);
if (state->args.mode == BACKGROUND_MODE_SOLID_COLOR || !surface->image) { if (first_render) {
cairo_set_source_u32(cairo, state->args.color); if (state->args.mode == BACKGROUND_MODE_SOLID_COLOR || !surface->image) {
cairo_paint(cairo); cairo_set_source_u32(cairo, state->args.color);
} else { cairo_paint(cairo);
render_background_image(cairo, surface->image, } else {
state->args.mode, buffer_width, buffer_height); render_background_image(cairo, surface->image,
state->args.mode, buffer_width, buffer_height);
}
first_render = false;
} }
cairo_identity_matrix(cairo); cairo_identity_matrix(cairo);