[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:
Risu-swift
2026-09-02 16:01:04 +05:30
committed by GitHub
parent 5a433a51a3
commit 9b2efc4552

View File

@@ -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)