forked from enlightenment/efl
* evas: don't segv when manipulating line at canvas border.
FIXME: When the jump code start, it break line continuity and make them look hugly. I have no idea how to properly fix that right now. SVN revision: 54330
This commit is contained in:
parent
da9f3a357e
commit
4e1ea67122
|
@ -16,23 +16,23 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
||||||
|
|
||||||
|
|
||||||
#define IN_RANGE(x, y, w, h) \
|
#define IN_RANGE(x, y, w, h) \
|
||||||
( ((unsigned)(x) < (unsigned)(w)) && ((unsigned)(y) < (unsigned)(h)) )
|
( x > 0 && y > 0 &&((unsigned)(x) < (unsigned)(w)) && ((unsigned)(y) < (unsigned)(h)) )
|
||||||
|
|
||||||
#define IN_RECT(x, y, rx, ry, rw, rh) \
|
#define IN_RECT(x, y, rx, ry, rw, rh) \
|
||||||
( ((unsigned)((x) - (rx)) < (unsigned)(rw)) && \
|
( ((unsigned)((x) - (rx)) < (unsigned)(rw)) && \
|
||||||
((unsigned)((y) - (ry)) < (unsigned)(rh)) )
|
((unsigned)((y) - (ry)) < (unsigned)(rh)) )
|
||||||
|
|
||||||
#define EXCHANGE_POINTS(x0, y0, x1, y1) \
|
#define EXCHANGE_POINTS(x0, y0, x1, y1) \
|
||||||
{ \
|
{ \
|
||||||
int _tmp = y0; \
|
int _tmp = y0; \
|
||||||
\
|
\
|
||||||
y0 = y1; \
|
y0 = y1; \
|
||||||
y1 = _tmp; \
|
y1 = _tmp; \
|
||||||
\
|
\
|
||||||
_tmp = x0; \
|
_tmp = x0; \
|
||||||
x0 = x1; \
|
x0 = x1; \
|
||||||
x1 = _tmp; \
|
x1 = _tmp; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -502,6 +502,10 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
|
||||||
if ((py < 0) && (dely < 0)) return;
|
if ((py < 0) && (dely < 0)) return;
|
||||||
if ((py > by) && (dely > 0)) return;
|
if ((py > by) && (dely > 0)) return;
|
||||||
}
|
}
|
||||||
|
if (!p0_in)
|
||||||
|
{
|
||||||
|
if (py < 0) goto next_x;
|
||||||
|
}
|
||||||
#ifdef EVAS_SLI
|
#ifdef EVAS_SLI
|
||||||
if (((py) % dc->sli.h) == dc->sli.y)
|
if (((py) % dc->sli.h) == dc->sli.y)
|
||||||
#endif
|
#endif
|
||||||
|
@ -509,6 +513,7 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
|
||||||
if (IN_RANGE(px, py, clw, clh))
|
if (IN_RANGE(px, py, clw, clh))
|
||||||
pfunc(0, 255, color, p);
|
pfunc(0, 255, color, p);
|
||||||
}
|
}
|
||||||
|
next_x:
|
||||||
yy += dyy;
|
yy += dyy;
|
||||||
px++;
|
px++;
|
||||||
p++;
|
p++;
|
||||||
|
@ -535,6 +540,10 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
|
||||||
if ((px < 0) && (delx < 0)) return;
|
if ((px < 0) && (delx < 0)) return;
|
||||||
if ((px > rx) && (delx > 0)) return;
|
if ((px > rx) && (delx > 0)) return;
|
||||||
}
|
}
|
||||||
|
if (!p0_in)
|
||||||
|
{
|
||||||
|
if (px < 0) goto next_y;
|
||||||
|
}
|
||||||
#ifdef EVAS_SLI
|
#ifdef EVAS_SLI
|
||||||
if (((py) % dc->sli.h) == dc->sli.y)
|
if (((py) % dc->sli.h) == dc->sli.y)
|
||||||
#endif
|
#endif
|
||||||
|
@ -542,6 +551,7 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
|
||||||
if (IN_RANGE(px, py, clw, clh))
|
if (IN_RANGE(px, py, clw, clh))
|
||||||
pfunc(0, 255, color, p);
|
pfunc(0, 255, color, p);
|
||||||
}
|
}
|
||||||
|
next_y:
|
||||||
xx += dxx;
|
xx += dxx;
|
||||||
py++;
|
py++;
|
||||||
p += dstw;
|
p += dstw;
|
||||||
|
@ -607,10 +617,14 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
||||||
}
|
}
|
||||||
if (!p1_in)
|
if (!p1_in)
|
||||||
{
|
{
|
||||||
if ((py <= -1) && (dely < 0)) return;
|
if ((py < 0) && (dely < 0)) return;
|
||||||
if ((py > by) && (dely > 0)) return;
|
if ((py > by) && (dely > 0)) return;
|
||||||
}
|
}
|
||||||
if ((px) < clw)
|
if (!p0_in)
|
||||||
|
{
|
||||||
|
if (py < 0) goto next_x;
|
||||||
|
}
|
||||||
|
if (px < clw)
|
||||||
{
|
{
|
||||||
aa = ((yy - (y << 16)) >> 8);
|
aa = ((yy - (y << 16)) >> 8);
|
||||||
if ((py) < clh)
|
if ((py) < clh)
|
||||||
|
@ -618,6 +632,8 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
||||||
if ((py + 1) < clh)
|
if ((py + 1) < clh)
|
||||||
pfunc(0, aa, color, p + dstw);
|
pfunc(0, aa, color, p + dstw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
next_x:
|
||||||
yy += dyy;
|
yy += dyy;
|
||||||
px++;
|
px++;
|
||||||
p++;
|
p++;
|
||||||
|
@ -642,10 +658,14 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
||||||
}
|
}
|
||||||
if (!p1_in)
|
if (!p1_in)
|
||||||
{
|
{
|
||||||
if ((px <= -1) && (delx < 0)) return;
|
if ((px < 0) && (delx < 0)) return;
|
||||||
if ((px > rx) && (delx > 0)) return;
|
if ((px > rx) && (delx > 0)) return;
|
||||||
}
|
}
|
||||||
if ((py) < clh)
|
if (!p0_in)
|
||||||
|
{
|
||||||
|
if (px < 0) goto next_y;
|
||||||
|
}
|
||||||
|
if (py < clh)
|
||||||
{
|
{
|
||||||
aa = ((xx - (x << 16)) >> 8);
|
aa = ((xx - (x << 16)) >> 8);
|
||||||
if ((px) < clw)
|
if ((px) < clw)
|
||||||
|
@ -653,6 +673,7 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
||||||
if ((px + 1) < clw)
|
if ((px + 1) < clw)
|
||||||
pfunc(0, aa, color, p + 1);
|
pfunc(0, aa, color, p + 1);
|
||||||
}
|
}
|
||||||
|
next_y:
|
||||||
xx += dxx;
|
xx += dxx;
|
||||||
py++;
|
py++;
|
||||||
p += dstw;
|
p += dstw;
|
||||||
|
|
Loading…
Reference in New Issue