mirror of
https://github.com/raysan5/raylib.git
synced 2026-09-02 12:23:35 +00:00
[rtextures] Fix ImageDrawCircle asymmetry (#6118)
ImageDrawCircle filled 2*radius pixels wide but 2*radius + 1 tall. Each horizontal span started at centerX - x with width 2*x, which covers centerX - x through centerX + x - 1, leaving the column at centerX + x unwritten. The result was one column short on the right, off-centre, and inconsistent with ImageDrawCircleLines, which is 2*radius + 1 in both directions. Widen the four spans by one pixel so the fill is (2r+1) x (2r+1), centred on (centerX, centerY) and aligned with ImageDrawCircleLines. Fixes #6117
This commit is contained in:
@@ -3977,10 +3977,10 @@ void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color col
|
||||
|
||||
while (y >= x)
|
||||
{
|
||||
ImageDrawRectangle(dst, centerX - x, centerY + y, x*2, 1, color);
|
||||
ImageDrawRectangle(dst, centerX - x, centerY - y, x*2, 1, color);
|
||||
ImageDrawRectangle(dst, centerX - y, centerY + x, y*2, 1, color);
|
||||
ImageDrawRectangle(dst, centerX - y, centerY - x, y*2, 1, color);
|
||||
ImageDrawRectangle(dst, centerX - x, centerY + y, x*2 + 1, 1, color);
|
||||
ImageDrawRectangle(dst, centerX - x, centerY - y, x*2 + 1, 1, color);
|
||||
ImageDrawRectangle(dst, centerX - y, centerY + x, y*2 + 1, 1, color);
|
||||
ImageDrawRectangle(dst, centerX - y, centerY - x, y*2 + 1, 1, color);
|
||||
x++;
|
||||
|
||||
if (decesionParameter > 0)
|
||||
|
||||
Reference in New Issue
Block a user