fix segv's in simple line draws

SVN revision: 22642
This commit is contained in:
Carsten Haitzler 2006-05-16 08:52:05 +00:00
parent 4e97e2bf2c
commit cbeeae7f14
1 changed files with 42 additions and 28 deletions

View File

@ -151,6 +151,8 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
by = cly + clh - 1;
if (dy == 0)
{
if ((y0 >= ty) && (y0 <= by))
{
if (dx < 0)
{
@ -168,7 +170,7 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
sfunc = evas_common_gfx_func_composite_color_span_get(color, dst, len, dc->render_op);
if (sfunc)
sfunc(NULL, NULL, color, p, len);
}
return;
}
@ -176,6 +178,8 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
if (!pfunc) return;
if (dx == 0)
{
if ((x0 >= lx) && (x0 <= rx))
{
if (y0 < ty) y0 = ty;
if (y1 > by) y1 = by;
@ -187,7 +191,7 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
pfunc(0, 255, color, p);
p += dstw;
}
}
return;
}
@ -252,10 +256,20 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
}
}
}
len = y1 - y0 + 1;
if (y1 > y0)
{
p = dst->image->data + (dstw * y0) + x0;
len = y1 - y0 + 1;
if (dx > 0) dstw++;
else dstw--;
}
else
{
len = y0 - y1 + 1;
p = dst->image->data + (dstw * y1) + x1;
if (dx > 0) dstw--;
else dstw++;
}
while (len--)
{