It looks like you are modifying a ring about 150-200 pixels in diameter, so writing maybe 14000 pixels.
I seem to remember AGS was capable of updating 160x100=16000 pixels at about 20 FPS back in the day, so it should be able to manage 40 FPS now.
To ensure you are looping through the minimum number of iterations, I would work per scan line, and calculate the left and right extent of the circle, then decide if you are in a section with an inner unmodified part, and skip over the unmodified pixels, something like this:
// for a ring with small radius r and large radius R
for (y = (centerY - R) to (centerY + R))
h = abs(y - centerY)
halfOuterWidth = sqrt(R*R - h * h)
if (h < r)
halfInnerWidth = sqrt(r * r - h * h)
// modify pixels from centerX-halfOuterWidth to centerX-halfInnerWidth and from centerX+halfInnerWidth to centerX+halfOuterWidth
else
// modify pixels from centerX-halfOuterWidth to centerX+halfOuterWidth