forked from enlightenment/efl
parent
4e1ea67122
commit
87d707ee2c
|
@ -296,153 +296,151 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define SETUP_LINE_SHALLOW \
|
#define SETUP_LINE_SHALLOW \
|
||||||
if (x0 > x1) \
|
if (x0 > x1) \
|
||||||
{ \
|
{ \
|
||||||
EXCHANGE_POINTS(x0, y0, x1, y1) \
|
EXCHANGE_POINTS(x0, y0, x1, y1); \
|
||||||
dx = -dx; \
|
dx = -dx; \
|
||||||
dy = -dy; \
|
dy = -dy; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
px = x0; \
|
px = x0; \
|
||||||
py = y0; \
|
py = y0; \
|
||||||
\
|
\
|
||||||
p0_in = (IN_RANGE(x0 , y0 , clw, clh) ? 1 : 0); \
|
p0_in = (IN_RANGE(x0 , y0 , clw, clh) ? 1 : 0); \
|
||||||
p1_in = (IN_RANGE(x1 , y1 , clw, clh) ? 1 : 0); \
|
p1_in = (IN_RANGE(x1 , y1 , clw, clh) ? 1 : 0); \
|
||||||
\
|
\
|
||||||
dely = 1; \
|
dely = 1; \
|
||||||
dh = dstw; \
|
dh = dstw; \
|
||||||
if (dy < 0) \
|
if (dy < 0) \
|
||||||
{ \
|
{ \
|
||||||
dely = -1; \
|
dely = -1; \
|
||||||
dh = -dstw; \
|
dh = -dstw; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
dyy = ((dy) << 16) / (dx); \
|
dyy = ((dy) << 16) / (dx); \
|
||||||
\
|
\
|
||||||
if (!p0_in) \
|
if (!p0_in) \
|
||||||
{ \
|
{ \
|
||||||
dxx = ((dx) << 16) / (dy); \
|
dxx = ((dx) << 16) / (dy); \
|
||||||
if (px < 0) \
|
if (px < 0) \
|
||||||
{ \
|
{ \
|
||||||
x = -px; px = 0; \
|
x = -px; px = 0; \
|
||||||
yy = x * dyy; \
|
yy = x * dyy; \
|
||||||
y = yy >> 16; \
|
y = yy >> 16; \
|
||||||
if (!a_a) \
|
if (!a_a) \
|
||||||
y += (yy - (y << 16)) >> 15; \
|
y += (yy - (y << 16)) >> 15; \
|
||||||
py += y; \
|
py += y; \
|
||||||
if ((dely > 0) && (py >= clh)) \
|
if ((dely > 0) && (py >= clh)) \
|
||||||
return; \
|
return; \
|
||||||
else if ((dely < 0) && (py < -1)) \
|
else if ((dely < 0) && (py < -1)) \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
y = 0; \
|
y = 0; \
|
||||||
if ((dely > 0) && (py < -1)) \
|
if ((dely > 0) && (py < 0)) \
|
||||||
y = (-1 - py); \
|
y = (-1 - py); \
|
||||||
else if ((dely < 0) && (py >= clh)) \
|
else if ((dely < 0) && (py >= clh)) \
|
||||||
y = (clh - 1 - py); \
|
y = (clh - 1 - py); \
|
||||||
\
|
\
|
||||||
xx = y * dxx; \
|
xx = y * dxx; \
|
||||||
x = xx >> 16; \
|
x = xx >> 16; \
|
||||||
if (!a_a) \
|
if (!a_a) \
|
||||||
x += (xx - (x << 16)) >> 15; \
|
x += (xx - (x << 16)) >> 15; \
|
||||||
px += x; \
|
px += x; \
|
||||||
if (px >= clw) return; \
|
if (px >= clw) return; \
|
||||||
\
|
\
|
||||||
yy = x * dyy; \
|
yy = x * dyy; \
|
||||||
y = yy >> 16; \
|
y = yy >> 16; \
|
||||||
if (!a_a) \
|
if (!a_a) \
|
||||||
y += (yy - (y << 16)) >> 15; \
|
y += (yy - (y << 16)) >> 15; \
|
||||||
py += y; \
|
py += y; \
|
||||||
if ((dely > 0) && (py >= clh)) \
|
if ((dely > 0) && (py >= clh)) \
|
||||||
return; \
|
return; \
|
||||||
else if ((dely < 0) && (py < -1)) \
|
else if ((dely < 0) && (py < -1)) \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
p = data + (dstw * py) + px; \
|
p = data + (dstw * py) + px; \
|
||||||
\
|
\
|
||||||
x = px - x0; \
|
x = px - x0; \
|
||||||
yy = x * dyy; \
|
yy = x * dyy; \
|
||||||
prev_y = (yy >> 16); \
|
prev_y = (yy >> 16); \
|
||||||
\
|
\
|
||||||
rx = MIN(x1 + 1, clw); \
|
rx = MIN(x1 + 1, clw); \
|
||||||
by = clh - 1;
|
by = clh - 1;
|
||||||
|
|
||||||
|
|
||||||
#define SETUP_LINE_STEEP \
|
#define SETUP_LINE_STEEP \
|
||||||
if (y0 > y1) \
|
if (y0 > y1) \
|
||||||
{ \
|
{ \
|
||||||
EXCHANGE_POINTS(x0, y0, x1, y1) \
|
EXCHANGE_POINTS(x0, y0, x1, y1); \
|
||||||
dx = -dx; \
|
dx = -dx; \
|
||||||
dy = -dy; \
|
dy = -dy; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
px = x0; \
|
px = x0; \
|
||||||
py = y0; \
|
py = y0; \
|
||||||
\
|
\
|
||||||
p0_in = (IN_RANGE(x0 , y0 , clw, clh) ? 1 : 0); \
|
p0_in = (IN_RANGE(x0 , y0 , clw, clh) ? 1 : 0); \
|
||||||
p1_in = (IN_RANGE(x1 , y1 , clw, clh) ? 1 : 0); \
|
p1_in = (IN_RANGE(x1 , y1 , clw, clh) ? 1 : 0); \
|
||||||
\
|
\
|
||||||
delx = 1; \
|
delx = 1; \
|
||||||
if (dx < 0) \
|
if (dx < 0) \
|
||||||
delx = -1; \
|
delx = -1; \
|
||||||
\
|
\
|
||||||
dxx = ((dx) << 16) / (dy); \
|
dxx = ((dx) << 16) / (dy); \
|
||||||
\
|
\
|
||||||
if (!p0_in) \
|
if (!p0_in) \
|
||||||
{ \
|
{ \
|
||||||
dyy = ((dy) << 16) / (dx); \
|
dyy = ((dy) << 16) / (dx); \
|
||||||
\
|
\
|
||||||
if (py < 0) \
|
if (py < 0) \
|
||||||
{ \
|
{ \
|
||||||
y = -py; py = 0; \
|
y = -py; py = 0; \
|
||||||
xx = y * dxx; \
|
xx = y * dxx; \
|
||||||
x = xx >> 16; \
|
x = xx >> 16; \
|
||||||
if (!a_a) \
|
if (!a_a) \
|
||||||
x += (xx - (x << 16)) >> 15; \
|
x += (xx - (x << 16)) >> 15; \
|
||||||
px += x; \
|
px += x; \
|
||||||
if ((delx > 0) && (px >= clw)) \
|
if ((delx > 0) && (px >= clw)) \
|
||||||
return; \
|
return; \
|
||||||
else if ((delx < 0) && (px < -1)) \
|
else if ((delx < 0) && (px < -1)) \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
x = 0; \
|
x = 0; \
|
||||||
if ((delx > 0) && (px < -1)) \
|
if ((delx > 0) && (px < -1)) \
|
||||||
x = (-1 - px); \
|
x = (-1 - px); \
|
||||||
else if ((delx < 0) && (px >= clw)) \
|
else if ((delx < 0) && (px >= clw)) \
|
||||||
x = (clw - 1 - px); \
|
x = (clw - 1 - px); \
|
||||||
\
|
\
|
||||||
yy = x * dyy; \
|
yy = x * dyy; \
|
||||||
y = yy >> 16; \
|
y = yy >> 16; \
|
||||||
if (!a_a) \
|
if (!a_a) \
|
||||||
y += (yy - (y << 16)) >> 15; \
|
y += (yy - (y << 16)) >> 15; \
|
||||||
py += y; \
|
py += y; \
|
||||||
if (py >= clh) return; \
|
if (py >= clh) return; \
|
||||||
\
|
\
|
||||||
xx = y * dxx; \
|
xx = y * dxx; \
|
||||||
x = xx >> 16; \
|
x = xx >> 16; \
|
||||||
if (!a_a) \
|
if (!a_a) \
|
||||||
x += (xx - (x << 16)) >> 15; \
|
x += (xx - (x << 16)) >> 15; \
|
||||||
px += x; \
|
px += x; \
|
||||||
if ((delx > 0) && (px >= clw)) \
|
if ((delx > 0) && (px >= clw)) \
|
||||||
return; \
|
return; \
|
||||||
else if ((delx < 0) && (px < -1)) \
|
else if ((delx < 0) && (px < -1)) \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
p = data + (dstw * py) + px; \
|
p = data + (dstw * py) + px; \
|
||||||
\
|
\
|
||||||
y = py - y0; \
|
y = py - y0; \
|
||||||
xx = y * dxx; \
|
xx = y * dxx; \
|
||||||
prev_x = (xx >> 16); \
|
prev_x = (xx >> 16); \
|
||||||
\
|
\
|
||||||
by = MIN(y1 + 1, clh); \
|
by = MIN(y1 + 1, clh); \
|
||||||
rx = clw - 1;
|
rx = clw - 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1)
|
_evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1)
|
||||||
|
@ -485,7 +483,7 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
|
||||||
/* shallow: x-parametric */
|
/* shallow: x-parametric */
|
||||||
if ((dy < dx) || (dy < -dx))
|
if ((dy < dx) || (dy < -dx))
|
||||||
{
|
{
|
||||||
SETUP_LINE_SHALLOW
|
SETUP_LINE_SHALLOW;
|
||||||
|
|
||||||
while (px < rx)
|
while (px < rx)
|
||||||
{
|
{
|
||||||
|
@ -523,7 +521,7 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
|
||||||
|
|
||||||
/* steep: y-parametric */
|
/* steep: y-parametric */
|
||||||
|
|
||||||
SETUP_LINE_STEEP
|
SETUP_LINE_STEEP;
|
||||||
|
|
||||||
while (py < by)
|
while (py < by)
|
||||||
{
|
{
|
||||||
|
@ -571,7 +569,7 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
||||||
RGBA_Gfx_Pt_Func pfunc;
|
RGBA_Gfx_Pt_Func pfunc;
|
||||||
|
|
||||||
if (y0 > y1)
|
if (y0 > y1)
|
||||||
EXCHANGE_POINTS(x0, y0, x1, y1)
|
EXCHANGE_POINTS(x0, y0, x1, y1);
|
||||||
dx = x1 - x0;
|
dx = x1 - x0;
|
||||||
dy = y1 - y0;
|
dy = y1 - y0;
|
||||||
|
|
||||||
|
@ -602,7 +600,7 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
||||||
/* shallow: x-parametric */
|
/* shallow: x-parametric */
|
||||||
if ((dy < dx) || (dy < -dx))
|
if ((dy < dx) || (dy < -dx))
|
||||||
{
|
{
|
||||||
SETUP_LINE_SHALLOW
|
SETUP_LINE_SHALLOW;
|
||||||
|
|
||||||
while (px < rx)
|
while (px < rx)
|
||||||
{
|
{
|
||||||
|
@ -642,8 +640,7 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
||||||
}
|
}
|
||||||
|
|
||||||
/* steep: y-parametric */
|
/* steep: y-parametric */
|
||||||
|
SETUP_LINE_STEEP;
|
||||||
SETUP_LINE_STEEP
|
|
||||||
|
|
||||||
while (py < by)
|
while (py < by)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue