2004-01-29 21:46:57 -08:00
|
|
|
{
|
|
|
|
int Cx, j;
|
2005-12-03 01:27:53 -08:00
|
|
|
DATA32 *pix, *dptr, *pbuf, **yp;
|
2004-01-29 21:46:57 -08:00
|
|
|
int r, g, b, a, rr, gg, bb, aa;
|
2005-12-03 01:27:53 -08:00
|
|
|
int *xp, xap, yap, pos;
|
2004-01-29 21:46:57 -08:00
|
|
|
int dyy, dxx;
|
2005-12-03 01:27:53 -08:00
|
|
|
int w = dst_clip_w;
|
|
|
|
|
2004-01-29 21:46:57 -08:00
|
|
|
dptr = dst_ptr;
|
2005-12-03 01:27:53 -08:00
|
|
|
pos = (src_region_y * src_w) + src_region_x;
|
2004-01-29 21:46:57 -08:00
|
|
|
dyy = dst_clip_y - dst_region_y;
|
|
|
|
dxx = dst_clip_x - dst_region_x;
|
2005-12-03 01:27:53 -08:00
|
|
|
|
|
|
|
xp = xpoints + dxx;
|
|
|
|
yp = ypoints + dyy;
|
|
|
|
xapp = xapoints + dxx;
|
|
|
|
yapp = yapoints + dyy;
|
|
|
|
pbuf = buf;
|
|
|
|
|
2004-01-29 21:46:57 -08:00
|
|
|
if (src->flags & RGBA_IMAGE_HAS_ALPHA)
|
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
while (dst_clip_h--)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
while (dst_clip_w--)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
Cx = *xapp >> 16;
|
|
|
|
xap = *xapp & 0xffff;
|
|
|
|
pix = *yp + *xp + pos;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2005-12-03 01:27:53 -08:00
|
|
|
a = (A_VAL(pix) * xap) >> 10;
|
2004-01-29 21:46:57 -08:00
|
|
|
r = (R_VAL(pix) * xap) >> 10;
|
|
|
|
g = (G_VAL(pix) * xap) >> 10;
|
|
|
|
b = (B_VAL(pix) * xap) >> 10;
|
|
|
|
for (j = (1 << 14) - xap; j > Cx; j -= Cx)
|
|
|
|
{
|
|
|
|
pix++;
|
2005-12-03 01:27:53 -08:00
|
|
|
a += (A_VAL(pix) * Cx) >> 10;
|
2004-01-29 21:46:57 -08:00
|
|
|
r += (R_VAL(pix) * Cx) >> 10;
|
|
|
|
g += (G_VAL(pix) * Cx) >> 10;
|
|
|
|
b += (B_VAL(pix) * Cx) >> 10;
|
|
|
|
}
|
|
|
|
if (j > 0)
|
|
|
|
{
|
|
|
|
pix++;
|
2005-12-03 01:27:53 -08:00
|
|
|
a += (A_VAL(pix) * j) >> 10;
|
2004-01-29 21:46:57 -08:00
|
|
|
r += (R_VAL(pix) * j) >> 10;
|
|
|
|
g += (G_VAL(pix) * j) >> 10;
|
|
|
|
b += (B_VAL(pix) * j) >> 10;
|
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
if ((yap = *yapp) > 0)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
pix = *yp + *xp + src_w + pos;
|
|
|
|
aa = (A_VAL(pix) * xap) >> 10;
|
2004-01-29 21:46:57 -08:00
|
|
|
rr = (R_VAL(pix) * xap) >> 10;
|
|
|
|
gg = (G_VAL(pix) * xap) >> 10;
|
|
|
|
bb = (B_VAL(pix) * xap) >> 10;
|
|
|
|
for (j = (1 << 14) - xap; j > Cx; j -= Cx)
|
|
|
|
{
|
|
|
|
pix++;
|
2005-12-03 01:27:53 -08:00
|
|
|
aa += (A_VAL(pix) * Cx) >> 10;
|
2004-01-29 21:46:57 -08:00
|
|
|
rr += (R_VAL(pix) * Cx) >> 10;
|
|
|
|
gg += (G_VAL(pix) * Cx) >> 10;
|
|
|
|
bb += (B_VAL(pix) * Cx) >> 10;
|
|
|
|
}
|
|
|
|
if (j > 0)
|
|
|
|
{
|
|
|
|
pix++;
|
2005-12-03 01:27:53 -08:00
|
|
|
aa += (A_VAL(pix) * j) >> 10;
|
2004-01-29 21:46:57 -08:00
|
|
|
rr += (R_VAL(pix) * j) >> 10;
|
|
|
|
gg += (G_VAL(pix) * j) >> 10;
|
|
|
|
bb += (B_VAL(pix) * j) >> 10;
|
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
a += ((aa - a) * yap) >> 8;
|
|
|
|
r += ((rr - r) * yap) >> 8;
|
|
|
|
g += ((gg - g) * yap) >> 8;
|
|
|
|
b += ((bb - b) * yap) >> 8;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
*pbuf++ = ARGB_JOIN(a >> 4, r >> 4, g >> 4, b >> 4);
|
|
|
|
xp++; xapp++;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
|
2004-01-29 21:46:57 -08:00
|
|
|
if (dc->mod.use)
|
2005-12-03 01:27:53 -08:00
|
|
|
func_cmod(buf, dptr, w, dc->mod.r, dc->mod.g, dc->mod.b, dc->mod.a);
|
2004-01-29 21:46:57 -08:00
|
|
|
else if (dc->mul.use)
|
2005-12-03 01:27:53 -08:00
|
|
|
func_mul(buf, dptr, w, dc->mul.col);
|
2004-01-29 21:46:57 -08:00
|
|
|
else
|
2005-12-03 01:27:53 -08:00
|
|
|
func(buf, dptr, w);
|
|
|
|
|
|
|
|
pbuf = buf;
|
|
|
|
dptr += dst_w; dst_clip_w = w;
|
|
|
|
yp++; yapp++;
|
|
|
|
xp = xpoints + dxx;
|
|
|
|
xapp = xapoints + dxx;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
while (dst_clip_h--)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
while (dst_clip_w--)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
Cx = *xapp >> 16;
|
|
|
|
xap = *xapp & 0xffff;
|
|
|
|
pix = *yp + *xp + pos;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2004-01-29 21:46:57 -08:00
|
|
|
r = (R_VAL(pix) * xap) >> 10;
|
|
|
|
g = (G_VAL(pix) * xap) >> 10;
|
|
|
|
b = (B_VAL(pix) * xap) >> 10;
|
|
|
|
for (j = (1 << 14) - xap; j > Cx; j -= Cx)
|
|
|
|
{
|
|
|
|
pix++;
|
|
|
|
r += (R_VAL(pix) * Cx) >> 10;
|
|
|
|
g += (G_VAL(pix) * Cx) >> 10;
|
|
|
|
b += (B_VAL(pix) * Cx) >> 10;
|
|
|
|
}
|
|
|
|
if (j > 0)
|
|
|
|
{
|
|
|
|
pix++;
|
|
|
|
r += (R_VAL(pix) * j) >> 10;
|
|
|
|
g += (G_VAL(pix) * j) >> 10;
|
|
|
|
b += (B_VAL(pix) * j) >> 10;
|
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
if ((yap = *yapp) > 0)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2005-12-03 01:27:53 -08:00
|
|
|
pix = *yp + *xp + src_w + pos;
|
2004-01-29 21:46:57 -08:00
|
|
|
rr = (R_VAL(pix) * xap) >> 10;
|
|
|
|
gg = (G_VAL(pix) * xap) >> 10;
|
|
|
|
bb = (B_VAL(pix) * xap) >> 10;
|
|
|
|
for (j = (1 << 14) - xap; j > Cx; j -= Cx)
|
|
|
|
{
|
|
|
|
pix++;
|
|
|
|
rr += (R_VAL(pix) * Cx) >> 10;
|
|
|
|
gg += (G_VAL(pix) * Cx) >> 10;
|
|
|
|
bb += (B_VAL(pix) * Cx) >> 10;
|
|
|
|
}
|
|
|
|
if (j > 0)
|
|
|
|
{
|
|
|
|
pix++;
|
|
|
|
rr += (R_VAL(pix) * j) >> 10;
|
|
|
|
gg += (G_VAL(pix) * j) >> 10;
|
|
|
|
bb += (B_VAL(pix) * j) >> 10;
|
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
r += ((rr - r) * yap) >> 8;
|
|
|
|
g += ((gg - g) * yap) >> 8;
|
|
|
|
b += ((bb - b) * yap) >> 8;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
*pbuf++ = ARGB_JOIN(0xff, r >> 4, g >> 4, b >> 4);
|
|
|
|
xp++; xapp++;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
|
2004-01-29 21:46:57 -08:00
|
|
|
if (dc->mod.use)
|
2005-12-03 01:27:53 -08:00
|
|
|
func_cmod(buf, dptr, w, dc->mod.r, dc->mod.g, dc->mod.b, dc->mod.a);
|
2004-01-29 21:46:57 -08:00
|
|
|
else if (dc->mul.use)
|
2005-12-03 01:27:53 -08:00
|
|
|
func_mul(buf, dptr, w, dc->mul.col);
|
2004-01-29 21:46:57 -08:00
|
|
|
else
|
2005-12-03 01:27:53 -08:00
|
|
|
func(buf, dptr, w);
|
|
|
|
|
|
|
|
pbuf = buf;
|
|
|
|
dptr += dst_w; dst_clip_w = w;
|
|
|
|
yp++; yapp++;
|
|
|
|
xp = xpoints + dxx;
|
|
|
|
xapp = xapoints + dxx;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|