Skip to content

Commit

Permalink
Fix indicator diameter calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrsylvestre committed May 31, 2021
1 parent baa1ae9 commit 3d94bf4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions render.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ void render_frame_background(struct swaylock_surface *surface) {
void render_frame(struct swaylock_surface *surface) {
struct swaylock_state *state = surface->state;

double border_width = 2.0 * surface->scale;

int arc_radius = state->args.radius * surface->scale;
int arc_thickness = state->args.thickness * surface->scale;
int buffer_diameter = (arc_radius + arc_thickness) * 2;
int buffer_diameter = (arc_radius + border_width) * 2 + arc_thickness;

int buffer_width = surface->indicator_width;
int buffer_height = surface->indicator_height;
Expand Down Expand Up @@ -261,7 +263,7 @@ void render_frame(struct swaylock_surface *surface) {

// Draw inner + outer border of the circle
set_color_for_state(cairo, state, &state->args.colors.line);
cairo_set_line_width(cairo, 2.0 * surface->scale);
cairo_set_line_width(cairo, border_width);
cairo_arc(cairo, buffer_width / 2, buffer_diameter / 2,
arc_radius - arc_thickness / 2, 0, 2 * M_PI);
cairo_stroke(cairo);
Expand Down

0 comments on commit 3d94bf4

Please sign in to comment.