[PATCH fbtest 07/17] drawops: Refactor generic_draw_ellipse()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make generic_draw_ellipse() more similar to generic_fill_ellipse().

Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
 drawops/generic.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drawops/generic.c b/drawops/generic.c
index e81dea1ba23d6595..4b64c20cc0fe68bc 100644
--- a/drawops/generic.c
+++ b/drawops/generic.c
@@ -309,15 +309,18 @@ void generic_draw_ellipse(u32 x, u32 y, u32 a, u32 b, pixel_t pixel)
 	    int dS2 = -4*a2*(b-1);
 	    int dT2 = dS2+2*a2;
 
-	    draw_ellipse_points(x, y, x1, y1, pixel);
-	    do {
+	    while (1) {
 		if (S < 0) {
+		    draw_ellipse_points(x, y, x1, y1, pixel);
 		    S += dS1;
 		    T += dT1;
 		    dS1 += 4*b2;
 		    dT1 += 4*b2;
 		    x1++;
 		} else if (T < 0) {
+		    draw_ellipse_points(x, y, x1, y1, pixel);
+		    if (y1 == 0)
+			break;
 		    S += dS1+dS2;
 		    T += dT1+dT2;
 		    dS1 += 4*b2;
@@ -327,14 +330,16 @@ void generic_draw_ellipse(u32 x, u32 y, u32 a, u32 b, pixel_t pixel)
 		    x1++;
 		    y1--;
 		} else {
+		    draw_ellipse_points(x, y, x1, y1, pixel);
+		    if (y1 == 0)
+			break;
 		    S += dS2;
 		    T += dT2;
 		    dS2 += 4*a2;
 		    dT2 += 4*a2;
 		    y1--;
 		}
-		draw_ellipse_points(x, y, x1, y1, pixel);
-	    } while (y1 > 0);
+	    }
 	} else {
 	    u32 x1 = a;
 	    u32 y1 = 0;
@@ -353,6 +358,7 @@ void generic_draw_ellipse(u32 x, u32 y, u32 a, u32 b, pixel_t pixel)
 		    dS1 += 4*a2;
 		    dT1 += 4*a2;
 		    y1++;
+		    draw_ellipse_points(x, y, x1, y1, pixel);
 		} else if (T < 0) {
 		    S += dS1+dS2;
 		    T += dT1+dT2;
@@ -362,14 +368,15 @@ void generic_draw_ellipse(u32 x, u32 y, u32 a, u32 b, pixel_t pixel)
 		    dT2 += 4*b2;
 		    x1--;
 		    y1++;
+		    draw_ellipse_points(x, y, x1, y1, pixel);
 		} else {
 		    S += dS2;
 		    T += dT2;
 		    dS2 += 4*b2;
 		    dT2 += 4*b2;
 		    x1--;
+		    draw_ellipse_points(x, y, x1, y1, pixel);
 		}
-		draw_ellipse_points(x, y, x1, y1, pixel);
 	    } while (x1 > 0);
 	}
     }
-- 
2.34.1





[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux