Fixed crash when exit

This commit is contained in:
2025-04-26 00:23:39 +02:00
parent ece5a16d34
commit 79d5419fcc
@@ -174,21 +174,20 @@ public class RenderScope {
} }
public void drawRoundedBorderCorner(int width, int height, int radius, int color) { public void drawRoundedBorderCorner(int width, int height, int radius, int color) {
int h = height;
int s = 3; int s = 3;
for (int y = 0; y < h; y+=s) { // Step through the arc by angle
int startX = 0; for (double angle = Math.PI; angle >= Math.PI / 2; angle -= Math.PI / 180) {
int x = (int) Math.round(radius * Math.cos(angle));
int y = (int) Math.round(radius * Math.sin(angle));
if (y < radius) { // Snap position to s-sized grid to avoid overlapping
double dy = radius - y - 0.5; int snappedX = (radius - x) / s * s;
double dx = Math.sqrt(Math.max(0, radius * radius - dy * dy)); int snappedY = (radius - y) / s * s;
startX = radius - (int) dx;
}
this.drawRect(startX, y, s, s, color); drawRect(snappedX, snappedY, s, s, color);
} }
} }
public void drawRoundedBorder(int x, int y, int width, int height, int borderSize, int radius, int color) { public void drawRoundedBorder(int x, int y, int width, int height, int borderSize, int radius, int color) {