From 83a56afcb11859ca2a53c47294d90e2de0792729 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Mon, 14 Oct 2024 20:52:42 -0400 Subject: [PATCH] font/sprite: fix weird code --- src/font/sprite/Box.zig | 58 +++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/src/font/sprite/Box.zig b/src/font/sprite/Box.zig index 6a8a49662..72568ffab 100644 --- a/src/font/sprite/Box.zig +++ b/src/font/sprite/Box.zig @@ -2151,75 +2151,59 @@ fn draw_light_arc( switch (corner) { .tl => { - path.moveTo(center_x, 0) catch return; - if (self.height > self.width) { - path.lineTo(center_x, center_y - r) catch return; - } - path.curveTo( + try path.moveTo(center_x, 0); + try path.lineTo(center_x, center_y - r); + try path.curveTo( center_x, center_y - s * r, center_x - s * r, center_y, center_x - r, center_y, - ) catch return; - if (self.width > self.height) { - path.lineTo(0, center_y) catch return; - } + ); + try path.lineTo(0, center_y); }, .tr => { - path.moveTo(center_x, 0) catch return; - if (self.height > self.width) { - path.lineTo(center_x, center_y - r) catch return; - } - path.curveTo( + try path.moveTo(center_x, 0); + try path.lineTo(center_x, center_y - r); + try path.curveTo( center_x, center_y - s * r, center_x + s * r, center_y, center_x + r, center_y, - ) catch return; - if (self.width > self.height) { - path.lineTo(float_width, center_y) catch return; - } + ); + try path.lineTo(float_width, center_y); }, .bl => { - path.moveTo(center_x, float_height) catch return; - if (self.height > self.width) { - path.lineTo(center_x, center_y + r) catch return; - } - path.curveTo( + try path.moveTo(center_x, float_height); + try path.lineTo(center_x, center_y + r); + try path.curveTo( center_x, center_y + s * r, center_x - s * r, center_y, center_x - r, center_y, - ) catch return; - if (self.width > self.height) { - path.lineTo(0, center_y) catch return; - } + ); + try path.lineTo(0, center_y); }, .br => { - path.moveTo(center_x, float_height) catch return; - if (self.height > self.width) { - path.lineTo(center_x, center_y + r) catch return; - } - path.curveTo( + try path.moveTo(center_x, float_height); + try path.lineTo(center_x, center_y + r); + try path.curveTo( center_x, center_y + s * r, center_x + s * r, center_y, center_x + r, center_y, - ) catch return; - if (self.width > self.height) { - path.lineTo(float_width, center_y) catch return; - } + ); + try path.lineTo(float_width, center_y); }, } - ctx.stroke(canvas.alloc, path) catch return; + try ctx.stroke(canvas.alloc, path); } fn draw_dash_horizontal(