forked from enlightenment/efl
handle if uv are out of image coords - clamp. remove unsued bounds checks
(not needed anymore). also fix a black edge. SVN revision: 43182
This commit is contained in:
parent
4953e0f5f6
commit
ceb6cb9600
|
@ -852,6 +852,7 @@ extern "C" {
|
||||||
EAPI Eina_Bool evas_object_map_enable_get (const Evas_Object *obj);
|
EAPI Eina_Bool evas_object_map_enable_get (const Evas_Object *obj);
|
||||||
EAPI void evas_object_map_set (Evas_Object *obj, const Evas_Map_Point *points);
|
EAPI void evas_object_map_set (Evas_Object *obj, const Evas_Map_Point *points);
|
||||||
EAPI void evas_object_map_get (const Evas_Object *obj, Evas_Map_Point *points);
|
EAPI void evas_object_map_get (const Evas_Object *obj, Evas_Map_Point *points);
|
||||||
|
|
||||||
EAPI Evas_Map_Point *evas_map_new (int num);
|
EAPI Evas_Map_Point *evas_map_new (int num);
|
||||||
EAPI void evas_map_free (Evas_Map_Point *mp);
|
EAPI void evas_map_free (Evas_Map_Point *mp);
|
||||||
EAPI void evas_map_point_coord_set (Evas_Map_Point *mp, int n, Evas_Coord x, Evas_Coord y, Evas_Coord z);
|
EAPI void evas_map_point_coord_set (Evas_Map_Point *mp, int n, Evas_Coord x, Evas_Coord y, Evas_Coord z);
|
||||||
|
|
|
@ -51,6 +51,7 @@ evas_common_map4_rgba(RGBA_Image *src, RGBA_Image *dst,
|
||||||
if (src->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
|
if (src->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
|
||||||
evas_cache_image_load_data(&src->cache_entry);
|
evas_cache_image_load_data(&src->cache_entry);
|
||||||
evas_common_image_colorspace_normalize(src);
|
evas_common_image_colorspace_normalize(src);
|
||||||
|
if (!src->image.data) return;
|
||||||
if (!dc->cutout.rects)
|
if (!dc->cutout.rects)
|
||||||
{
|
{
|
||||||
evas_common_map4_rgba_internal(src, dst, dc, p, smooth, level);
|
evas_common_map4_rgba_internal(src, dst, dc, p, smooth, level);
|
||||||
|
@ -146,6 +147,16 @@ evas_common_map4_rgba_internal(RGBA_Image *src, RGBA_Image *dst,
|
||||||
// all on one line. eg:
|
// all on one line. eg:
|
||||||
//
|
//
|
||||||
// |----------|
|
// |----------|
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (p[i].u < 0) p[i].u = 0;
|
||||||
|
else if (p[i].u > (src->cache_entry.w << FP))
|
||||||
|
p[i].u = src->cache_entry.w << FP;
|
||||||
|
|
||||||
|
if (p[i].v < 0) p[i].v = 0;
|
||||||
|
else if (p[i].v > (src->cache_entry.h << FP))
|
||||||
|
p[i].v = src->cache_entry.h << FP;
|
||||||
|
}
|
||||||
if ((PY(0) == PY(1)) && (PY(0) == PY(2)) && (PY(0) == PY(3)))
|
if ((PY(0) == PY(1)) && (PY(0) == PY(2)) && (PY(0) == PY(3)))
|
||||||
{
|
{
|
||||||
// FIXME:
|
// FIXME:
|
||||||
|
@ -229,6 +240,7 @@ evas_common_map4_rgba_internal(RGBA_Image *src, RGBA_Image *dst,
|
||||||
|
|
||||||
v = p[e2].v - p[e1].v;
|
v = p[e2].v - p[e1].v;
|
||||||
v = p[e1].v + ((v * t) / h);
|
v = p[e1].v + ((v * t) / h);
|
||||||
|
|
||||||
uv[i][1] = v;
|
uv[i][1] = v;
|
||||||
uv[i][0] = u;
|
uv[i][0] = u;
|
||||||
edge[i][2] = x >> FP;
|
edge[i][2] = x >> FP;
|
||||||
|
@ -417,6 +429,50 @@ evas_common_map4_rgba_internal(RGBA_Image *src, RGBA_Image *dst,
|
||||||
swp = sw << FP;
|
swp = sw << FP;
|
||||||
shp = src->cache_entry.h << FP;
|
shp = src->cache_entry.h << FP;
|
||||||
|
|
||||||
|
// if (smooth)
|
||||||
|
if (0)
|
||||||
|
{
|
||||||
|
for (y = ystart; y <= yend; y++)
|
||||||
|
{
|
||||||
|
int x, w, ww;
|
||||||
|
FPc u, v, ud, vd;
|
||||||
|
DATA32 *d, *dptr, *s;
|
||||||
|
yp = y - ystart;
|
||||||
|
|
||||||
|
for (i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
if (spans[yp].span[i].x1 >= 0)
|
||||||
|
{
|
||||||
|
x = spans[yp].span[i].x1;
|
||||||
|
w = (spans[yp].span[i].x2 - x);
|
||||||
|
|
||||||
|
if (w <= 0) continue;
|
||||||
|
ww = w;
|
||||||
|
d = buf;
|
||||||
|
u = spans[yp].span[i].u[0];
|
||||||
|
v = spans[yp].span[i].v[0];
|
||||||
|
ud = (spans[yp].span[i].u[1] - u) / w;
|
||||||
|
vd = (spans[yp].span[i].v[1] - v) / w;
|
||||||
|
if (ud < 0) u -= 1;
|
||||||
|
if (vd < 0) v -= 1;
|
||||||
|
while (ww > 0)
|
||||||
|
{
|
||||||
|
s = sp + ((v >> FP) * sw) + (u >> FP);
|
||||||
|
*d++ = *s;
|
||||||
|
u += ud;
|
||||||
|
v += vd;
|
||||||
|
ww--;
|
||||||
|
}
|
||||||
|
dptr = dst->image.data;
|
||||||
|
dptr += (y * dst->cache_entry.w) + x;
|
||||||
|
func(buf, NULL, dc->mul.col, dptr, w);
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (y = ystart; y <= yend; y++)
|
for (y = ystart; y <= yend; y++)
|
||||||
{
|
{
|
||||||
int x, w, ww;
|
int x, w, ww;
|
||||||
|
@ -442,15 +498,16 @@ evas_common_map4_rgba_internal(RGBA_Image *src, RGBA_Image *dst,
|
||||||
// printf(" %3i[%3i,%3i] - %3i[%3i,%3i] |",
|
// printf(" %3i[%3i,%3i] - %3i[%3i,%3i] |",
|
||||||
// x, u >> FP, v >> FP,
|
// x, u >> FP, v >> FP,
|
||||||
// x + w,
|
// x + w,
|
||||||
// spans[yp].span[i].u[1] >> FP, spans[yp].span[i].v[1] >> FP);
|
// spans[yp].span[i].u[1] >> FP,
|
||||||
|
// spans[yp].span[i].v[1] >> FP);
|
||||||
|
if (ud < 0) u -= 1;
|
||||||
|
if (vd < 0) v -= 1;
|
||||||
while (ww > 0)
|
while (ww > 0)
|
||||||
{
|
{
|
||||||
s = sp + ((v >> FP) * sw) + (u >> FP);
|
s = sp + ((v >> FP) * sw) + (u >> FP);
|
||||||
*d++ = *s;
|
*d++ = *s;
|
||||||
u += ud;
|
u += ud;
|
||||||
v += vd;
|
v += vd;
|
||||||
if (u >= swp) u = swp - 1;
|
|
||||||
if (v >= shp) v = shp - 1;
|
|
||||||
ww--;
|
ww--;
|
||||||
}
|
}
|
||||||
dptr = dst->image.data;
|
dptr = dst->image.data;
|
||||||
|
@ -462,3 +519,4 @@ evas_common_map4_rgba_internal(RGBA_Image *src, RGBA_Image *dst,
|
||||||
// printf("\n");
|
// printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue