Update draw_bar to match old behaviour

This commit is contained in:
Rio6 2021-01-24 15:17:29 -05:00
parent 663b34e4e0
commit 5300d9cac2
1 changed files with 8 additions and 2 deletions

View File

@ -319,8 +319,7 @@ static void draw_single_bar(cairo_t *ctx, double pos, double offset, double widt
if (bar_reversed) { if (bar_reversed) {
offset -= height; offset -= height;
} else if (bar_bidirectional) { } else if (bar_bidirectional) {
offset -= height; offset -= height / 2;
height *= 2;
} }
if (bar_orientation == BAR_VERT) if (bar_orientation == BAR_VERT)
@ -332,6 +331,8 @@ static void draw_single_bar(cairo_t *ctx, double pos, double offset, double widt
static void draw_bar(cairo_t *ctx, double bar_offset, double screen_x, double screen_y, double screen_w, double screen_h) { static void draw_bar(cairo_t *ctx, double bar_offset, double screen_x, double screen_y, double screen_w, double screen_h) {
cairo_save(ctx);
switch (auth_state) { switch (auth_state) {
case STATE_AUTH_VERIFY: case STATE_AUTH_VERIFY:
case STATE_AUTH_LOCK: case STATE_AUTH_LOCK:
@ -356,6 +357,8 @@ static void draw_bar(cairo_t *ctx, double bar_offset, double screen_x, double sc
else else
cairo_set_source_rgba(ctx, keyhl16.red, keyhl16.green, keyhl16.blue, keyhl16.alpha); cairo_set_source_rgba(ctx, keyhl16.red, keyhl16.green, keyhl16.blue, keyhl16.alpha);
cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
double bar_width, screen_pos; double bar_width, screen_pos;
if (bar_orientation == BAR_VERT) { if (bar_orientation == BAR_VERT) {
bar_width = screen_h / bar_count; bar_width = screen_h / bar_count;
@ -367,6 +370,7 @@ static void draw_bar(cairo_t *ctx, double bar_offset, double screen_x, double sc
for (int i = 0; i < bar_count; ++i) { for (int i = 0; i < bar_count; ++i) {
double bar_height = bar_heights[i]; double bar_height = bar_heights[i];
if (bar_bidirectional) bar_height *= 2;
if (bar_height > 0) { if (bar_height > 0) {
draw_single_bar(ctx, screen_pos + i * bar_width, bar_offset, bar_width, bar_height); draw_single_bar(ctx, screen_pos + i * bar_width, bar_offset, bar_width, bar_height);
} }
@ -377,6 +381,8 @@ static void draw_bar(cairo_t *ctx, double bar_offset, double screen_x, double sc
bar_heights[i] -= bar_periodic_step; bar_heights[i] -= bar_periodic_step;
} }
} }
cairo_restore(ctx);
} }
static void draw_indic(cairo_t *ctx, double ind_x, double ind_y) { static void draw_indic(cairo_t *ctx, double ind_x, double ind_y) {