Browse Source

Fix out-of-bounds mini-map ellipse

pull/6976/head
staphen 2 years ago committed by Stephen C. Wills
parent
commit
a99eda1c0b
  1. 20
      Source/automap.cpp

20
Source/automap.cpp

@ -840,8 +840,8 @@ void DrawMapEllipse(const Surface &out, Point from, int radius, uint8_t colorInd
from.x -= radius; from.x -= radius;
// Initial point // Initial point
out.SetPixel({ from.x, from.y + b }, colorIndex); SetMapPixel(out, { from.x, from.y + b }, colorIndex);
out.SetPixel({ from.x, from.y - b }, colorIndex); SetMapPixel(out, { from.x, from.y - b }, colorIndex);
// Initialize the parameters // Initialize the parameters
int p1 = (b * b) - (a * a * b) + (a * a) / 4; int p1 = (b * b) - (a * a * b) + (a * a) / 4;
@ -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); p1 += (2 * b * b * x) - (2 * a * a * y) + (b * b);
} }
out.SetPixel({ from.x + x, from.y + y }, colorIndex); SetMapPixel(out, { 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);
out.SetPixel({ from.x + x, from.y - y }, colorIndex); SetMapPixel(out, { 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);
} }
// Initialize the second parameter for Region 2 // Initialize the second parameter for Region 2
@ -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); p2 += (2 * b * b * x) - (2 * a * a * y) + (a * a);
} }
out.SetPixel({ from.x + x, from.y + y }, colorIndex); SetMapPixel(out, { 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);
out.SetPixel({ from.x + x, from.y - y }, colorIndex); SetMapPixel(out, { 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);
} }
} }

Loading…
Cancel
Save