Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out-of-bounds mini-map ellipse #6972

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Source/automap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,8 @@ void DrawMapEllipse(const Surface &out, Point from, int radius, uint8_t colorInd
from.x -= radius;

// Initial point
out.SetPixel({ from.x, from.y + b }, colorIndex);
out.SetPixel({ from.x, from.y - b }, colorIndex);
SetMapPixel(out, { from.x, from.y + b }, colorIndex);
SetMapPixel(out, { from.x, from.y - b }, colorIndex);

// Initialize the parameters
int p1 = (b * b) - (a * a * b) + (a * a) / 4;
Expand All @@ -856,10 +856,10 @@ void DrawMapEllipse(const Surface &out, Point from, int radius, uint8_t colorInd
p1 += (2 * b * b * x) - (2 * a * a * y) + (b * b);
}

out.SetPixel({ from.x + x, from.y + y }, colorIndex);
out.SetPixel({ from.x - x, from.y + y }, colorIndex);
out.SetPixel({ from.x + x, from.y - y }, colorIndex);
out.SetPixel({ from.x - x, from.y - y }, colorIndex);
SetMapPixel(out, { from.x + x, from.y + y }, colorIndex);
SetMapPixel(out, { from.x - x, from.y + y }, colorIndex);
SetMapPixel(out, { from.x + x, from.y - y }, colorIndex);
SetMapPixel(out, { from.x - x, from.y - y }, colorIndex);
}

// Initialize the second parameter for Region 2
Expand All @@ -875,10 +875,10 @@ void DrawMapEllipse(const Surface &out, Point from, int radius, uint8_t colorInd
p2 += (2 * b * b * x) - (2 * a * a * y) + (a * a);
}

out.SetPixel({ from.x + x, from.y + y }, colorIndex);
out.SetPixel({ from.x - x, from.y + y }, colorIndex);
out.SetPixel({ from.x + x, from.y - y }, colorIndex);
out.SetPixel({ from.x - x, from.y - y }, colorIndex);
SetMapPixel(out, { from.x + x, from.y + y }, colorIndex);
SetMapPixel(out, { from.x - x, from.y + y }, colorIndex);
SetMapPixel(out, { from.x + x, from.y - y }, colorIndex);
SetMapPixel(out, { from.x - x, from.y - y }, colorIndex);
}
}

Expand Down
Loading