Skip to content

Commit

Permalink
more caching
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon committed Nov 16, 2024
1 parent 4b7baa6 commit 86acb49
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,29 +656,19 @@ impl DelayGraph {
};

let mut path = vg::Path::new();
path.move_to(
line_width.mul_add(-0.75, bounds.x + x_offset),
bounds.y + bounds.h - velocity_height,
);
path.line_to(
line_width.mul_add(-0.75, bounds.x + x_offset),
bounds.y + bounds.h,
);
let x_val = line_width.mul_add(-0.75, bounds.x + x_offset);
path.move_to(x_val, bounds.y + bounds.h - velocity_height);
path.line_to(x_val, bounds.y + bounds.h);

canvas.stroke_path(
&path,
&vg::Paint::color(velocity_color).with_line_width(line_width * 1.5),
);

path = vg::Path::new();
path.move_to(
line_width.mul_add(0.75, bounds.x + x_offset),
bounds.y + bounds.h - meter_height,
);
path.line_to(
line_width.mul_add(0.75, bounds.x + x_offset),
bounds.y + bounds.h,
);
let x_val = line_width.mul_add(0.75, bounds.x + x_offset);
path.move_to(x_val, bounds.y + bounds.h - meter_height);
path.line_to(x_val, bounds.y + bounds.h);

canvas.stroke_path(
&path,
Expand All @@ -693,11 +683,9 @@ impl DelayGraph {
(tick_fraction * bounds.h).max(0.0)
};
let mut path = vg::Path::new();
path.move_to(
line_width.mul_add(0.75, bounds.x),
bounds.y + bounds.h - input_height,
);
path.line_to(line_width.mul_add(0.75, bounds.x), bounds.y + bounds.h);
let x_val = line_width.mul_add(0.75, bounds.x);
path.move_to(x_val, bounds.y + bounds.h - input_height);
path.line_to(x_val, bounds.y + bounds.h);
canvas.stroke_path(
&path,
&vg::Paint::color(meter_color).with_line_width(line_width * 1.5),
Expand All @@ -710,14 +698,9 @@ impl DelayGraph {
(tick_fraction * bounds.h).max(0.0)
};
path = vg::Path::new();
path.move_to(
line_width.mul_add(-0.75, bounds.x + bounds.w),
bounds.y + bounds.h - output_height,
);
path.line_to(
line_width.mul_add(-0.75, bounds.x + bounds.w),
bounds.y + bounds.h,
);
let x_val = line_width.mul_add(-0.75, bounds.x + bounds.w);
path.move_to(x_val, bounds.y + bounds.h - output_height);
path.line_to(x_val, bounds.y + bounds.h);
canvas.stroke_path(
&path,
&vg::Paint::color(meter_color).with_line_width(line_width * 1.5),
Expand Down

0 comments on commit 86acb49

Please sign in to comment.