Fixed writing pixels out of bounds when using the gradient ellipse (corners) tool.

Gradient ellipse (corners) tool had no clipping code, and would draw off the bottom or right edge of the image.

Clipping code has been added, similar to other tools.
This commit is contained in:
Kiri Jolly 2020-12-23 20:06:02 -08:00
parent 101438381d
commit d36cf2d14a

View File

@ -2513,6 +2513,16 @@ void Draw_grad_inscribed_ellipse(short x1, short y1, short x2, short y2, short s
if (Gradient_total_range==0) if (Gradient_total_range==0)
Gradient_total_range=1; Gradient_total_range=1;
// Apply limits to final dimensions to draw.
if (left < Limit_left)
left = Limit_left;
if (top < Limit_top)
top = Limit_top;
if (right > Limit_right)
right = Limit_right;
if (bottom > Limit_bottom)
bottom = Limit_bottom;
for (y_pos = top; y_pos <= bottom; y_pos++) for (y_pos = top; y_pos <= bottom; y_pos++)
{ {
long dbl_y = 2*y_pos - dbl_center_y; long dbl_y = 2*y_pos - dbl_center_y;