no more ellipse segv's :)

SVN revision: 3582
This commit is contained in:
Carsten Haitzler 2000-10-12 23:51:58 +00:00
parent 456a035996
commit 72f81a4c4d
2 changed files with 51 additions and 26 deletions

View File

@ -2946,8 +2946,11 @@ imlib_image_draw_ellipse(int xc, int yc, int a, int b)
}
else
{
__imlib_draw_ellipse(im, xc, yc, a, b, ctxt_color.red, ctxt_color.green,
ctxt_color.blue, ctxt_color.alpha, ctxt_operation);
__imlib_draw_ellipse_clipped(im, xc, yc, a, b, 0,
im->w - 1, 0, im->h - 1,
ctxt_color.red, ctxt_color.green,
ctxt_color.blue, ctxt_color.alpha,
ctxt_operation);
}
}
@ -2966,11 +2969,11 @@ imlib_image_fill_ellipse(int xc, int yc, int a, int b)
__imlib_DirtyPixmapsForImage(im);
__imlib_fill_ellipse(im, xc, yc, a, b, ctxt_cliprect.x,
ctxt_cliprect.x + ctxt_cliprect.w,
ctxt_cliprect.y,
ctxt_cliprect.y + ctxt_cliprect.h, ctxt_color.red,
ctxt_color.green, ctxt_color.blue, ctxt_color.alpha,
ctxt_operation, ctxt_anti_alias);
ctxt_cliprect.x + ctxt_cliprect.w - 1,
ctxt_cliprect.y,
ctxt_cliprect.y + ctxt_cliprect.h - 1, ctxt_color.red,
ctxt_color.green, ctxt_color.blue, ctxt_color.alpha,
ctxt_operation, ctxt_anti_alias);
}

View File

@ -1927,11 +1927,17 @@ __imlib_fill_ellipse(ImlibImage * im, int xc, int yc, int aa, int bb,
for (x = 0, y = bb, dec = 2 * b2 + a2 * (1 - 2 * bb); b2 * x <= a2 * y;
x++)
{
table1[yc - y].x = xc - x;
table2[yc - y].x = xc + x;
if (((yc - y) >= 0) && ((yc - y) < im->h))
{
table1[yc - y].x = xc - x;
table2[yc - y].x = xc + x;
}
table1[yc + y].x = xc - x;
table2[yc + y].x = xc + x;
if (((yc + y) >= 0) && ((yc + y) < im->h))
{
table1[yc + y].x = xc - x;
table2[yc + y].x = xc + x;
}
if (dec >= 0.0)
dec += 4.0 * a2 * (1 - (y--));
@ -1941,11 +1947,17 @@ __imlib_fill_ellipse(ImlibImage * im, int xc, int yc, int aa, int bb,
for (x = aa, y = 0, dec = 2 * a2 + b2 * (1 - 2 * aa); a2 * y <= b2 * x;
y++)
{
table1[yc - y].x = xc - x;
table2[yc - y].x = xc + x;
if (((yc - y) >= 0) && ((yc - y) < im->h))
{
table1[yc - y].x = xc - x;
table2[yc - y].x = xc + x;
}
table1[yc + y].x = xc - x;
table2[yc + y].x = xc + x;
if (((yc + y) >= 0) && ((yc + y) < im->h))
{
table1[yc + y].x = xc - x;
table2[yc + y].x = xc + x;
}
if (dec >= 0)
dec += 4 * b2 * (1 - (x--));
@ -1960,21 +1972,31 @@ __imlib_fill_ellipse(ImlibImage * im, int xc, int yc, int aa, int bb,
__spanlist_clip(table1, table2, &miny, &maxy, clip_xmin, clip_xmax,
clip_ymin, clip_ymax);
if (antialias)
{
do
{
/* spanAA(im, miny, table1, table2, r, g, b, a, op);*/
miny++;
}
while (miny < maxy);
}
else
if (miny < 0) miny = 0;
if (miny >= im->h)
{
free(table1);
free(table2);
return;
}
if (maxy < 0)
{
free(table1);
free(table2);
return;
}
if (maxy >= im->h) maxy = im->h - 1;
{
do
{
span(im, miny, table1[miny].x, table2[miny].x, r, g, b, a, op);
int x1, x2;
x1 = table1[miny].x;
x2 = table2[miny].x;
if (x1 < clip_xmin) x1 = clip_xmin;
if (x2 > clip_xmax) x2 = clip_xmax;
span(im, miny, x1, x2, r, g, b, a, op);
miny++;
}
while (miny < maxy);