2004-01-29 21:46:57 -08:00
|
|
|
{
|
2006-09-30 03:18:37 -07:00
|
|
|
int srx = src_region_x, sry = src_region_y;
|
|
|
|
int srw = src_region_w, srh = src_region_h;
|
|
|
|
int drx = dst_region_x, dry = dst_region_y;
|
|
|
|
int drw = dst_region_w, drh = dst_region_h;
|
2005-12-03 01:27:53 -08:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
int dsxx, dsyy, sxx, syy, sx, sy;
|
|
|
|
int cx, cy;
|
|
|
|
int direct_scale = 0, buf_step = 0;
|
2005-12-03 01:27:53 -08:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
DATA32 *psrc, *pdst, *pdst_end;
|
|
|
|
DATA32 *buf, *pbuf, *pbuf_end;
|
2009-12-21 07:52:12 -08:00
|
|
|
RGBA_Gfx_Func func = NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
/* a scanline buffer */
|
|
|
|
pdst = dst_ptr; // it's been set at (dst_clip_x, dst_clip_y)
|
|
|
|
pdst_end = pdst + (dst_clip_h * dst_w);
|
|
|
|
if (!dc->mul.use)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2008-06-03 02:09:39 -07:00
|
|
|
if ((dc->render_op == _EVAS_RENDER_BLEND) && !src->cache_entry.flags.alpha)
|
2008-04-11 17:32:30 -07:00
|
|
|
{ direct_scale = 1; buf_step = dst->cache_entry.w; }
|
2006-09-30 03:18:37 -07:00
|
|
|
else if (dc->render_op == _EVAS_RENDER_COPY)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2008-04-11 17:32:30 -07:00
|
|
|
direct_scale = 1; buf_step = dst->cache_entry.w;
|
2008-06-03 02:09:39 -07:00
|
|
|
if (src->cache_entry.flags.alpha)
|
|
|
|
dst->cache_entry.flags.alpha = 1;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
|
|
|
}
|
2006-09-30 03:18:37 -07:00
|
|
|
if (!direct_scale)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2006-11-13 15:23:44 -08:00
|
|
|
buf = alloca(dst_clip_w * sizeof(DATA32));
|
2006-09-30 03:18:37 -07:00
|
|
|
if (dc->mul.use)
|
|
|
|
func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op);
|
2004-01-29 21:46:57 -08:00
|
|
|
else
|
2006-09-30 03:18:37 -07:00
|
|
|
func = evas_common_gfx_func_composite_pixel_span_get(src, dst, dst_clip_w, dc->render_op);
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
2006-05-02 00:28:49 -07:00
|
|
|
else
|
2006-09-30 03:18:37 -07:00
|
|
|
buf = pdst;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-10-04 22:28:35 -07:00
|
|
|
if ((srw > 1) && (drw > 1))
|
|
|
|
dsxx = ((srw - 1) << 16) / (drw - 1);
|
|
|
|
else
|
|
|
|
dsxx = (srw << 16) / drw;
|
|
|
|
if ((srh > 1) && (drh > 1))
|
|
|
|
dsyy = ((srh - 1) << 16) / (drh - 1);
|
|
|
|
else
|
|
|
|
dsyy = (srh << 16) / drh;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
cx = dst_clip_x - drx;
|
|
|
|
cy = dst_clip_y - dry;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
sxx = (dsxx * cx);
|
|
|
|
syy = (dsyy * cy);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
sy = syy >> 16;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
if (drh == srh)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2006-09-30 03:18:37 -07:00
|
|
|
int sxx0 = sxx;
|
2006-11-15 08:44:34 -08:00
|
|
|
#ifdef EVAS_SLI
|
|
|
|
int ysli = dst_clip_y;
|
|
|
|
#endif
|
2008-04-11 17:32:30 -07:00
|
|
|
psrc = src->image.data + (src_w * (sry + cy)) + srx;
|
2006-09-30 03:18:37 -07:00
|
|
|
while (pdst < pdst_end)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2006-11-15 08:44:34 -08:00
|
|
|
#ifdef EVAS_SLI
|
|
|
|
if (((ysli) % dc->sli.h) == dc->sli.y)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
pbuf = buf; pbuf_end = buf + dst_clip_w;
|
|
|
|
sxx = sxx0;
|
2006-09-30 03:18:37 -07:00
|
|
|
#ifdef SCALE_USING_MMX
|
2006-11-15 08:44:34 -08:00
|
|
|
pxor_r2r(mm0, mm0);
|
|
|
|
MOV_A2R(ALPHA_255, mm5)
|
2006-09-30 03:18:37 -07:00
|
|
|
#endif
|
2006-11-15 08:44:34 -08:00
|
|
|
while (pbuf < pbuf_end)
|
|
|
|
{
|
|
|
|
DATA32 p0, p1;
|
|
|
|
int ax;
|
2008-07-19 10:40:52 -07:00
|
|
|
|
2006-11-15 08:44:34 -08:00
|
|
|
sx = (sxx >> 16);
|
|
|
|
ax = 1 + ((sxx - (sx << 16)) >> 8);
|
|
|
|
p0 = p1 = *(psrc + sx);
|
|
|
|
if ((sx + 1) < srw)
|
|
|
|
p1 = *(psrc + sx + 1);
|
2006-09-30 03:18:37 -07:00
|
|
|
#ifdef SCALE_USING_MMX
|
2006-11-15 08:44:34 -08:00
|
|
|
MOV_P2R(p0, mm1, mm0)
|
|
|
|
if (p0 | p1)
|
|
|
|
{
|
|
|
|
MOV_A2R(ax, mm3)
|
|
|
|
MOV_P2R(p1, mm2, mm0)
|
|
|
|
INTERP_256_R2R(mm3, mm2, mm1, mm5)
|
|
|
|
}
|
|
|
|
MOV_R2P(mm1, *pbuf, mm0)
|
|
|
|
pbuf++;
|
2006-09-30 03:18:37 -07:00
|
|
|
#else
|
2006-11-15 08:44:34 -08:00
|
|
|
if (p0 | p1)
|
|
|
|
p0 = INTERP_256(ax, p1, p0);
|
|
|
|
*pbuf++ = p0;
|
2006-09-30 03:18:37 -07:00
|
|
|
#endif
|
2006-11-15 08:44:34 -08:00
|
|
|
sxx += dsxx;
|
|
|
|
}
|
|
|
|
/* * blend here [clip_w *] buf -> dptr * */
|
|
|
|
if (!direct_scale)
|
|
|
|
func(buf, NULL, dc->mul.col, pdst, dst_clip_w);
|
|
|
|
}
|
|
|
|
#ifdef EVAS_SLI
|
|
|
|
ysli++;
|
2008-07-19 10:40:52 -07:00
|
|
|
#endif
|
2006-11-15 08:44:34 -08:00
|
|
|
pdst += dst_w;
|
|
|
|
psrc += src_w;
|
|
|
|
buf += buf_step;
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
2006-09-30 03:18:37 -07:00
|
|
|
|
|
|
|
goto done_scale_up;
|
2005-12-03 01:27:53 -08:00
|
|
|
}
|
2006-09-30 03:18:37 -07:00
|
|
|
else if (drw == srw)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2008-04-11 17:32:30 -07:00
|
|
|
DATA32 *ps = src->image.data + (src_w * sry) + srx + cx;
|
2006-11-15 08:44:34 -08:00
|
|
|
#ifdef EVAS_SLI
|
|
|
|
int ysli = dst_clip_y;
|
|
|
|
#endif
|
2006-01-22 23:57:30 -08:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
while (pdst < pdst_end)
|
2005-12-03 01:27:53 -08:00
|
|
|
{
|
2006-11-15 08:44:34 -08:00
|
|
|
#ifdef EVAS_SLI
|
|
|
|
if (((ysli) % dc->sli.h) == dc->sli.y)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
int ay;
|
2008-07-19 10:40:52 -07:00
|
|
|
|
2006-11-15 08:44:34 -08:00
|
|
|
sy = syy >> 16;
|
|
|
|
psrc = ps + (sy * src_w);
|
|
|
|
ay = 1 + ((syy - (sy << 16)) >> 8);
|
2006-09-30 03:18:37 -07:00
|
|
|
#ifdef SCALE_USING_MMX
|
2006-11-15 08:44:34 -08:00
|
|
|
pxor_r2r(mm0, mm0);
|
|
|
|
MOV_A2R(ALPHA_255, mm5)
|
|
|
|
MOV_A2R(ay, mm4)
|
2006-09-30 03:18:37 -07:00
|
|
|
#endif
|
2006-11-15 08:44:34 -08:00
|
|
|
pbuf = buf; pbuf_end = buf + dst_clip_w;
|
|
|
|
while (pbuf < pbuf_end)
|
|
|
|
{
|
|
|
|
DATA32 p0 = *psrc, p2 = p0;
|
2008-07-19 10:40:52 -07:00
|
|
|
|
2006-11-15 08:44:34 -08:00
|
|
|
if ((sy + 1) < srh)
|
|
|
|
p2 = *(psrc + src_w);
|
2006-09-30 03:18:37 -07:00
|
|
|
#ifdef SCALE_USING_MMX
|
2006-11-15 08:44:34 -08:00
|
|
|
MOV_P2R(p0, mm1, mm0)
|
|
|
|
if (p0 | p2)
|
|
|
|
{
|
|
|
|
MOV_P2R(p2, mm2, mm0)
|
|
|
|
INTERP_256_R2R(mm4, mm2, mm1, mm5)
|
|
|
|
}
|
|
|
|
MOV_R2P(mm1, *pbuf, mm0)
|
|
|
|
pbuf++;
|
2006-09-30 03:18:37 -07:00
|
|
|
#else
|
2006-11-15 08:44:34 -08:00
|
|
|
if (p0 | p2)
|
|
|
|
p0 = INTERP_256(ay, p2, p0);
|
|
|
|
*pbuf++ = p0;
|
2006-09-30 03:18:37 -07:00
|
|
|
#endif
|
2006-11-15 08:44:34 -08:00
|
|
|
psrc++;
|
|
|
|
}
|
|
|
|
/* * blend here [clip_w *] buf -> dptr * */
|
|
|
|
if (!direct_scale)
|
|
|
|
func(buf, NULL, dc->mul.col, pdst, dst_clip_w);
|
|
|
|
}
|
|
|
|
#ifdef EVAS_SLI
|
|
|
|
ysli++;
|
2008-07-19 10:40:52 -07:00
|
|
|
#endif
|
2006-09-30 03:18:37 -07:00
|
|
|
pdst += dst_w;
|
|
|
|
syy += dsyy;
|
|
|
|
buf += buf_step;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
2006-09-30 03:18:37 -07:00
|
|
|
goto done_scale_up;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|
2006-09-30 03:18:37 -07:00
|
|
|
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2008-04-11 17:32:30 -07:00
|
|
|
DATA32 *ps = src->image.data + (src_w * sry) + srx;
|
2006-09-30 03:18:37 -07:00
|
|
|
int sxx0 = sxx;
|
2006-11-15 08:44:34 -08:00
|
|
|
#ifdef EVAS_SLI
|
|
|
|
int ysli = dst_clip_y;
|
|
|
|
#endif
|
2006-01-22 23:57:30 -08:00
|
|
|
|
2006-09-30 03:18:37 -07:00
|
|
|
while (pdst < pdst_end)
|
2004-01-29 21:46:57 -08:00
|
|
|
{
|
2006-11-15 08:44:34 -08:00
|
|
|
#ifdef EVAS_SLI
|
|
|
|
if (((ysli) % dc->sli.h) == dc->sli.y)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
int ay;
|
2008-07-19 10:40:52 -07:00
|
|
|
|
2006-11-15 08:44:34 -08:00
|
|
|
sy = syy >> 16;
|
|
|
|
psrc = ps + (sy * src_w);
|
|
|
|
ay = 1 + ((syy - (sy << 16)) >> 8);
|
2006-09-30 03:18:37 -07:00
|
|
|
#ifdef SCALE_USING_MMX
|
2006-11-15 08:44:34 -08:00
|
|
|
MOV_A2R(ay, mm4)
|
|
|
|
pxor_r2r(mm0, mm0);
|
|
|
|
MOV_A2R(ALPHA_255, mm5)
|
2004-01-29 21:46:57 -08:00
|
|
|
#endif
|
2006-11-15 08:44:34 -08:00
|
|
|
pbuf = buf; pbuf_end = buf + dst_clip_w;
|
|
|
|
sxx = sxx0;
|
|
|
|
while (pbuf < pbuf_end)
|
|
|
|
{
|
|
|
|
int ax;
|
|
|
|
DATA32 *p, *q;
|
|
|
|
DATA32 p0, p1, p2, p3;
|
2008-07-19 10:40:52 -07:00
|
|
|
|
2006-11-15 08:44:34 -08:00
|
|
|
sx = sxx >> 16;
|
|
|
|
ax = 1 + ((sxx - (sx << 16)) >> 8);
|
|
|
|
p = psrc + sx; q = p + src_w;
|
|
|
|
p0 = p1 = p2 = p3 = *p;
|
|
|
|
if ((sx + 1) < srw)
|
|
|
|
p1 = *(p + 1);
|
|
|
|
if ((sy + 1) < srh)
|
|
|
|
{
|
|
|
|
p2 = *q; p3 = p2;
|
|
|
|
if ((sx + 1) < srw)
|
|
|
|
p3 = *(q + 1);
|
|
|
|
}
|
2006-09-30 03:18:37 -07:00
|
|
|
#ifdef SCALE_USING_MMX
|
2006-11-15 08:44:34 -08:00
|
|
|
MOV_A2R(ax, mm6)
|
|
|
|
MOV_P2R(p0, mm1, mm0)
|
|
|
|
if (p0 | p1)
|
|
|
|
{
|
|
|
|
MOV_P2R(p1, mm2, mm0)
|
|
|
|
INTERP_256_R2R(mm6, mm2, mm1, mm5)
|
|
|
|
}
|
|
|
|
MOV_P2R(p2, mm2, mm0)
|
|
|
|
if (p2 | p3)
|
|
|
|
{
|
|
|
|
MOV_P2R(p3, mm3, mm0)
|
|
|
|
INTERP_256_R2R(mm6, mm3, mm2, mm5)
|
|
|
|
}
|
|
|
|
INTERP_256_R2R(mm4, mm2, mm1, mm5)
|
|
|
|
MOV_R2P(mm1, *pbuf, mm0)
|
|
|
|
pbuf++;
|
2006-09-30 03:18:37 -07:00
|
|
|
#else
|
2006-11-15 08:44:34 -08:00
|
|
|
if (p0 | p1)
|
|
|
|
p0 = INTERP_256(ax, p1, p0);
|
|
|
|
if (p2 | p3)
|
|
|
|
p2 = INTERP_256(ax, p3, p2);
|
|
|
|
if (p0 | p2)
|
|
|
|
p0 = INTERP_256(ay, p2, p0);
|
|
|
|
*pbuf++ = p0;
|
2006-09-30 03:18:37 -07:00
|
|
|
#endif
|
2006-11-15 08:44:34 -08:00
|
|
|
sxx += dsxx;
|
|
|
|
}
|
|
|
|
/* * blend here [clip_w *] buf -> dptr * */
|
|
|
|
if (!direct_scale)
|
|
|
|
func(buf, NULL, dc->mul.col, pdst, dst_clip_w);
|
|
|
|
}
|
|
|
|
#ifdef EVAS_SLI
|
|
|
|
ysli++;
|
|
|
|
#endif
|
|
|
|
pdst += dst_w;
|
|
|
|
syy += dsyy;
|
|
|
|
buf += buf_step;
|
2006-09-30 03:18:37 -07:00
|
|
|
}
|
|
|
|
}
|
2005-12-03 01:27:53 -08:00
|
|
|
done_scale_up:
|
2006-11-13 15:23:44 -08:00
|
|
|
return;
|
2004-01-29 21:46:57 -08:00
|
|
|
}
|