From 6ac8adcd80e7ca99528bde98142df1f7e3b87292 Mon Sep 17 00:00:00 2001 From: raster Date: Tue, 4 Nov 2008 09:19:35 +0000 Subject: [PATCH] hmmm after some talking - for now put the transform patch on hold - we need tyo fix up some of these breaks first and there isn't a lot of time devoted to this. so revert this. it's in svn history so we can dig it out any time we like. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@37453 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Evas.h | 3 - src/lib/canvas/Makefile.am | 6 +- src/lib/canvas/evas_object_gradient2.c | 66 +- src/lib/canvas/evas_object_gradient2.h | 67 - src/lib/canvas/evas_object_gradient2_linear.c | 96 +- src/lib/canvas/evas_object_gradient2_radial.c | 96 +- src/lib/canvas/evas_object_image.c | 405 ++- src/lib/canvas/evas_object_image.h | 58 - src/lib/canvas/evas_transform.c | 89 +- src/lib/engines/common/Makefile.am | 13 +- src/lib/engines/common/evas_convert_rgb_16.c | 1231 ++++---- src/lib/engines/common/evas_convert_yuv.c | 92 +- src/lib/engines/common/evas_gradient.h | 25 +- src/lib/engines/common/evas_gradient2_linear.c | 161 +- src/lib/engines/common/evas_gradient2_main.c | 248 +- src/lib/engines/common/evas_gradient2_radial.c | 149 +- src/lib/engines/common/evas_image.h | 4 - src/lib/engines/common/evas_image_draw.c | 241 -- src/lib/engines/common/evas_image_fill_main.c | 60 +- src/lib/engines/common/evas_image_fill_pad.c | 10 - src/lib/engines/common/evas_image_fill_reflect.c | 1476 --------- src/lib/engines/common/evas_image_fill_repeat.c | 3083 ------------------- src/lib/engines/common/evas_image_fill_restrict.c | 3149 -------------------- src/lib/engines/common/evas_image_private.h | 17 - .../common/evas_op_mul/op_mul_mask_color_i386.c | 4 +- src/lib/engines/common/evas_pipe.c | 121 +- src/lib/engines/common/evas_pipe.h | 6 +- src/lib/engines/common/evas_transform.c | 61 - src/lib/engines/common/evas_transform.h | 7 - src/lib/include/evas_common.h | 31 +- src/lib/include/evas_private.h | 11 +- src/modules/engines/gl_x11/evas_engine.c | 73 +- src/modules/engines/software_generic/evas_engine.c | 322 +- src/modules/engines/xrender_x11/evas_engine.c | 71 +- 34 files changed, 1861 insertions(+), 9691 deletions(-) delete mode 100644 src/lib/canvas/evas_object_gradient2.h delete mode 100644 src/lib/canvas/evas_object_image.h delete mode 100644 src/lib/engines/common/evas_image_draw.c delete mode 100644 src/lib/engines/common/evas_image_fill_pad.c delete mode 100644 src/lib/engines/common/evas_image_fill_reflect.c delete mode 100644 src/lib/engines/common/evas_image_fill_repeat.c delete mode 100644 src/lib/engines/common/evas_image_fill_restrict.c delete mode 100644 src/lib/engines/common/evas_transform.c delete mode 100755 src/lib/engines/common/evas_transform.h diff --git a/src/lib/Evas.h b/src/lib/Evas.h index 0e09e8f..15dd255 100644 --- a/src/lib/Evas.h +++ b/src/lib/Evas.h @@ -916,9 +916,6 @@ extern "C" { EAPI void evas_transform_shear (float sh, float sv, Evas_Transform *t); /* Left-multiply t by the given transform l */ EAPI void evas_transform_compose (Evas_Transform *l, Evas_Transform *t); - /* Get bounds of an affine transformation of a given rect */ - /* Note: this will use the inverse of the given transform */ - EAPI void evas_transform_affine_rect_bounds_get (Evas_Transform *t, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Coord *rx, Evas_Coord *ry, Evas_Coord *rw, Evas_Coord *rh); /* Evas imaging api - exports some of the comon gfx engine routines */ /* this is not complete and should be considered experimental. use at your */ diff --git a/src/lib/canvas/Makefile.am b/src/lib/canvas/Makefile.am index 43274cc..a1834b7 100644 --- a/src/lib/canvas/Makefile.am +++ b/src/lib/canvas/Makefile.am @@ -24,8 +24,6 @@ evas_main.c \ evas_name.c \ evas_object_gradient.c \ evas_object_gradient2.c \ -evas_object_gradient2_linear.c \ -evas_object_gradient2_radial.c \ evas_object_image.c \ evas_object_main.c \ evas_object_inform.c \ @@ -48,7 +46,7 @@ evas_async_events.c \ evas_transform.c EXTRA_DIST = \ -evas_object_gradient2.h \ -evas_object_image.h +evas_object_gradient2_linear.c \ +evas_object_gradient2_radial.c libevas_canvas_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/src/lib/canvas/evas_object_gradient2.c b/src/lib/canvas/evas_object_gradient2.c index 0c530da..f9e6265 100644 --- a/src/lib/canvas/evas_object_gradient2.c +++ b/src/lib/canvas/evas_object_gradient2.c @@ -1,6 +1,24 @@ #include "evas_common.h" #include "evas_private.h" -#include "evas_object_gradient2.h" + +typedef struct _Evas_Object_Gradient2 Evas_Object_Gradient2; + +struct _Evas_Object_Gradient2 +{ + DATA32 magic; + + struct { + struct { + Evas_Common_Transform transform; + int spread; + } fill; + unsigned char gradient_opaque : 1; + } cur, prev; + + unsigned char gradient_changed : 1; +}; + + /** * @defgroup Evas_Object_Gradient2_Group Gradient2 Object Functions @@ -33,6 +51,7 @@ EAPI void evas_object_gradient2_color_np_stop_insert(Evas_Object *obj, int r, int g, int b, int a, float pos) { Evas_Object_Gradient2 *og; + void *engine_data; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; @@ -41,9 +60,10 @@ evas_object_gradient2_color_np_stop_insert(Evas_Object *obj, int r, int g, int b MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); - if (og->engine_data) + engine_data = obj->func->engine_data_get(obj); + if (engine_data) obj->layer->evas->engine.func->gradient2_color_np_stop_insert(obj->layer->evas->engine.data.output, - og, + engine_data, r, g, b, a, pos); og->gradient_changed = 1; evas_object_change(obj); @@ -57,6 +77,7 @@ EAPI void evas_object_gradient2_clear(Evas_Object *obj) { Evas_Object_Gradient2 *og; + void *engine_data; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; @@ -65,9 +86,10 @@ evas_object_gradient2_clear(Evas_Object *obj) MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT); return; MAGIC_CHECK_END(); - if (og->engine_data) + engine_data = obj->func->engine_data_get(obj); + if (engine_data) obj->layer->evas->engine.func->gradient2_clear(obj->layer->evas->engine.data.output, - og); + engine_data); og->gradient_changed = 1; og->cur.gradient_opaque = 0; evas_object_change(obj); @@ -146,16 +168,16 @@ evas_object_gradient2_fill_transform_set (Evas_Object *obj, Evas_Transform *t) evas_object_change(obj); return; } - if ( (og->cur.fill.transform.mxx == t->mxx) && - (og->cur.fill.transform.mxy == t->mxy) && - (og->cur.fill.transform.mxz == t->mxz) && - (og->cur.fill.transform.myx == t->myx) && - (og->cur.fill.transform.myy == t->myy) && - (og->cur.fill.transform.myz == t->myz) && - (og->cur.fill.transform.mzx == t->mzx) && - (og->cur.fill.transform.mzy == t->mzy) && - (og->cur.fill.transform.mzz == t->mzz) ) - return; + if ( (og->cur.fill.transform.mxx == t->mxx) || + (og->cur.fill.transform.mxy == t->mxy) || + (og->cur.fill.transform.mxy == t->mxy) || + (og->cur.fill.transform.mxy == t->mxy) || + (og->cur.fill.transform.mxy == t->mxy) || + (og->cur.fill.transform.mxy == t->mxy) || + (og->cur.fill.transform.mxy == t->mxy) || + (og->cur.fill.transform.mxy == t->mxy) || + (og->cur.fill.transform.mxy == t->mxy) ) + return; og->cur.fill.transform.mxx = t->mxx; og->cur.fill.transform.mxy = t->mxy; @@ -167,11 +189,6 @@ evas_object_gradient2_fill_transform_set (Evas_Object *obj, Evas_Transform *t) og->cur.fill.transform.mzy = t->mzy; og->cur.fill.transform.mzz = t->mzz; - og->cur.fill.transform.is_identity = 0; - if ( (t->mxx == 1) && (t->mxy == 0) && (t->mxz == 0) && - (t->myx == 0) && (t->myy == 1) && (t->myz == 0) && - (t->mzx == 0) && (t->mzy == 0) && (t->mzz == 1) ) - og->cur.fill.transform.is_identity = 1; og->gradient_changed = 1; evas_object_change(obj); } @@ -201,3 +218,12 @@ evas_object_gradient2_fill_transform_get (const Evas_Object *obj, Evas_Transform t->mzz = og->cur.fill.transform.mzz; } } + + + +/** + * @} + */ + +#include "evas_object_gradient2_linear.c" +#include "evas_object_gradient2_radial.c" diff --git a/src/lib/canvas/evas_object_gradient2.h b/src/lib/canvas/evas_object_gradient2.h deleted file mode 100644 index 5f60b3b..0000000 --- a/src/lib/canvas/evas_object_gradient2.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef EVAS_OBJECT_GRADIENT2_H -#define EVAS_OBJECT_GRADIENT2_H - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -/* private struct for base gradient object internal data */ -typedef struct _Evas_Object_Gradient2 Evas_Object_Gradient2; - -struct _Evas_Object_Gradient2 -{ - DATA32 magic; - - void *engine_data; - - struct { - struct { - Evas_Common_Transform transform; - int spread; - } fill; - unsigned char gradient_opaque : 1; - } cur, prev; - - unsigned char gradient_changed : 1; -}; - - -/* private struct for linear gradient object internal data */ -typedef struct _Evas_Object_Gradient2_Linear Evas_Object_Gradient2_Linear; - -struct _Evas_Object_Gradient2_Linear -{ - Evas_Object_Gradient2 base; - - DATA32 magic; - - struct { - struct { - float x0, y0, x1, y1; - } fill; - } cur, prev; - - unsigned char gradient_changed : 1; - unsigned char changed : 1; -}; - -/* private struct for radial gradient object internal data */ -typedef struct _Evas_Object_Gradient2_Radial Evas_Object_Gradient2_Radial; - -struct _Evas_Object_Gradient2_Radial -{ - Evas_Object_Gradient2 base; - - DATA32 magic; - - struct { - struct { - float cx, cy, rx, ry; - } fill; - } cur, prev; - - unsigned char gradient_changed : 1; - unsigned char changed : 1; -}; - -#endif diff --git a/src/lib/canvas/evas_object_gradient2_linear.c b/src/lib/canvas/evas_object_gradient2_linear.c index 85e5223..78feae9 100644 --- a/src/lib/canvas/evas_object_gradient2_linear.c +++ b/src/lib/canvas/evas_object_gradient2_linear.c @@ -1,10 +1,30 @@ #include "evas_common.h" #include "evas_private.h" -#include "evas_object_gradient2.h" /* private magic number for linear gradient objects */ static const char lg_type[] = "linear_gradient"; +/* private struct for gradient object internal data */ +typedef struct _Evas_Object_Gradient2_Linear Evas_Object_Gradient2_Linear; + +struct _Evas_Object_Gradient2_Linear +{ + Evas_Object_Gradient2 base; + + DATA32 magic; + + struct { + struct { + float x0, y0, x1, y1; + } fill; + } cur, prev; + + void *engine_data; + + unsigned char gradient_changed : 1; + unsigned char changed : 1; +}; + /* private methods for linear gradient objects */ static void evas_object_gradient2_linear_init(Evas_Object *obj); static void *evas_object_gradient2_linear_new(void); @@ -69,7 +89,7 @@ evas_object_gradient2_linear_add(Evas *e) evas_object_inject(obj, e); if (obj->object_data) { - Evas_Object_Gradient2 *o = (Evas_Object_Gradient2 *)(obj->object_data); + Evas_Object_Gradient2_Linear *o = (Evas_Object_Gradient2_Linear *)(obj->object_data); o->engine_data = e->engine.func->gradient2_linear_new(e->engine.data.output); } @@ -206,7 +226,6 @@ static void evas_object_gradient2_linear_free(Evas_Object *obj) { Evas_Object_Gradient2_Linear *o; - Evas_Object_Gradient2 *og; /* frees private object data. very simple here */ o = (Evas_Object_Gradient2_Linear *)(obj->object_data); @@ -214,10 +233,9 @@ evas_object_gradient2_linear_free(Evas_Object *obj) return; MAGIC_CHECK_END(); /* free obj */ - og = (Evas_Object_Gradient2 *)o; - if (og->engine_data) + if (o->engine_data) obj->layer->evas->engine.func->gradient2_linear_free(obj->layer->evas->engine.data.output, - og->engine_data); + o->engine_data); free(o); obj->object_data = NULL; } @@ -231,20 +249,18 @@ evas_object_gradient2_linear_render(Evas_Object *obj, void *output, void *contex /* render object to surface with context, and offxet by x,y */ o = (Evas_Object_Gradient2_Linear *)(obj->object_data); - obj->layer->evas->engine.func->context_multiplier_set(output, context, - obj->cur.cache.clip.r, obj->cur.cache.clip.g, - obj->cur.cache.clip.b, obj->cur.cache.clip.a); + obj->layer->evas->engine.func->context_multiplier_unset(output, context); obj->layer->evas->engine.func->context_anti_alias_set(output, context, obj->cur.anti_alias); obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur.render_op); - obj->layer->evas->engine.func->context_color_interpolation_set(output, context, - obj->cur.interpolation_color_space); - if (o) + if (o->engine_data) + { obj->layer->evas->engine.func->gradient2_linear_draw(output, context, surface, - o, + o->engine_data, obj->cur.geometry.x + x, obj->cur.geometry.y + y, obj->cur.geometry.w, obj->cur.geometry.h); + } } static void @@ -287,9 +303,11 @@ evas_object_gradient2_linear_render_pre(Evas_Object *obj) { o->gradient_changed = 1; o->changed = 1; } if (!o->changed && (obj->cur.render_op != obj->prev.render_op)) o->changed = 1; +// if (!o->changed && (obj->cur.anti_alias != obj->prev.anti_alias)) +// o->changed = 1; if (og->gradient_changed) { o->gradient_changed = 1; o->changed = 1; } - if (o->changed && og->engine_data) + if (o->changed && o->engine_data) { obj->layer->evas->engine.func->context_render_op_set(obj->layer->evas->engine.data.output, obj->layer->evas->engine.data.context, obj->cur.render_op); @@ -301,15 +319,24 @@ evas_object_gradient2_linear_render_pre(Evas_Object *obj) obj->layer->evas->engine.data.context, obj->cur.interpolation_color_space); if (o->gradient_changed) + { + obj->layer->evas->engine.func->gradient2_linear_fill_set(obj->layer->evas->engine.data.output, o->engine_data, o->cur.fill.x0, o->cur.fill.y0, o->cur.fill.x1, o->cur.fill.y1); + obj->layer->evas->engine.func->gradient2_fill_transform_set(obj->layer->evas->engine.data.output, o->engine_data, + &og->cur.fill.transform); + obj->layer->evas->engine.func->gradient2_fill_spread_set(obj->layer->evas->engine.data.output, o->engine_data, + og->cur.fill.spread); obj->layer->evas->engine.func->gradient2_linear_render_pre(obj->layer->evas->engine.data.output, obj->layer->evas->engine.data.context, - o); + o->engine_data); + } og->cur.gradient_opaque = obj->layer->evas->engine.func->gradient2_linear_is_opaque(obj->layer->evas->engine.data.output, obj->layer->evas->engine.data.context, - o, + o->engine_data, obj->cur.cache.clip.x, obj->cur.cache.clip.y, obj->cur.cache.clip.w, obj->cur.cache.clip.h); + if (obj->cur.cache.clip.a != 255) + og->cur.gradient_opaque = 0; } /* now figure what changed and add draw rects */ @@ -344,12 +371,13 @@ evas_object_gradient2_linear_render_pre(Evas_Object *obj) /* area so if there were updates for it they get wiped. don't do it if we */ /* arent fully opaque and we are visible */ - if (evas_object_is_visible(obj) && evas_object_is_opaque(obj)) - obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output, - obj->cur.cache.clip.x, - obj->cur.cache.clip.y, - obj->cur.cache.clip.w, - obj->cur.cache.clip.h); + if (evas_object_is_visible(obj) && + evas_object_is_opaque(obj)) + obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output, + obj->cur.cache.clip.x, + obj->cur.cache.clip.y, + obj->cur.cache.clip.w, + obj->cur.cache.clip.h); done: evas_object_render_pre_effect_updates(&rects, obj, is_v, was_v); @@ -405,9 +433,9 @@ static unsigned int evas_object_gradient2_linear_visual_id_get(Evas_Object *obj) static void *evas_object_gradient2_linear_engine_data_get(Evas_Object *obj) { - Evas_Object_Gradient2 *o; + Evas_Object_Gradient2_Linear *o; - o = (Evas_Object_Gradient2 *)(obj->object_data); + o = (Evas_Object_Gradient2_Linear *)(obj->object_data); if (!o) return NULL; return o->engine_data; } @@ -416,23 +444,27 @@ static void *evas_object_gradient2_linear_engine_data_get(Evas_Object *obj) static int evas_object_gradient2_linear_is_opaque(Evas_Object *obj) { - Evas_Object_Gradient2 *o; + Evas_Object_Gradient2_Linear *o; + Evas_Object_Gradient2 *og; /* this returns 1 if the internal object data implies that the object is */ /* currently fully opaque over the entire region it occupies */ - o = (Evas_Object_Gradient2 *)(obj->object_data); - if (!o || !o->engine_data) return 0; - return o->cur.gradient_opaque; + o = (Evas_Object_Gradient2_Linear *)(obj->object_data); + if (!o->engine_data) return 0; + og = (Evas_Object_Gradient2 *)(o); + return og->cur.gradient_opaque; } static int evas_object_gradient2_linear_was_opaque(Evas_Object *obj) { - Evas_Object_Gradient2 *o; + Evas_Object_Gradient2_Linear *o; + Evas_Object_Gradient2 *og; /* this returns 1 if the internal object data implies that the object was */ /* currently fully opaque over the entire region it occupies */ - o = (Evas_Object_Gradient2 *)(obj->object_data); - if (!o || !o->engine_data) return 0; - return o->prev.gradient_opaque; + o = (Evas_Object_Gradient2_Linear *)(obj->object_data); + if (!o->engine_data) return 0; + og = (Evas_Object_Gradient2 *)(o); + return og->prev.gradient_opaque; } diff --git a/src/lib/canvas/evas_object_gradient2_radial.c b/src/lib/canvas/evas_object_gradient2_radial.c index 773cbf8..2d4e3bd 100644 --- a/src/lib/canvas/evas_object_gradient2_radial.c +++ b/src/lib/canvas/evas_object_gradient2_radial.c @@ -1,10 +1,30 @@ #include "evas_common.h" #include "evas_private.h" -#include "evas_object_gradient2.h" /* private magic number for radial gradient objects */ static const char rg_type[] = "radial_gradient"; +/* private struct for gradient object internal data */ +typedef struct _Evas_Object_Gradient2_Radial Evas_Object_Gradient2_Radial; + +struct _Evas_Object_Gradient2_Radial +{ + Evas_Object_Gradient2 base; + + DATA32 magic; + + struct { + struct { + float cx, cy, rx, ry; + } fill; + } cur, prev; + + void *engine_data; + + unsigned char gradient_changed : 1; + unsigned char changed : 1; +}; + /* private methods for radial gradient objects */ static void evas_object_gradient2_radial_init(Evas_Object *obj); static void *evas_object_gradient2_radial_new(void); @@ -69,7 +89,7 @@ evas_object_gradient2_radial_add(Evas *e) evas_object_inject(obj, e); if (obj->object_data) { - Evas_Object_Gradient2 *o = (Evas_Object_Gradient2 *)(obj->object_data); + Evas_Object_Gradient2_Radial *o = (Evas_Object_Gradient2_Radial *)(obj->object_data); o->engine_data = e->engine.func->gradient2_radial_new(e->engine.data.output); } @@ -205,7 +225,6 @@ static void evas_object_gradient2_radial_free(Evas_Object *obj) { Evas_Object_Gradient2_Radial *o; - Evas_Object_Gradient2 *og; /* frees private object data. very simple here */ o = (Evas_Object_Gradient2_Radial *)(obj->object_data); @@ -213,10 +232,9 @@ evas_object_gradient2_radial_free(Evas_Object *obj) return; MAGIC_CHECK_END(); /* free obj */ - og = (Evas_Object_Gradient2 *)o; - if (og->engine_data) + if (o->engine_data) obj->layer->evas->engine.func->gradient2_radial_free(obj->layer->evas->engine.data.output, - og->engine_data); + o->engine_data); free(o); obj->object_data = NULL; } @@ -230,20 +248,18 @@ evas_object_gradient2_radial_render(Evas_Object *obj, void *output, void *contex /* render object to surface with context, and offxet by x,y */ o = (Evas_Object_Gradient2_Radial *)(obj->object_data); - obj->layer->evas->engine.func->context_multiplier_set(output, context, - obj->cur.cache.clip.r, obj->cur.cache.clip.g, - obj->cur.cache.clip.b, obj->cur.cache.clip.a); + obj->layer->evas->engine.func->context_multiplier_unset(output, context); obj->layer->evas->engine.func->context_anti_alias_set(output, context, obj->cur.anti_alias); obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur.render_op); - obj->layer->evas->engine.func->context_color_interpolation_set(output, context, - obj->cur.interpolation_color_space); - if (o) + if (o->engine_data) + { obj->layer->evas->engine.func->gradient2_radial_draw(output, context, surface, - o, + o->engine_data, obj->cur.geometry.x + x, obj->cur.geometry.y + y, obj->cur.geometry.w, obj->cur.geometry.h); + } } static void @@ -286,9 +302,11 @@ evas_object_gradient2_radial_render_pre(Evas_Object *obj) { o->gradient_changed = 1; o->changed = 1; } if (!o->changed && (obj->cur.render_op != obj->prev.render_op)) o->changed = 1; +// if (!o->changed && (obj->cur.anti_alias != obj->prev.anti_alias)) +// o->changed = 1; if (og->gradient_changed) { o->gradient_changed = 1; o->changed = 1; } - if (o->changed && og->engine_data) + if (o->changed && o->engine_data) { obj->layer->evas->engine.func->context_render_op_set(obj->layer->evas->engine.data.output, obj->layer->evas->engine.data.context, obj->cur.render_op); @@ -300,15 +318,24 @@ evas_object_gradient2_radial_render_pre(Evas_Object *obj) obj->layer->evas->engine.data.context, obj->cur.interpolation_color_space); if (o->gradient_changed) + { + obj->layer->evas->engine.func->gradient2_radial_fill_set(obj->layer->evas->engine.data.output, o->engine_data, o->cur.fill.cx, o->cur.fill.cy, o->cur.fill.rx, o->cur.fill.ry); + obj->layer->evas->engine.func->gradient2_fill_transform_set(obj->layer->evas->engine.data.output, o->engine_data, + &og->cur.fill.transform); + obj->layer->evas->engine.func->gradient2_fill_spread_set(obj->layer->evas->engine.data.output, o->engine_data, + og->cur.fill.spread); obj->layer->evas->engine.func->gradient2_radial_render_pre(obj->layer->evas->engine.data.output, obj->layer->evas->engine.data.context, - o); + o->engine_data); + } og->cur.gradient_opaque = obj->layer->evas->engine.func->gradient2_radial_is_opaque(obj->layer->evas->engine.data.output, obj->layer->evas->engine.data.context, - o, + o->engine_data, obj->cur.cache.clip.x, obj->cur.cache.clip.y, obj->cur.cache.clip.w, obj->cur.cache.clip.h); + if (obj->cur.cache.clip.a != 255) + og->cur.gradient_opaque = 0; } /* now figure what changed and add draw rects */ /* if it just became visible or invisible */ @@ -342,12 +369,13 @@ evas_object_gradient2_radial_render_pre(Evas_Object *obj) /* area so if there were updates for it they get wiped. don't do it if we */ /* arent fully opaque and we are visible */ - if (evas_object_is_visible(obj) && evas_object_is_opaque(obj)) - obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output, - obj->cur.cache.clip.x, - obj->cur.cache.clip.y, - obj->cur.cache.clip.w, - obj->cur.cache.clip.h); + if (evas_object_is_visible(obj) && + evas_object_is_opaque(obj)) + obj->layer->evas->engine.func->output_redraws_rect_del(obj->layer->evas->engine.data.output, + obj->cur.cache.clip.x, + obj->cur.cache.clip.y, + obj->cur.cache.clip.w, + obj->cur.cache.clip.h); done: evas_object_render_pre_effect_updates(&rects, obj, is_v, was_v); @@ -403,9 +431,9 @@ static unsigned int evas_object_gradient2_radial_visual_id_get(Evas_Object *obj) static void *evas_object_gradient2_radial_engine_data_get(Evas_Object *obj) { - Evas_Object_Gradient2 *o; + Evas_Object_Gradient2_Radial *o; - o = (Evas_Object_Gradient2 *)(obj->object_data); + o = (Evas_Object_Gradient2_Radial *)(obj->object_data); if (!o) return NULL; return o->engine_data; } @@ -414,23 +442,27 @@ static void *evas_object_gradient2_radial_engine_data_get(Evas_Object *obj) static int evas_object_gradient2_radial_is_opaque(Evas_Object *obj) { - Evas_Object_Gradient2 *o; + Evas_Object_Gradient2_Radial *o; + Evas_Object_Gradient2 *og; /* this returns 1 if the internal object data implies that the object is */ /* currently fully opaque over the entire region it occupies */ - o = (Evas_Object_Gradient2 *)(obj->object_data); - if (!o || !o->engine_data) return 0; - return o->cur.gradient_opaque; + o = (Evas_Object_Gradient2_Radial *)(obj->object_data); + if (!o->engine_data) return 0; + og = (Evas_Object_Gradient2 *)(o); + return og->cur.gradient_opaque; } static int evas_object_gradient2_radial_was_opaque(Evas_Object *obj) { - Evas_Object_Gradient2 *o; + Evas_Object_Gradient2_Radial *o; + Evas_Object_Gradient2 *og; /* this returns 1 if the internal object data implies that the object was */ /* currently fully opaque over the entire region it occupies */ - o = (Evas_Object_Gradient2 *)(obj->object_data); - if (!o || !o->engine_data) return 0; - return o->prev.gradient_opaque; + o = (Evas_Object_Gradient2_Radial *)(obj->object_data); + if (!o->engine_data) return 0; + og = (Evas_Object_Gradient2 *)(o); + return og->prev.gradient_opaque; } diff --git a/src/lib/canvas/evas_object_image.c b/src/lib/canvas/evas_object_image.c index e7d9f3d..d0b9eef 100644 --- a/src/lib/canvas/evas_object_image.c +++ b/src/lib/canvas/evas_object_image.c @@ -7,15 +7,63 @@ #include "../engines/common/evas_convert_color.h" #include "../engines/common/evas_convert_colorspace.h" #include "../engines/common/evas_convert_yuv.h" -#include "evas_object_image.h" - + /* private magic number for image objects */ static const char o_type[] = "image"; +/* private struct for rectangle object internal data */ +typedef struct _Evas_Object_Image Evas_Object_Image; + +struct _Evas_Object_Image +{ + DATA32 magic; + + struct { + Evas_Common_Transform transform; + int spread; + Evas_Coord_Rectangle fill; + struct { + short w, h, stride; + } image; + struct { + short l, r, t, b; + unsigned char fill; + } border; + + const char *file; + const char *key; + int cspace; + + unsigned char smooth_scale : 1; + unsigned char has_alpha :1; + } cur, prev; + + int pixels_checked_out; + int load_error; + Eina_List *pixel_updates; + + struct { + unsigned char scale_down_by; + double dpi; + short w, h; + } load_opts; + + struct { + void (*get_pixels) (void *data, Evas_Object *o); + void *get_pixels_data; + } func; + + void *engine_data; + + unsigned char changed : 1; + unsigned char dirty_pixels : 1; +}; /* private methods for image objects */ static void evas_object_image_unload(Evas_Object *obj); static void evas_object_image_load(Evas_Object *obj); +static Evas_Coord evas_object_image_figure_x_fill(Evas_Object *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret); +static Evas_Coord evas_object_image_figure_y_fill(Evas_Object *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret); static void evas_object_image_init(Evas_Object *obj); static void *evas_object_image_new(void); @@ -382,10 +430,10 @@ evas_object_image_border_center_fill_set(Evas_Object *obj, Evas_Bool fill) MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return; MAGIC_CHECK_END(); - if (((o->cur.border.center_fill) && (fill)) || - ((!o->cur.border.center_fill) && (!fill))) + if (((o->cur.border.fill) && (fill)) || + ((!o->cur.border.fill) && (!fill))) return; - o->cur.border.center_fill = fill; + o->cur.border.fill = fill; o->changed = 1; evas_object_change(obj); } @@ -411,7 +459,7 @@ evas_object_image_border_center_fill_get(const Evas_Object *obj) MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return 0; MAGIC_CHECK_END(); - return o->cur.border.center_fill; + return o->cur.border.fill; } /** @@ -517,8 +565,8 @@ evas_object_image_fill_spread_set(Evas_Object *obj, int spread) MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return; MAGIC_CHECK_END(); - if (spread == o->cur.fill.spread) return; - o->cur.fill.spread = spread; + if (spread == o->cur.spread) return; + o->cur.spread = spread; o->changed = 1; evas_object_change(obj); } @@ -540,7 +588,7 @@ evas_object_image_fill_spread_get(const Evas_Object *obj) MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return EVAS_TEXTURE_REPEAT; MAGIC_CHECK_END(); - return o->cur.fill.spread; + return o->cur.spread; } EAPI void @@ -557,45 +605,41 @@ evas_object_image_fill_transform_set (Evas_Object *obj, Evas_Transform *t) MAGIC_CHECK_END(); if (!t) { - o->cur.fill.transform.mxx = 1; - o->cur.fill.transform.mxy = 0; - o->cur.fill.transform.mxz = 0; - o->cur.fill.transform.myx = 0; - o->cur.fill.transform.myy = 1; - o->cur.fill.transform.myz = 0; - o->cur.fill.transform.mzx = 0; - o->cur.fill.transform.mzy = 0; - o->cur.fill.transform.mzz = 1; - o->cur.fill.transform.is_identity = 1; + o->cur.transform.mxx = 1; + o->cur.transform.mxy = 0; + o->cur.transform.mxz = 0; + o->cur.transform.myx = 0; + o->cur.transform.myy = 1; + o->cur.transform.myz = 0; + o->cur.transform.mzx = 0; + o->cur.transform.mzy = 0; + o->cur.transform.mzz = 1; + o->changed = 1; evas_object_change(obj); return; } - if ( (o->cur.fill.transform.mxx == t->mxx) && - (o->cur.fill.transform.mxy == t->mxy) && - (o->cur.fill.transform.mxz == t->mxz) && - (o->cur.fill.transform.myx == t->myx) && - (o->cur.fill.transform.myy == t->myy) && - (o->cur.fill.transform.myz == t->myz) && - (o->cur.fill.transform.mzx == t->mzx) && - (o->cur.fill.transform.mzy == t->mzy) && - (o->cur.fill.transform.mzz == t->mzz) ) - return; - - o->cur.fill.transform.mxx = t->mxx; - o->cur.fill.transform.mxy = t->mxy; - o->cur.fill.transform.mxz = t->mxz; - o->cur.fill.transform.myx = t->myx; - o->cur.fill.transform.myy = t->myy; - o->cur.fill.transform.myz = t->myz; - o->cur.fill.transform.mzx = t->mzx; - o->cur.fill.transform.mzy = t->mzy; - o->cur.fill.transform.mzz = t->mzz; - o->cur.fill.transform.is_identity = 0; - if ( (t->mxx == 1) && (t->mxy == 0) && (t->mxz == 0) && - (t->myx == 0) && (t->myy == 1) && (t->myz == 0) && - (t->mzx == 0) && (t->mzy == 0) && (t->mzz == 1) ) - o->cur.fill.transform.is_identity = 1; + if ( (o->cur.transform.mxx == t->mxx) || + (o->cur.transform.mxy == t->mxy) || + (o->cur.transform.mxy == t->mxy) || + (o->cur.transform.mxy == t->mxy) || + (o->cur.transform.mxy == t->mxy) || + (o->cur.transform.mxy == t->mxy) || + (o->cur.transform.mxy == t->mxy) || + (o->cur.transform.mxy == t->mxy) || + (o->cur.transform.mxy == t->mxy) ) + return; + + o->cur.transform.mxx = t->mxx; + o->cur.transform.mxy = t->mxy; + o->cur.transform.mxz = t->mxz; + o->cur.transform.myx = t->myx; + o->cur.transform.myy = t->myy; + o->cur.transform.myz = t->myz; + o->cur.transform.mzx = t->mzx; + o->cur.transform.mzy = t->mzy; + o->cur.transform.mzz = t->mzz; + o->changed = 1; evas_object_change(obj); } @@ -614,15 +658,15 @@ evas_object_image_fill_transform_get (const Evas_Object *obj, Evas_Transform *t) MAGIC_CHECK_END(); if (t) { - t->mxx = o->cur.fill.transform.mxx; - t->mxy = o->cur.fill.transform.mxy; - t->mxz = o->cur.fill.transform.mxz; - t->myx = o->cur.fill.transform.myx; - t->myy = o->cur.fill.transform.myy; - t->myz = o->cur.fill.transform.myz; - t->mzx = o->cur.fill.transform.mzx; - t->mzy = o->cur.fill.transform.mzy; - t->mzz = o->cur.fill.transform.mzz; + t->mxx = o->cur.transform.mxx; + t->mxy = o->cur.transform.mxy; + t->mxz = o->cur.transform.mxz; + t->myx = o->cur.transform.myx; + t->myy = o->cur.transform.myy; + t->myz = o->cur.transform.myz; + t->mzx = o->cur.transform.mzx; + t->mzy = o->cur.transform.mzy; + t->mzz = o->cur.transform.mzz; } } @@ -1827,6 +1871,50 @@ evas_object_image_load(Evas_Object *obj) } } +static Evas_Coord +evas_object_image_figure_x_fill(Evas_Object *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret) +{ + Evas_Coord w; + + w = ((size * obj->layer->evas->output.w) / + (Evas_Coord)obj->layer->evas->viewport.w); + if (size <= 0) size = 1; + if (start > 0) + { + while (start - size > 0) start -= size; + } + else if (start < 0) + { + while (start < 0) start += size; + } + start = ((start * obj->layer->evas->output.w) / + (Evas_Coord)obj->layer->evas->viewport.w); + *size_ret = w; + return start; +} + +static Evas_Coord +evas_object_image_figure_y_fill(Evas_Object *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret) +{ + Evas_Coord h; + + h = ((size * obj->layer->evas->output.h) / + (Evas_Coord)obj->layer->evas->viewport.h); + if (size <= 0) size = 1; + if (start > 0) + { + while (start - size > 0) start -= size; + } + else if (start < 0) + { + while (start < 0) start += size; + } + start = ((start * obj->layer->evas->output.h) / + (Evas_Coord)obj->layer->evas->viewport.h); + *size_ret = h; + return start; +} + static void evas_object_image_init(Evas_Object *obj) { @@ -1862,11 +1950,10 @@ evas_object_image_new(void) o->cur.fill.w = 1; o->cur.fill.h = 1; o->cur.smooth_scale = 1; - o->cur.border.center_fill = 1; + o->cur.border.fill = 1; o->cur.cspace = EVAS_COLORSPACE_ARGB8888; - o->cur.fill.transform.mxx = o->cur.fill.transform.myy = o->cur.fill.transform.mzz = 1; - o->cur.fill.transform.is_identity = 1; - o->cur.fill.spread = EVAS_TEXTURE_REPEAT; + o->cur.transform.mxx = o->cur.transform.myy = o->cur.transform.mzz = 1; + o->cur.spread = EVAS_TEXTURE_REPEAT; o->prev = o->cur; return o; } @@ -1929,10 +2016,6 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur.render_op); -/* - obj->layer->evas->engine.func->context_anti_alias_set(output, context, - obj->cur.anti_alias); -*/ if (o->engine_data) { Evas_Coord idw, idh, idx, idy; @@ -1947,11 +2030,152 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su } o->dirty_pixels = 0; } - obj->layer->evas->engine.func->image_draw(output, context, surface, o, - obj->cur.geometry.x + x, - obj->cur.geometry.y + y, - obj->cur.geometry.w, - obj->cur.geometry.h); + o->engine_data = obj->layer->evas->engine.func->image_border_set(output, o->engine_data, + o->cur.border.l, o->cur.border.r, + o->cur.border.t, o->cur.border.b); + idx = evas_object_image_figure_x_fill(obj, o->cur.fill.x, o->cur.fill.w, &idw); + idy = evas_object_image_figure_y_fill(obj, o->cur.fill.y, o->cur.fill.h, &idh); + if (idw < 1.0) idw = 1.0; + if (idh < 1.0) idh = 1.0; + if (idx > 0.0) idx -= idw; + if (idy > 0.0) idy -= idh; + while ((int)idx < obj->cur.geometry.w) + { + Evas_Coord ydy; + int dobreak_w = 0; + + ydy = idy; + ix = idx; + if ((o->cur.fill.w == obj->cur.geometry.w) && + (o->cur.fill.x == 0.0)) + { + dobreak_w = 1; + iw = obj->cur.geometry.w; + } + else + iw = ((int)(idx + idw)) - ix; + while ((int)idy < obj->cur.geometry.h) + { + int dobreak_h = 0; + + iy = idy; + if ((o->cur.fill.h == obj->cur.geometry.h) && + (o->cur.fill.y == 0.0)) + { + ih = obj->cur.geometry.h; + dobreak_h = 1; + } + else + ih = ((int)(idy + idh)) - iy; + if ((o->cur.border.l == 0) && + (o->cur.border.r == 0) && + (o->cur.border.t == 0) && + (o->cur.border.b == 0) && + (o->cur.border.fill != 0)) + obj->layer->evas->engine.func->image_draw(output, + context, + surface, + o->engine_data, + 0, 0, + o->cur.image.w, + o->cur.image.h, + obj->cur.geometry.x + ix + x, + obj->cur.geometry.y + iy + y, + iw, ih, + o->cur.smooth_scale); + else + { + int inx, iny, inw, inh, outx, outy, outw, outh; + int bl, br, bt, bb; + int imw, imh, ox, oy; + + ox = obj->cur.geometry.x + ix + x; + oy = obj->cur.geometry.y + iy + y; + imw = o->cur.image.w; + imh = o->cur.image.h; + bl = o->cur.border.l; + br = o->cur.border.r; + bt = o->cur.border.t; + bb = o->cur.border.b; + if ((bl + br) > iw) + { + bl = iw / 2; + br = iw - bl; + } + if ((bl + br) > imw) + { + bl = imw / 2; + br = imw - bl; + } + if ((bt + bb) > ih) + { + bt = ih / 2; + bb = ih - bt; + } + if ((bt + bb) > imh) + { + bt = imh / 2; + bb = imh - bt; + } + + inx = 0; iny = 0; + inw = bl; inh = bt; + outx = ox; outy = oy; + outw = bl; outh = bt; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + inx = bl; iny = 0; + inw = imw - bl - br; inh = bt; + outx = ox + bl; outy = oy; + outw = iw - bl - br; outh = bt; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + inx = imw - br; iny = 0; + inw = br; inh = bt; + outx = ox + iw - br; outy = oy; + outw = br; outh = bt; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + + inx = 0; iny = bt; + inw = bl; inh = imh - bt - bb; + outx = ox; outy = oy + bt; + outw = bl; outh = ih - bt - bb; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + if (o->cur.border.fill) + { + inx = bl; iny = bt; + inw = imw - bl - br; inh = imh - bt - bb; + outx = ox + bl; outy = oy + bt; + outw = iw - bl - br; outh = ih - bt - bb; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + } + inx = imw - br; iny = bt; + inw = br; inh = imh - bt - bb; + outx = ox + iw - br; outy = oy + bt; + outw = br; outh = ih - bt - bb; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + + inx = 0; iny = imh - bb; + inw = bl; inh = bb; + outx = ox; outy = oy + ih - bb; + outw = bl; outh = bb; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + inx = bl; iny = imh - bb; + inw = imw - bl - br; inh = bb; + outx = ox + bl; outy = oy + ih - bb; + outw = iw - bl - br; outh = bb; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + inx = imw - br; iny = imh - bb; + inw = br; inh = bb; + outx = ox + iw - br; outy = oy + ih - bb; + outw = br; outh = bb; + obj->layer->evas->engine.func->image_draw(output, context, surface, o->engine_data, inx, iny, inw, inh, outx, outy, outw, outh, o->cur.smooth_scale); + } + idy += idh; + if (dobreak_h) break; + } + idx += idw; + idy = ydy; + if (dobreak_w) break; + } } } @@ -2013,13 +2237,11 @@ evas_object_image_render_pre(Evas_Object *obj) if (!o->pixel_updates) goto done; } /* if it changed anti_alias */ -/* if (obj->cur.anti_alias != obj->prev.anti_alias) { evas_object_render_pre_prev_cur_add(&rects, obj); if (!o->pixel_updates) goto done; } -*/ if (o->changed) { if (((o->cur.file) && (!o->prev.file)) || @@ -2048,21 +2270,6 @@ evas_object_image_render_pre(Evas_Object *obj) evas_object_render_pre_prev_cur_add(&rects, obj); if (!o->pixel_updates) goto done; } - if (o->cur.fill.spread != o->prev.fill.spread) - { - evas_object_render_pre_prev_cur_add(&rects, obj); - if (!o->pixel_updates) goto done; - } - if ( (o->cur.fill.transform.mxx != o->prev.fill.transform.mxx) || - (o->cur.fill.transform.mxy != o->prev.fill.transform.mxy) || - (o->cur.fill.transform.mxz != o->prev.fill.transform.mxz) || - (o->cur.fill.transform.myx != o->prev.fill.transform.myx) || - (o->cur.fill.transform.myy != o->prev.fill.transform.myy) || - (o->cur.fill.transform.myz != o->prev.fill.transform.myz) ) - { - evas_object_render_pre_prev_cur_add(&rects, obj); - if (!o->pixel_updates) goto done; - } if (o->dirty_pixels) { evas_object_render_pre_prev_cur_add(&rects, obj); @@ -2072,8 +2279,7 @@ evas_object_image_render_pre(Evas_Object *obj) /* if it changed geometry - and obviously not visibility or color */ /* caluclate differences since we have a constant color fill */ /* we really only need to update the differences */ - if ( o->cur.fill.transform.is_identity && o->prev.fill.transform.is_identity && - ((obj->cur.geometry.x != obj->prev.geometry.x) || + if (((obj->cur.geometry.x != obj->prev.geometry.x) || (obj->cur.geometry.y != obj->prev.geometry.y) || (obj->cur.geometry.w != obj->prev.geometry.w) || (obj->cur.geometry.h != obj->prev.geometry.h)) && @@ -2129,10 +2335,8 @@ evas_object_image_render_pre(Evas_Object *obj) o->pixel_updates = eina_list_remove(o->pixel_updates, rr); obj->layer->evas->engine.func->image_dirty_region(obj->layer->evas->engine.data.output, o->engine_data, rr->x, rr->y, rr->w, rr->h); - idx = o->cur.fill.x; - idw = o->cur.fill.w; - idy = o->cur.fill.y; - idh = o->cur.fill.h; + idx = evas_object_image_figure_x_fill(obj, o->cur.fill.x, o->cur.fill.w, &idw); + idy = evas_object_image_figure_y_fill(obj, o->cur.fill.y, o->cur.fill.h, &idh); if (idw < 1) idw = 1; if (idh < 1) idh = 1; @@ -2198,10 +2402,6 @@ evas_object_image_render_pre(Evas_Object *obj) obj->cur.cache.clip.h); done: evas_object_render_pre_effect_updates(&rects, obj, is_v, was_v); - if (o->changed) - obj->layer->evas->engine.func->image_render_pre(obj->layer->evas->engine.data.output, - obj->layer->evas->engine.data.context, - o); } static void @@ -2272,17 +2472,16 @@ evas_object_image_is_opaque(Evas_Object *obj) /* this returns 1 if the internal object data implies that the object is */ /* currently fully opaque over the entire rectangle it occupies */ o = (Evas_Object_Image *)(obj->object_data); - if (obj->cur.render_op != EVAS_RENDER_BLEND) - return 0; if (((o->cur.border.l != 0) || (o->cur.border.r != 0) || (o->cur.border.t != 0) || (o->cur.border.b != 0)) && - (!o->cur.border.center_fill)) return 0; + (!o->cur.border.fill)) return 0; if (!o->engine_data) return 0; + if (obj->cur.render_op == EVAS_RENDER_COPY) + return 1; if (o->cur.has_alpha) return 0; - if ((o->cur.fill.spread == EVAS_TEXTURE_RESTRICT) && - ((!o->cur.fill.transform.is_identity) || (o->cur.fill.x != 0) || (o->cur.fill.y != 0))) + if (obj->cur.render_op != EVAS_RENDER_BLEND) return 0; return 1; } @@ -2295,22 +2494,20 @@ evas_object_image_was_opaque(Evas_Object *obj) /* this returns 1 if the internal object data implies that the object was */ /* previously fully opaque over the entire rectangle it occupies */ o = (Evas_Object_Image *)(obj->object_data); - if (obj->prev.render_op != EVAS_RENDER_BLEND) - return 0; if (((o->prev.border.l != 0) || (o->prev.border.r != 0) || (o->prev.border.t != 0) || (o->prev.border.b != 0)) && - (!o->prev.border.center_fill)) return 0; + (!o->prev.border.fill)) return 0; if (!o->engine_data) return 0; + if (obj->prev.render_op == EVAS_RENDER_COPY) + return 1; if (o->prev.has_alpha) return 0; - if ((o->prev.fill.spread == EVAS_TEXTURE_RESTRICT) && - ((!o->prev.fill.transform.is_identity) || (o->prev.fill.x != 0) || (o->prev.fill.y != 0))) + if (obj->prev.render_op != EVAS_RENDER_BLEND) return 0; return 1; } -/* FIXME: Need to consider the spread = restrict case and transforms */ static int evas_object_image_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y) { diff --git a/src/lib/canvas/evas_object_image.h b/src/lib/canvas/evas_object_image.h deleted file mode 100644 index 5ed3d96..0000000 --- a/src/lib/canvas/evas_object_image.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef EVAS_OBJECT_IMAGE_H -#define EVAS_OBJECT_IMAGE_H - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -/* private struct for image object internal data */ -typedef struct _Evas_Object_Image Evas_Object_Image; - -struct _Evas_Object_Image -{ - DATA32 magic; - - struct { - struct { - Evas_Common_Transform transform; - int spread; - int x, y, w, h; - } fill; - struct { - short w, h, stride; - } image; - struct { - short l, r, t, b; - unsigned char center_fill; - } border; - - const char *file; - const char *key; - int cspace; - - unsigned char smooth_scale : 1; - unsigned char has_alpha :1; - } cur, prev; - - int pixels_checked_out; - int load_error; - Evas_List *pixel_updates; - - struct { - unsigned char scale_down_by; - double dpi; - short w, h; - } load_opts; - - struct { - void (*get_pixels) (void *data, Evas_Object *o); - void *get_pixels_data; - } func; - - void *engine_data; - - unsigned char changed : 1; - unsigned char dirty_pixels : 1; -}; - -#endif diff --git a/src/lib/canvas/evas_transform.c b/src/lib/canvas/evas_transform.c index babf911..f5d0f41 100644 --- a/src/lib/canvas/evas_transform.c +++ b/src/lib/canvas/evas_transform.c @@ -22,9 +22,8 @@ evas_transform_rotate(double angle, Evas_Transform *t) float myx, myy, myz; if (!t) return; - if (angle == 0) return; - angle = (-angle * M_PI) / 180.0; + angle = (angle * M_PI) / 180.0; ca = cos(angle); sa = sin(angle); if ((ca == 1) && (sa == 0)) return; @@ -46,13 +45,13 @@ evas_transform_translate(float dx, float dy, Evas_Transform *t) if (!t) return; if (!dx && !dy) return; - t->mxx += dx * t->mzx; - t->mxy += dx * t->mzy; - t->mxz += dx * t->mzz; + t->mxx = dx * t->mzx; + t->mxy = dx * t->mzy; + t->mxz = dx * t->mzz; - t->myx += dy * t->mzx; - t->myy += dy * t->mzy; - t->myz += dy * t->mzz; + t->myx = dy * t->mzx; + t->myy = dy * t->mzy; + t->myz = dy * t->mzz; } EAPI void @@ -116,77 +115,3 @@ evas_transform_compose(Evas_Transform *l, Evas_Transform *t) t->mzy = (l->mzx * mxy) + (l->mzy * myy) + (l->mzz * mzy); t->mzz = (l->mzx * mxz) + (l->mzy * myz) + (l->mzz * mzz); } - -EAPI void -evas_transform_affine_rect_bounds_get(Evas_Transform *t, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Coord *rx, Evas_Coord *ry, Evas_Coord *rw, Evas_Coord *rh) -{ - double d; - int axx, axy, ayx, ayy; - - if (!t) return; - if ( (t->mxx == 1) && (t->myy == 1) && - (t->mxy == 0) && (t->myx == 0) && - (t->mxz == 0) && (t->myz == 0) ) - { - if (rx) *rx = x; - if (ry) *ry = y; - if (rw) *rw = w; - if (rh) *rh = h; - return; - } - d = (t->mxx * (double)t->myy) - (t->mxy * (double)t->myx); - if (fabs(d) < 0.000030517578125) - { - if (rx) *rx = 0; - if (ry) *ry = 0; - if (rw) *rw = 0; - if (rh) *rh = 0; - return; - } - d = 1.0 / d; - axx = d * t->myy * 65536; ayy = d * t->mxx * 65536; - axy = -d * t->mxy * 65536; ayx = -d * t->myx * 65536; - - if (rx || rh) - { - int z, x0, x1 = x0 = (axx * x) + (axy * y); - - z = (axx * (x + w)) + (axy * y); - if (z < x0) x0 = z; - if (z > x1) x1 = z; - z = (axx * x) + (axy * (y + h)); - if (z < x0) x0 = z; - if (z > x1) x1 = z; - z = (axx * (x + w)) + (axy * (y + h)); - if (z < x0) x0 = z; - if (z > x1) x1 = z; - if (rx) - { - z = x0 - (((axx * (t->mxz - 0.5)) + (axy * (t->myz - 0.5)))) - 32768; - *rx = z >> 16; - } - if (rw) - *rw = ((x1 + 0xffff) >> 16) - ((x0 - 0xffff) >> 16); // kludgy, but... - } - if (rx || rh) - { - int z, y0, y1 = y0 = (ayx * x) + (ayy * y); - - z = (ayx * (x + w)) + (ayy * y); - if (z < y0) y0 = z; - if (z > y1) y1 = z; - z = (ayx * x) + (ayy * (y + h)); - if (z < y0) y0 = z; - if (z > y1) y1 = z; - z = (ayx * (x + w)) + (ayy * (y + h)); - if (z < y0) y0 = z; - if (z > y1) y1 = z; - if (ry) - { - z = y0 - ((ayx * (t->mxz - 0.5)) + (ayy * (t->myz - 0.5))) - 32768; - *ry = z >> 16; - } - if (rh) - *rh = ((y1 + 0xffff) >> 16) - ((y0 - 0xffff) >> 16); // kludgy, but... - } -} diff --git a/src/lib/engines/common/Makefile.am b/src/lib/engines/common/Makefile.am index d26d77b..b76c667 100644 --- a/src/lib/engines/common/Makefile.am +++ b/src/lib/engines/common/Makefile.am @@ -6,7 +6,6 @@ MAINTAINERCLEANFILES = Makefile.in AM_CPPFLAGS = -I. \ -I$(top_srcdir)/src/lib \ -I$(top_srcdir)/src/lib/include \ - -I$(top_srcdir)/src/lib/canvas \ -DPACKAGE_BIN_DIR=\"$(bindir)\" \ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ @@ -54,8 +53,6 @@ evas_image_load.c \ evas_image_save.c \ evas_image_main.c \ evas_image_data.c \ -evas_image_fill_main.c \ -evas_image_draw.c \ evas_line_main.c \ evas_polygon_main.c \ evas_rectangle_main.c \ @@ -65,8 +62,7 @@ evas_scale_smooth.c \ evas_scale_span.c \ evas_tiler.c \ evas_regionbuf.c \ -evas_pipe.c \ -evas_transform.c +evas_pipe.c EXTRA_DIST = \ evas_blend.h \ @@ -100,13 +96,8 @@ evas_scale_smooth_scaler_downx_downy.c \ evas_scale_smooth_scaler_downy.c \ evas_scale_smooth_scaler_noscale.c \ evas_scale_smooth_scaler_up.c \ -evas_image_fill_restrict.c \ -evas_image_fill_repeat.c \ -evas_image_fill_reflect.c \ -evas_image_fill_pad.c \ evas_scale_span.h \ -evas_pipe.h \ -evas_transform.h +evas_pipe.h libevas_engine_common_la_DEPENDENCIES = \ $(top_builddir)/config.h diff --git a/src/lib/engines/common/evas_convert_rgb_16.c b/src/lib/engines/common/evas_convert_rgb_16.c index bc7f258..844fe38 100644 --- a/src/lib/engines/common/evas_convert_rgb_16.c +++ b/src/lib/engines/common/evas_convert_rgb_16.c @@ -14,97 +14,138 @@ extern const DATA8 _evas_dither_128128[128][128]; #endif #endif - -#define DITHER_TWO_RGB_565 \ - dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK]; \ - dith2 = dith >> DM_SHF(6); \ - dith >>= DM_SHF(5); \ - r1 = (p & 0xff0000) >> 19; \ - g1 = (p & 0xff00) >> 10; \ - b1 = (p & 0xff) >> 3; \ - if ((r1 < 0x1f) && ((((p & 0xff0000) >> 16) - (r1 << 3)) >= dith )) r1++; \ - if ((g1 < 0x3f) && ((((p & 0xff00) >> 8) - (g1 << 2)) >= dith2)) g1++; \ - if ((b1 < 0x1f) && (((p & 0xff) - (b1 << 3)) >= dith )) b1++; \ - \ - x++; \ - dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK]; \ - dith2 = dith >> DM_SHF(6); \ - dith >>= DM_SHF(5); \ - r2 = (q & 0xff0000) >> 19; \ - g2 = (q & 0xff00) >> 10; \ - b2 = (q & 0xff) >> 3; \ - if ((r2 < 0x1f) && ((((q & 0xff0000) >> 16) - (r2 << 3)) >= dith )) r2++; \ - if ((g2 < 0x3f) && ((((q & 0xff00) >> 8) - (g2 << 2)) >= dith2)) g2++; \ - if ((b2 < 0x1f) && (((q & 0xff) - (b2 << 3)) >= dith )) b2++; - - -#define DITHER_ONE_RGB_565 \ - dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK]; \ - dith2 = dith >> DM_SHF(6); \ - dith >>= DM_SHF(5); \ - r = (p & 0xff0000) >> 19; \ - g = (p & 0xff00) >> 10; \ - b = (p & 0xff) >> 3; \ - if ((r < 0x1f) && ((((p & 0xff0000) >> 16) - (r << 3)) >= dith )) r++; \ - if ((g < 0x3f) && ((((p & 0xff00) >> 8) - (g << 2)) >= dith2)) g++; \ - if ((b < 0x1f) && (((p & 0xff) - (b << 3)) >= dith )) b++; - - -#ifndef WORDS_BIGENDIAN -#define RGB_565_JOIN_TWO(r1,g1,b1,r2,g2,b2) \ - (((r2) << 27) | ((g2) << 21) | ((b2) << 16) | ((r1) << 11) | ((g1) << 5) | (b1)) -#define BGR_565_JOIN_TWO(r1,g1,b1,r2,g2,b2) \ - (((b2) << 27) | ((g2) << 21) | ((r2) << 16) | ((b1) << 11) | ((g1) << 5) | (r1)) -#else -#define RGB_565_JOIN_TWO(r1,g1,b1,r2,g2,b2) \ - (((r1) << 27) | ((g1) << 21) | ((b1) << 16) | ((r2) << 11) | ((g2) << 5) | (b2)) -#define BGR_565_JOIN_TWO(r1,g1,b1,r2,g2,b2) \ - (((b1) << 27) | ((g1) << 21) | ((r1) << 16) | ((b2) << 11) | ((g2) << 5) | (r2)) -#endif - - #ifdef BUILD_CONVERT_16_RGB_565 #ifdef BUILD_CONVERT_16_RGB_ROT0 void evas_common_convert_rgba2_to_16bpp_rgb_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { #ifndef BUILD_NO_DITHER_MASK - DATA32 *s = src; DATA16 *d = (DATA16 *)dst; int r1, g1, b1; int r2, g2, b2; int dith, dith2; int x, y; +#ifdef BUILD_LINE_DITHER_MASK for (y = 0; y < h; y++) { - for (x = 0; x < w; x++) + if ((y + dith_y) & 0x1) { - DATA32 p = *s++, q = *s++; + for (x = 0; x < w; x+=2) + { + DATA32 p = *src++, q = *src++; + r1 = ((p & 0xff0000) + 0x030000) >> 19; + if (r1 > 0x1f) r1 = 0x1f; + g1 = ((p & 0xff00) + 0x000100) >> 10; + if (g1 > 0x3f) g1 = 0x3f; + b1 = ((p & 0xff) + 0x000003) >> 3; + if (b1 > 0x1f) b1 = 0x1f; + r2 = ((q & 0xff0000) + 0x030000) >> 19; + if (r2 > 0x1f) r2 = 0x1f; + g2 = ((q & 0xff00) + 0x000100) >> 10; + if (g2 > 0x3f) g2 = 0x3f; + b2 = ((q & 0xff) + 0x000003) >> 3; + if (b2 > 0x1f) b2 = 0x1f; +#ifndef WORDS_BIGENDIAN + *((DATA32 *)d) = (r2 << 27) | (g2 << 21) | (b2 << 16) | + (r1 << 11) | (g1 << 5) | (b1); +#else + *((DATA32 *)d) = (r1 << 27) | (g1 << 21) | (b1 << 16) | + (r2 << 11) | (g2 << 5) | (b2); +#endif + d += 2; + } + } + else + { + x = w; + while (w > 0) + { + DATA32 p = *src++, q = *src++; - DITHER_TWO_RGB_565 - *((DATA32 *)d) = RGB_565_JOIN_TWO(r1,g1,b1,r2,g2,b2); +#ifndef WORDS_BIGENDIAN + *((DATA32 *)d) = + (((q & 0xff0000) >> 19) << 27) | (((q & 0xff00) >> 10) << 21) | (((q & 0xff) >> 3) << 16) | + (((p & 0xff0000) >> 19) << 11) | (((p & 0xff00) >> 10) << 5) | ((p & 0xff) >> 3); +#else + *((DATA32 *)d) = + (((p & 0xff0000) >> 19) << 27) | (((p & 0xff00) >> 10) << 21) | (((p & 0xff) >> 3) << 16) | + (((q & 0xff0000) >> 19) << 11) | (((q & 0xff00) >> 10) << 5) | ((q & 0xff) >> 3); +#endif + d += 2; w -= 2; + } + w = x; + } + src += src_jump; + d += dst_jump; + } +#else + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + DATA32 p = *src++, q = *src++; + + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK]; + dith2 = dith >> DM_SHF(6); + dith >>= DM_SHF(5); + r1 = (p & 0xff0000) >> 19; + g1 = (p & 0xff00) >> 10; + b1 = (p & 0xff) >> 3; + if ((r1 < 0x1f) && ((((p & 0xff0000) >> 16) - (r1 << 3)) >= dith )) r1++; + if ((g1 < 0x3f) && ((((p & 0xff00) >> 8) - (g1 << 2)) >= dith2)) g1++; + if ((b1 < 0x1f) && (((p & 0xff) - (b1 << 3)) >= dith )) b1++; + + x++; + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK]; + dith2 = dith >> DM_SHF(6); + dith >>= DM_SHF(5); + r2 = (q & 0xff0000) >> 19; + g2 = (q & 0xff00) >> 10; + b2 = (q & 0xff) >> 3; + if ((r2 < 0x1f) && ((((q & 0xff0000) >> 16) - (r2 << 3)) >= dith )) r2++; + if ((g2 < 0x3f) && ((((q & 0xff00) >> 8) - (g2 << 2)) >= dith2)) g2++; + if ((b2 < 0x1f) && (((q & 0xff) - (b2 << 3)) >= dith )) b2++; + +#ifndef WORDS_BIGENDIAN + *((DATA32 *)d) = (r2 << 27) | (g2 << 21) | (b2 << 16) | + (r1 << 11) | (g1 << 5) | (b1); +#else + *((DATA32 *)d) = (r1 << 27) | (g1 << 21) | (b1 << 16) | + (r2 << 11) | (g2 << 5) | (b2); +#endif d += 2; } - s += src_jump; d += dst_jump; + src += src_jump; + d += dst_jump; } +#endif return; pal = 0; #else - DATA32 *s = src; DATA16 *d = (DATA16 *)dst; - int x, y; + int w0 = w; - for (y = 0; y < h; y++) + while (h--) { - for (x = 0; x < w; x += 2) + while (w > 0) { - DATA32 p = *s++, q = *s++; + DATA32 p = *src++, q = *src++; - *((DATA32 *)d) = RGB_565_JOIN_TWO((p & 0xff0000) >> 19, (p & 0xff00) >> 10, (p & 0xff) >> 3, (q & 0xff0000) >> 19, (q & 0xff00) >> 10, (q & 0xff) >> 3); - d += 2; - } - s += src_jump; d += dst_jump; +#ifndef WORDS_BIGENDIAN + *((DATA32 *)d) = + (((q & 0xff0000) >> 19) << 27) | (((q & 0xff00) >> 10) << 21) | (((q & 0xff) >> 3) << 16) | + (((p & 0xff0000) >> 19) << 11) | (((p & 0xff00) >> 10) << 5) | ((p & 0xff) >> 3); +#else + *((DATA32 *)d) = + (((p & 0xff0000) >> 19) << 27) | (((p & 0xff00) >> 10) << 21) | (((p & 0xff) >> 3) << 16) | + (((q & 0xff0000) >> 19) << 11) | (((q & 0xff00) >> 10) << 5) | ((q & 0xff) >> 3); +#endif + d += 2; w -= 2; + } + w = w0; + src += src_jump; + d += dst_jump; } return; pal = 0; @@ -119,38 +160,81 @@ void evas_common_convert_rgba_to_16bpp_rgb_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { #ifndef BUILD_NO_DITHER_MASK - DATA32 *s = src; DATA16 *d = (DATA16 *)dst; int r, g, b; int dith, dith2; int x, y; +#ifdef BUILD_LINE_DITHER_MASK + for (y = 0; y < h; y++) + { + if ((y + dith_y) & 0x1) + { + for (x = 0; x < w; x++) + { + DATA32 p = *src++; + + r = (p & 0xff0000) >> 19; + if (r > 0x1f) r = 0x1f; + g = (p & 0xff00) >> 10; + if (g > 0x3f) g = 0x3f; + b = (p & 0xff) >> 3; + if (b > 0x1f) b = 0x1f; + *d++ = (r << 11) | (g << 5) | b; + } + } + else + { + x = w; + while (w--) + { + *d++ = (((*src & 0xff0000) >> 19) << 11) | (((*src & 0xff00) >> 10) << 5) | ((*src & 0xff) >> 3); + src++; + } + w = x; + } + src += src_jump; + d += dst_jump; + } +#else for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - DATA32 p = *s++; + DATA32 p = *src++; + + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK]; + dith2 = dith >> DM_SHF(6); + dith >>= DM_SHF(5); + r = (p & 0xff0000) >> 19; + g = (p & 0xff00) >> 10; + b = (p & 0xff) >> 3; + if ((r < 0x1f) && ((((p & 0xff0000) >> 16) - (r << 3)) >= dith )) r++; + if ((g < 0x3f) && ((((p & 0xff00) >> 8) - (g << 2)) >= dith2)) g++; + if ((b < 0x1f) && (((p & 0xff) - (b << 3)) >= dith )) b++; - DITHER_ONE_RGB_565 *d++ = (r << 11) | (g << 5) | b; } - s += src_jump; d += dst_jump; + src += src_jump; + d += dst_jump; } +#endif return; pal = 0; #else - DATA32 *s = src; DATA16 *d = (DATA16 *)dst; - int x, y; + int w0 = w; - for (y = 0; y < h; y++) + while (h--) { - for (x = 0; x < w; x++) + while (w--) { - *d++ = (((*s & 0xff0000) >> 19) << 11) | (((*s & 0xff00) >> 10) << 5) | ((*s & 0xff) >> 3); - s++; - } - s += src_jump; d += dst_jump; + *d++ = (((*src & 0xff0000) >> 19) << 11) | (((*src & 0xff00) >> 10) << 5) | ((*src & 0xff) >> 3); + src++; + } + w = w0; + src += src_jump; + d += dst_jump; } return; pal = 0; @@ -164,51 +248,58 @@ evas_common_convert_rgba_to_16bpp_rgb_565_dith (DATA32 *src, DATA8 *dst, int src void evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r1, g1, b1; - int r2, g2, b2; - int dith, dith2; + DATA8 r1, g1, b1; + DATA8 r2, g2, b2; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s--, q = *s--; + dst_ptr = (DATA16 *)dst; - DITHER_TWO_RGB_565 - *((DATA32 *)d) = RGB_565_JOIN_TWO(r1,g1,b1,r2,g2,b2); - d += 2; - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP2_START_ROT_180(); - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x += 2) - { - DATA32 p = *s--, q = *s--; + r1 = (R_VAL(src_ptr)) >> 3; + g1 = (G_VAL(src_ptr)) >> 2; + b1 = (B_VAL(src_ptr)) >> 3; - *((DATA32 *)d) = RGB_565_JOIN_TWO((p & 0xff0000) >> 19, (p & 0xff00) >> 10, (p & 0xff) >> 3, (q & 0xff0000) >> 19, (q & 0xff00) >> 10, (q & 0xff) >> 3); - d += 2; - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++; + if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++; + if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++; +#endif + + CONVERT_LOOP2_INC_ROT_180(); + + r2 = (R_VAL(src_ptr)) >> 3; + g2 = (G_VAL(src_ptr)) >> 2; + b2 = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++; + if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++; + if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++; +#endif + +#ifndef WORDS_BIGENDIAN + *((DATA32 *)dst_ptr) = + (r2 << 27) | (g2 << 21) | (b2 << 16) | + (r1 << 11) | (g1 << 5 ) | (b1 ); +#else + *((DATA32 *)dst_ptr) = + (r1 << 27) | (g1 << 21) | (b1 << 16) | + (r2 << 11) | (g2 << 5 ) | (b2 ); +#endif + + CONVERT_LOOP2_END_ROT_180(); return; pal = 0; -#endif } #endif #endif @@ -218,47 +309,35 @@ evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_180 (DATA32 *src, DATA8 *dst void evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r, g, b; - int dith, dith2; + DATA8 r, g, b; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s--; + dst_ptr = (DATA16 *)dst; - DITHER_ONE_RGB_565 - *d++ = (r << 11) | (g << 5) | (b); - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP_START_ROT_180(); - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - *d++ = (((*s & 0xff0000) >> 19) << 11) | (((*s & 0xff00) >> 10) << 5) | ((*s & 0xff) >> 3); - s--; - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } + r = (R_VAL(src_ptr)) >> 3; + g = (G_VAL(src_ptr)) >> 2; + b = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++; + if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++; + if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++; +#endif + + *dst_ptr = (r << 11) | (g << 5) | (b); + + CONVERT_LOOP_END_ROT_180(); return; pal = 0; -#endif } #endif #endif @@ -268,53 +347,58 @@ evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_180 (DATA32 *src, DATA8 *dst, void evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r1, g1, b1; - int r2, g2, b2; - int dith, dith2; + DATA8 r1, g1, b1; + DATA8 r2, g2, b2; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + ((w - 1) * (h + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s, q = *(s -= (h + src_jump)); + dst_ptr = (DATA16 *)dst; - DITHER_TWO_RGB_565 - *((DATA32 *)d) = RGB_565_JOIN_TWO(r1,g1,b1,r2,g2,b2); - d += 2; - s -= (h + src_jump); - } - s = src + ((w - 1) * (h + src_jump)) + (y + 1); - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP2_START_ROT_270(); - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x += 2) - { - DATA32 p = *s, q = *(s -= (h + src_jump)); + r1 = (R_VAL(src_ptr)) >> 3; + g1 = (G_VAL(src_ptr)) >> 2; + b1 = (B_VAL(src_ptr)) >> 3; - *((DATA32 *)d) = RGB_565_JOIN_TWO((p & 0xff0000) >> 19, (p & 0xff00) >> 10, (p & 0xff) >> 3, (q & 0xff0000) >> 19, (q & 0xff00) >> 10, (q & 0xff) >> 3); - d += 2; - s -= (h + src_jump); - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++; + if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++; + if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++; +#endif + + CONVERT_LOOP2_INC_ROT_270(); + + r2 = (R_VAL(src_ptr)) >> 3; + g2 = (G_VAL(src_ptr)) >> 2; + b2 = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++; + if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++; + if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++; +#endif + +#ifndef WORDS_BIGENDIAN + *((DATA32 *)dst_ptr) = + (r2 << 27) | (g2 << 21) | (b2 << 16) | + (r1 << 11) | (g1 << 5 ) | (b1 ); +#else + *((DATA32 *)dst_ptr) = + (r1 << 27) | (g1 << 21) | (b1 << 16) | + (r2 << 11) | (g2 << 5 ) | (b2 ); +#endif + + CONVERT_LOOP2_END_ROT_270(); return; pal = 0; -#endif } #endif #endif @@ -324,48 +408,35 @@ evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_270 (DATA32 *src, DATA8 *dst void evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r, g, b; - int dith, dith2; + DATA8 r, g, b; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + ((w - 1) * (h + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s; + dst_ptr = (DATA16 *)dst; - DITHER_ONE_RGB_565 - *d++ = (r << 11) | (g << 5) | (b); - s -= (h + src_jump); - } - s = src + ((w - 1) * (h + src_jump)) + (y + 1); - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP_START_ROT_270(); - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - *d++ = (((*s & 0xff0000) >> 19) << 11) | (((*s & 0xff00) >> 10) << 5) | ((*s & 0xff) >> 3); - s -= (h + src_jump); - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } + r = (R_VAL(src_ptr)) >> 3; + g = (G_VAL(src_ptr)) >> 2; + b = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++; + if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++; + if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++; +#endif + + *dst_ptr = (r << 11) | (g << 5) | (b); + + CONVERT_LOOP_END_ROT_270(); return; pal = 0; -#endif } #endif #endif @@ -375,53 +446,58 @@ evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_270 (DATA32 *src, DATA8 *dst, void evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r1, g1, b1; - int r2, g2, b2; - int dith, dith2; + DATA8 r1, g1, b1; + DATA8 r2, g2, b2; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + (h - 1); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s, q = *(s += (h + src_jump)); + dst_ptr = (DATA16 *)dst; - DITHER_TWO_RGB_565 - *((DATA32 *)d) = RGB_565_JOIN_TWO(r1,g1,b1,r2,g2,b2); - d += 2; - s += (h + src_jump); - } - s = src + (h - 1) - y - 1; - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP2_START_ROT_90(); - s = src + (h - 1); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x += 2) - { - DATA32 p = *s, q = *(s += (h + src_jump)); + r1 = (R_VAL(src_ptr)) >> 3; + g1 = (G_VAL(src_ptr)) >> 2; + b1 = (B_VAL(src_ptr)) >> 3; - *((DATA32 *)d) = RGB_565_JOIN_TWO((p & 0xff0000) >> 19, (p & 0xff00) >> 10, (p & 0xff) >> 3, (q & 0xff0000) >> 19, (q & 0xff00) >> 10, (q & 0xff) >> 3); - d += 2; - s += (h + src_jump); - } - s = src + (h - 1) - y - 1; - d += dst_jump; - } +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++; + if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++; + if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++; +#endif + + CONVERT_LOOP2_INC_ROT_90(); + + r2 = (R_VAL(src_ptr)) >> 3; + g2 = (G_VAL(src_ptr)) >> 2; + b2 = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++; + if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++; + if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++; +#endif + +#ifndef WORDS_BIGENDIAN + *((DATA32 *)dst_ptr) = + (r2 << 27) | (g2 << 21) | (b2 << 16) | + (r1 << 11) | (g1 << 5 ) | (b1 ); +#else + *((DATA32 *)dst_ptr) = + (r1 << 27) | (g1 << 21) | (b1 << 16) | + (r2 << 11) | (g2 << 5 ) | (b2 ); +#endif + + CONVERT_LOOP2_END_ROT_90(); return; pal = 0; -#endif } #endif #endif @@ -431,48 +507,35 @@ evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_90 (DATA32 *src, DATA8 *dst, void evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r, g, b; - int dith, dith2; + DATA8 r, g, b; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + (h - 1); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s; + dst_ptr = (DATA16 *)dst; - DITHER_ONE_RGB_565 - *d++ = (r << 11) | (g << 5) | (b); - s += (h + src_jump); - } - s = src + (h - 1) - y - 1; - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP_START_ROT_90(); - s = src + (h - 1); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - *d++ = (((*s & 0xff0000) >> 19) << 11) | (((*s & 0xff00) >> 10) << 5) | ((*s & 0xff) >> 3); - s += (h + src_jump); - } - s = src + (h - 1) - y - 1; - d += dst_jump; - } + r = (R_VAL(src_ptr)) >> 3; + g = (G_VAL(src_ptr)) >> 2; + b = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++; + if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++; + if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++; +#endif + + *dst_ptr = (r << 11) | (g << 5) | (b); + + CONVERT_LOOP_END_ROT_90(); return; pal = 0; -#endif } #endif #endif @@ -482,47 +545,58 @@ evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_90 (DATA32 *src, DATA8 *dst, void evas_common_convert_rgba2_to_16bpp_bgr_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s = src; - DATA16 *d = (DATA16 *)dst; - int r1, g1, b1; - int r2, g2, b2; - int dith, dith2; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; + DATA8 r1, g1, b1; + DATA8 r2, g2, b2; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s++, q = *s++; + dst_ptr = (DATA16 *)dst; - DITHER_TWO_RGB_565 - *((DATA32 *)d) = BGR_565_JOIN_TWO(r1,g1,b1,r2,g2,b2); - d += 2; - } - s += src_jump; d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s = src; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP2_START_ROT_0(); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x += 2) - { - DATA32 p = *s++, q = *s++; + r1 = (R_VAL(src_ptr)) >> 3; + g1 = (G_VAL(src_ptr)) >> 2; + b1 = (B_VAL(src_ptr)) >> 3; - *((DATA32 *)d) = BGR_565_JOIN_TWO((p & 0xff0000) >> 19, (p & 0xff00) >> 10, (p & 0xff) >> 3, (q & 0xff0000) >> 19, (q & 0xff00) >> 10, (q & 0xff) >> 3); - d += 2; - } - s += src_jump; d += dst_jump; - } +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++; + if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++; + if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++; +#endif + + CONVERT_LOOP2_INC_ROT_0(); + + r2 = (R_VAL(src_ptr)) >> 3; + g2 = (G_VAL(src_ptr)) >> 2; + b2 = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++; + if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++; + if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++; +#endif + +#ifndef WORDS_BIGENDIAN + *((DATA32 *)dst_ptr) = + (b2 << 27) | (g2 << 21) | (r2 << 16) | + (b1 << 11) | (g1 << 5 ) | (r1 ); +#else + *((DATA32 *)dst_ptr) = + (b1 << 27) | (g1 << 21) | (r1 << 16) | + (b2 << 11) | (g2 << 5 ) | (r2 ); +#endif + + CONVERT_LOOP2_END_ROT_0(); return; pal = 0; -#endif } #endif #endif @@ -532,43 +606,35 @@ evas_common_convert_rgba2_to_16bpp_bgr_565_dith (DATA32 *src, DATA8 *dst, int sr void evas_common_convert_rgba_to_16bpp_bgr_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s = src; - DATA16 *d = (DATA16 *)dst; - int r, g, b; - int dith, dith2; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; + DATA8 r, g, b; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s++; + dst_ptr = (DATA16 *)dst; - DITHER_ONE_RGB_565 - *d++ = (b << 11) | (g << 5) | r; - } - s += src_jump; d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s = src; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP_START_ROT_0(); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - *d++ = (((*s & 0xff) >> 3) << 11) | (((*s & 0xff00) >> 10) << 5) | ((*s & 0xff0000) >> 19); - s++; - } - s += src_jump; d += dst_jump; - } + r = (R_VAL(src_ptr)) >> 3; + g = (G_VAL(src_ptr)) >> 2; + b = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++; + if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++; + if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++; +#endif + + *dst_ptr = (b << 11) | (g << 5) | (r); + + CONVERT_LOOP_END_ROT_0(); return; pal = 0; -#endif } #endif #endif @@ -578,51 +644,58 @@ evas_common_convert_rgba_to_16bpp_bgr_565_dith (DATA32 *src, DATA8 *dst, int src void evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r1, g1, b1; - int r2, g2, b2; - int dith, dith2; + DATA8 r1, g1, b1; + DATA8 r2, g2, b2; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s--, q = *s--; + dst_ptr = (DATA16 *)dst; + + CONVERT_LOOP2_START_ROT_180(); + + r1 = (R_VAL(src_ptr)) >> 3; + g1 = (G_VAL(src_ptr)) >> 2; + b1 = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++; + if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++; + if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++; +#endif + + CONVERT_LOOP2_INC_ROT_180(); + + r2 = (R_VAL(src_ptr)) >> 3; + g2 = (G_VAL(src_ptr)) >> 2; + b2 = (B_VAL(src_ptr)) >> 3; - DITHER_TWO_RGB_565 - *((DATA32 *)d) = BGR_565_JOIN_TWO(r1,g1,b1,r2,g2,b2); - d += 2; - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++; + if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++; + if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++; +#endif - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x += 2) - { - DATA32 p = *s--, q = *s--; +#ifndef WORDS_BIGENDIAN + *((DATA32 *)dst_ptr) = + (b2 << 27) | (g2 << 21) | (r2 << 16) | + (b1 << 11) | (g1 << 5 ) | (r1 ); +#else + *((DATA32 *)dst_ptr) = + (b1 << 27) | (g1 << 21) | (r1 << 16) | + (b2 << 11) | (g2 << 5 ) | (r2 ); +#endif - *((DATA32 *)d) = BGR_565_JOIN_TWO((p & 0xff0000) >> 19, (p & 0xff00) >> 10, (p & 0xff) >> 3, (q & 0xff0000) >> 19, (q & 0xff00) >> 10, (q & 0xff) >> 3); - d += 2; - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } + CONVERT_LOOP2_END_ROT_180(); return; pal = 0; -#endif } #endif #endif @@ -632,48 +705,37 @@ evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_180 (DATA32 *src, DATA8 *dst void evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r, g, b; - int dith, dith2; + DATA8 r, g, b; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s--; + dst_ptr = (DATA16 *)dst; - DITHER_ONE_RGB_565 - *d++ = (b << 11) | (g << 5) | (r); - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } -// fprintf(stderr, "evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180\n"); - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + fprintf(stderr, "evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180\n"); - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - *d++ = (((*s & 0xff) >> 3) << 11) | (((*s & 0xff00) >> 10) << 5) | ((*s & 0xff0000) >> 19); - s--; - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } + CONVERT_LOOP_START_ROT_180(); + + r = (R_VAL(src_ptr)) >> 3; + g = (G_VAL(src_ptr)) >> 2; + b = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++; + if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++; + if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++; +#endif + + *dst_ptr = (b << 11) | (g << 5) | (r); + + CONVERT_LOOP_END_ROT_180(); return; pal = 0; -#endif } #endif #endif @@ -683,53 +745,58 @@ evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180 (DATA32 *src, DATA8 *dst, void evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r1, g1, b1; - int r2, g2, b2; - int dith, dith2; + DATA8 r1, g1, b1; + DATA8 r2, g2, b2; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + ((w - 1) * (h + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s, q = *(s -= (h + src_jump)); + dst_ptr = (DATA16 *)dst; - DITHER_TWO_RGB_565 - *((DATA32 *)d) = BGR_565_JOIN_TWO(r1,g1,b1,r2,g2,b2); - d += 2; - s -= (h + src_jump); - } - s = src + ((w - 1) * (h + src_jump)) + (y + 1); - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP2_START_ROT_270(); - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x += 2) - { - DATA32 p = *s, q = *(s -= (h + src_jump)); + r1 = (R_VAL(src_ptr)) >> 3; + g1 = (G_VAL(src_ptr)) >> 2; + b1 = (B_VAL(src_ptr)) >> 3; - *((DATA32 *)d) = BGR_565_JOIN_TWO((p & 0xff0000) >> 19, (p & 0xff00) >> 10, (p & 0xff) >> 3, (q & 0xff0000) >> 19, (q & 0xff00) >> 10, (q & 0xff) >> 3); - d += 2; - s -= (h + src_jump); - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++; + if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++; + if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++; +#endif + + CONVERT_LOOP2_INC_ROT_270(); + + r2 = (R_VAL(src_ptr)) >> 3; + g2 = (G_VAL(src_ptr)) >> 2; + b2 = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++; + if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++; + if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++; +#endif + +#ifndef WORDS_BIGENDIAN + *((DATA32 *)dst_ptr) = + (b2 << 27) | (g2 << 21) | (r2 << 16) | + (b1 << 11) | (g1 << 5 ) | (r1 ); +#else + *((DATA32 *)dst_ptr) = + (b1 << 27) | (g1 << 21) | (r1 << 16) | + (b2 << 11) | (g2 << 5 ) | (r2 ); +#endif + + CONVERT_LOOP2_END_ROT_270(); return; pal = 0; -#endif } #endif #endif @@ -739,48 +806,35 @@ evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_270 (DATA32 *src, DATA8 *dst void evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r, g, b; - int dith, dith2; + DATA8 r, g, b; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + ((w - 1) * (h + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s; + dst_ptr = (DATA16 *)dst; - DITHER_ONE_RGB_565 - *d++ = (b << 11) | (g << 5) | (r); - s -= (h + src_jump); - } - s = src + ((w - 1) * (h + src_jump)) + (y + 1); - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP_START_ROT_270(); - s = src + (w - 1) + ((h - 1) * (w + src_jump)); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - *d++ = (((*s & 0xff) >> 3) << 11) | (((*s & 0xff00) >> 10) << 5) | ((*s & 0xff0000) >> 19); - s -= (h + src_jump); - } - s = src + (w - 1) + ((h - y - 2) * (w + src_jump)); - d += dst_jump; - } + r = (R_VAL(src_ptr)) >> 3; + g = (G_VAL(src_ptr)) >> 2; + b = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++; + if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++; + if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++; +#endif + + *dst_ptr = (b << 11) | (g << 5) | (r); + + CONVERT_LOOP_END_ROT_270(); return; pal = 0; -#endif } #endif #endif @@ -790,53 +844,58 @@ evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_270 (DATA32 *src, DATA8 *dst, void evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r1, g1, b1; - int r2, g2, b2; - int dith, dith2; + DATA8 r1, g1, b1; + DATA8 r2, g2, b2; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + (h - 1); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s, q = *(s += (h + src_jump)); + dst_ptr = (DATA16 *)dst; - DITHER_TWO_RGB_565 - *((DATA32 *)d) = BGR_565_JOIN_TWO(r1,g1,b1,r2,g2,b2); - d += 2; - s += (h + src_jump); - } - s = src + (h - 1) - y - 1; - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP2_START_ROT_90(); - s = src + (h - 1); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x += 2) - { - DATA32 p = *s, q = *(s += (h + src_jump)); + r1 = (R_VAL(src_ptr)) >> 3; + g1 = (G_VAL(src_ptr)) >> 2; + b1 = (B_VAL(src_ptr)) >> 3; - *((DATA32 *)d) = BGR_565_JOIN_TWO((p & 0xff0000) >> 19, (p & 0xff00) >> 10, (p & 0xff) >> 3, (q & 0xff0000) >> 19, (q & 0xff00) >> 10, (q & 0xff) >> 3); - d += 2; - s += (h + src_jump); - } - s = src + (h - 1) - y - 1; - d += dst_jump; - } +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++; + if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++; + if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++; +#endif + + CONVERT_LOOP2_INC_ROT_90(); + + r2 = (R_VAL(src_ptr)) >> 3; + g2 = (G_VAL(src_ptr)) >> 2; + b2 = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++; + if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++; + if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++; +#endif + +#ifndef WORDS_BIGENDIAN + *((DATA32 *)dst_ptr) = + (b2 << 27) | (g2 << 21) | (r2 << 16) | + (b1 << 11) | (g1 << 5 ) | (r1 ); +#else + *((DATA32 *)dst_ptr) = + (b1 << 27) | (g1 << 21) | (r1 << 16) | + (b2 << 11) | (g2 << 5 ) | (r2 ); +#endif + + CONVERT_LOOP2_END_ROT_90(); return; pal = 0; -#endif } #endif #endif @@ -846,48 +905,35 @@ evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_90 (DATA32 *src, DATA8 *dst, void evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal) { -#ifndef BUILD_NO_DITHER_MASK - DATA32 *s; - DATA16 *d = (DATA16 *)dst; + DATA32 *src_ptr; + DATA16 *dst_ptr; int x, y; - int r, g, b; - int dith, dith2; + DATA8 r, g, b; +#ifndef BUILD_NO_DITHER_MASK + DATA8 dith, dith2; +#endif - s = src + (h - 1); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - DATA32 p = *s; + dst_ptr = (DATA16 *)dst; - DITHER_ONE_RGB_565 - *d++ = (b << 11) | (g << 5) | (r); - s += (h + src_jump); - } - s = src + (h - 1) - y - 1; - d += dst_jump; - } - return; - pal = 0; -#else - DATA32 *s; - DATA16 *d = (DATA16 *)dst; - int x, y; + CONVERT_LOOP_START_ROT_90(); - s = src + (h - 1); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - *d++ = (((*s & 0xff) >> 3) << 11) | (((*s & 0xff00) >> 10) << 5) | ((*s & 0xff0000) >> 19); - s += (h + src_jump); - } - s = src + (h - 1) - y - 1; - d += dst_jump; - } + r = (R_VAL(src_ptr)) >> 3; + g = (G_VAL(src_ptr)) >> 2; + b = (B_VAL(src_ptr)) >> 3; + +#ifndef BUILD_NO_DITHER_MASK + dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5); + dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6); + if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++; + if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++; + if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++; +#endif + + *dst_ptr = (b << 11) | (g << 5) | (r); + + CONVERT_LOOP_END_ROT_90(); return; pal = 0; -#endif } #endif #endif @@ -2044,3 +2090,4 @@ evas_common_convert_rgba_to_16bpp_rgb_555_dith_rot_90 (DATA32 *src, DATA8 *dst, } #endif #endif + diff --git a/src/lib/engines/common/evas_convert_yuv.c b/src/lib/engines/common/evas_convert_yuv.c index 91bcb32..5590d23 100644 --- a/src/lib/engines/common/evas_convert_yuv.c +++ b/src/lib/engines/common/evas_convert_yuv.c @@ -319,7 +319,7 @@ _evas_yv12torgb_sse(unsigned char **yuv, unsigned char *rgb, int w, int h) r = LUT_CLIP((y + (_crv * v)) >> RES); g = LUT_CLIP((y - (_cgu * u) - (_cgv * v) + RZ(OFF)) >> RES); b = LUT_CLIP((y + (_cbu * u) + RZ(OFF)) >> RES); - *((DATA32 *)dp1) = 0xff000000 + RGB_JOIN(r,g,b); + *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b); dp1 += 4; @@ -327,7 +327,7 @@ _evas_yv12torgb_sse(unsigned char **yuv, unsigned char *rgb, int w, int h) r = LUT_CLIP((y + (_crv * v)) >> RES); g = LUT_CLIP((y - (_cgu * u) - (_cgv * v) + RZ(OFF)) >> RES); b = LUT_CLIP((y + (_cbu * u) + RZ(OFF)) >> RES); - *((DATA32 *)dp1) = 0xff000000 + RGB_JOIN(r,g,b); + *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b); dp1 += 4; } @@ -482,7 +482,7 @@ _evas_yv12torgb_mmx(unsigned char **yuv, unsigned char *rgb, int w, int h) r = LUT_CLIP((y + (_crv * v)) >> RES); g = LUT_CLIP((y - (_cgu * u) - (_cgv * v) + RZ(OFF)) >> RES); b = LUT_CLIP((y + (_cbu * u) + RZ(OFF)) >> RES); - *((DATA32 *)dp1) = 0xff000000 + RGB_JOIN(r,g,b); + *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b); dp1 += 4; @@ -490,7 +490,7 @@ _evas_yv12torgb_mmx(unsigned char **yuv, unsigned char *rgb, int w, int h) r = LUT_CLIP((y + (_crv * v)) >> RES); g = LUT_CLIP((y - (_cgu * u) - (_cgv * v) + RZ(OFF)) >> RES); b = LUT_CLIP((y + (_cbu * u) + RZ(OFF)) >> RES); - *((DATA32 *)dp1) = 0xff000000 + RGB_JOIN(r,g,b); + *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b); dp1 += 4; } @@ -751,12 +751,17 @@ _evas_yv12torgb_diz(unsigned char **yuv, unsigned char *rgb, int w, int h) int xx, yy; int y, u, v, r, g, b; unsigned char *yp1, *yp2, *up, *vp; - DATA32 *dp1, *dp2; + unsigned char *dp1, *dp2; int crv, cbu, cgu, cgv; /* destination pointers */ - dp1 = (DATA32 *)rgb; - dp2 = dp1 + w; + dp1 = rgb; + dp2 = rgb + (w * 4); + + crv = CRV; /* 1.596 */ + cbu = CBU; /* 2.018 */ + cgu = CGU; /* 0.391 */ + cgv = CGV; /* 0.813 */ for (yy = 0; yy < h; yy += 2) { @@ -771,46 +776,47 @@ _evas_yv12torgb_diz(unsigned char **yuv, unsigned char *rgb, int w, int h) u = (*up++) - 128; v = (*vp++) - 128; - crv = (CRV * v); - cgu = (CGU * u); - cgv = (CGV * v) - OFF; - cbu = (CBU * u) + OFF; - /* do the top 2 pixels of the 2x2 block whcih shared u & v */ /* yuv to rgb */ y = YMUL * ((*yp1++) - 16); - r = LUT_CLIP((y + crv) >> 16); - g = LUT_CLIP((y - cgu - cgv) >>16); - b = LUT_CLIP((y + cbu) >> 16); - *dp1 = 0xff000000 + RGB_JOIN(r,g,b); + r = LUT_CLIP((y + (crv * v)) >> 16); + g = LUT_CLIP((y - (cgu * u) - (cgv * v) + OFF) >>16); + b = LUT_CLIP((y + (cbu * u) + OFF) >> 16); + *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b); dp1 += 4; /* yuv to rgb */ y = YMUL * ((*yp1++) - 16); - r = LUT_CLIP((y + crv) >> 16); - g = LUT_CLIP((y - cgu - cgv) >>16); - b = LUT_CLIP((y + cbu) >> 16); - *dp1++ = 0xff000000 + RGB_JOIN(r,g,b); + r = LUT_CLIP((y + (crv * v)) >> 16); + g = LUT_CLIP((y - (cgu * u) - (cgv * v) + OFF) >>16); + b = LUT_CLIP((y + (cbu * u) + OFF) >> 16); + *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b); + + dp1 += 4; /* do the bottom 2 pixels */ /* yuv to rgb */ y = YMUL * ((*yp2++) - 16); - r = LUT_CLIP((y + crv) >> 16); - g = LUT_CLIP((y - cgu - cgv) >>16); - b = LUT_CLIP((y + cbu) >> 16); - *dp2++ = 0xff000000 + RGB_JOIN(r,g,b); + r = LUT_CLIP((y + (crv * v)) >> 16); + g = LUT_CLIP((y - (cgu * u) - (cgv * v) + OFF) >>16); + b = LUT_CLIP((y + (cbu * u) + OFF) >> 16); + *((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(r,g,b); + + dp2 += 4; /* yuv to rgb */ y = YMUL * ((*yp2++) - 16); - r = LUT_CLIP((y + crv) >> 16); - g = LUT_CLIP((y - cgu - cgv) >>16); - b = LUT_CLIP((y + cbu) >> 16); - *dp2++ = 0xff000000 + RGB_JOIN(r,g,b); + r = LUT_CLIP((y + (crv * v)) >> 16); + g = LUT_CLIP((y - (cgu * u) - (cgv * v) + OFF) >>16); + b = LUT_CLIP((y + (cbu * u) + OFF) >> 16); + *((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(r,g,b); + + dp2 += 4; } /* jump down one line since we are doing 2 at once */ - dp1 += w; - dp2 += w; + dp1 += (w * 4); + dp2 += (w * 4); } #endif } @@ -822,11 +828,11 @@ _evas_yv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) int xx, yy; int y, u, v; unsigned char *yp1, *yp2, *up, *vp; - DATA32 *dp1, *dp2; + unsigned char *dp1, *dp2; /* destination pointers */ - dp1 = (DATA32 *)rgb; - dp2 = dp1 + w; + dp1 = rgb; + dp2 = rgb + (w * 4); for (yy = 0; yy < h; yy += 2) { @@ -851,27 +857,35 @@ _evas_yv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) /* do the top 2 pixels of the 2x2 block whcih shared u & v */ /* yuv to rgb */ y = _v1164[*yp1++]; - *dp1++ = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); + *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); + + dp1 += 4; /* yuv to rgb */ y = _v1164[*yp1++]; - *dp1++ = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); + *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); + + dp1 += 4; /* do the bottom 2 pixels */ /* yuv to rgb */ y = _v1164[*yp2++]; - *dp2++ = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); + *((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); + + dp2 += 4; /* yuv to rgb */ y = _v1164[*yp2++]; - *dp2++ = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); + *((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); + dp2 += 4; } /* jump down one line since we are doing 2 at once */ - dp1 += w; - dp2 += w; + dp1 += (w * 4); + dp2 += (w * 4); } #endif } #endif + diff --git a/src/lib/engines/common/evas_gradient.h b/src/lib/engines/common/evas_gradient.h index 8c3adef..50e2cb8 100644 --- a/src/lib/engines/common/evas_gradient.h +++ b/src/lib/engines/common/evas_gradient.h @@ -28,21 +28,18 @@ EAPI void evas_common_gradient_draw (RGBA_Image *dst, RGB EAPI RGBA_Gradient_Type *evas_common_gradient_geometer_get (const char *name); -EAPI void evas_common_gradient2_clear (void *pgr); -EAPI void evas_common_gradient2_color_np_stop_insert (void *pgr, int r, int g, int b, int a, float pos); -EAPI void evas_common_gradient2_map (RGBA_Draw_Context *dc, void *pgr, int len); -EAPI int evas_common_gradient2_opaque (RGBA_Draw_Context *dc, void *pgr, int x, int y, int w, int h); -EAPI void evas_common_gradient2_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr, int x, int y, int w, int h); -EAPI void evas_common_rgba_gradient2_free (RGBA_Gradient2 *rgba_gr); - -EAPI RGBA_Gradient2 *evas_common_rgba_gradient2_linear_new (void); -EAPI void evas_common_gradient2_linear_render_pre (RGBA_Draw_Context *dc, void *pgr); -EAPI void evas_common_gradient2_linear_render_post (void *pgr); - -EAPI RGBA_Gradient2 *evas_common_rgba_gradient2_radial_new (void); -EAPI void evas_common_gradient2_radial_render_pre (RGBA_Draw_Context *dc, void *pgr); -EAPI void evas_common_gradient2_radial_render_post (void *pgr); +EAPI void evas_common_gradient2_free (RGBA_Gradient2 *gr); +EAPI RGBA_Gradient2 *evas_common_gradient2_linear_new (void); +EAPI void evas_common_gradient2_linear_fill_set (RGBA_Gradient2 *gr, float x0, float y0, float x1, float y1); +EAPI RGBA_Gradient2 *evas_common_gradient2_radial_new (void); +EAPI void evas_common_gradient2_radial_fill_set (RGBA_Gradient2 *gr, float cx, float cy, float rx, float ry); +EAPI void evas_common_gradient2_clear (RGBA_Gradient2 *gr); +EAPI void evas_common_gradient2_color_np_stop_insert (RGBA_Gradient2 *gr, int r, int g, int b, int a, float pos); +EAPI void evas_common_gradient2_fill_spread_set (RGBA_Gradient2 *gr, int spread); +EAPI void evas_common_gradient2_fill_transform_set (RGBA_Gradient2 *gr, Evas_Common_Transform *t); +EAPI void evas_common_gradient2_map (RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int len); +EAPI void evas_common_gradient2_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h, RGBA_Gradient2 *gr); EAPI RGBA_Gradient2_Type *evas_common_gradient2_type_linear_get (void); EAPI RGBA_Gradient2_Type *evas_common_gradient2_type_radial_get (void); diff --git a/src/lib/engines/common/evas_gradient2_linear.c b/src/lib/engines/common/evas_gradient2_linear.c index b0ff4f8..1dcea65 100644 --- a/src/lib/engines/common/evas_gradient2_linear.c +++ b/src/lib/engines/common/evas_gradient2_linear.c @@ -1,6 +1,5 @@ #include "evas_common.h" #include "evas_private.h" -#include "evas_object_gradient2.h" #include #define LINEAR_EPSILON 0.000030517578125 @@ -13,7 +12,7 @@ typedef struct _Linear_Data Linear_Data; struct _Linear_Data { float x0, y0, x1, y1; - int x00, y00; + float fx0, fy0; int ayx, ayy; int len; unsigned char int_axis_aligned : 1; @@ -26,25 +25,32 @@ linear_init(void); static void linear_shutdown(void); +static void +linear_init_geom(RGBA_Gradient2 *gr); + static void -linear_update_geom(void *pgr); +linear_update_geom(RGBA_Gradient2 *gr); static void -linear_free_geom(void *pgr); +linear_free_geom(void *gdata); static int -linear_has_alpha(void *pgr, int op); +linear_has_alpha(RGBA_Gradient2 *gr, int op); static int -linear_has_mask(void *pgr, int op); +linear_has_mask(RGBA_Gradient2 *gr, int op); + +static int +linear_get_map_len(RGBA_Gradient2 *gr); static Gfx_Func_Gradient2_Fill -linear_get_fill_func(void *pgr, int op); +linear_get_fill_func(RGBA_Gradient2 *gr, int op); static RGBA_Gradient2_Type linear = {"linear", linear_init, linear_shutdown, - linear_free_geom, + linear_init_geom, + linear_update_geom, linear_free_geom, linear_has_alpha, linear_has_mask, - linear_get_fill_func}; + linear_get_map_len, linear_get_fill_func}; EAPI RGBA_Gradient2_Type * @@ -54,55 +60,33 @@ evas_common_gradient2_type_linear_get(void) } EAPI RGBA_Gradient2 * -evas_common_rgba_gradient2_linear_new(void) +evas_common_gradient2_linear_new(void) { RGBA_Gradient2 *gr; - Linear_Data *linear_data; gr = calloc(1, sizeof(RGBA_Gradient2)); if (!gr) return NULL; - linear_data = calloc(1, sizeof(Linear_Data)); - if (!linear_data) return NULL; - gr->references = 1; gr->type.id = MAGIC_OBJ_GRADIENT_LINEAR; gr->type.geometer = &linear; - linear_data->ayy = 65536; linear_data->ayx = 0; - gr->type.gdata = linear_data; - + linear_init_geom(gr); return gr; } - EAPI void -evas_common_gradient2_linear_render_pre(RGBA_Draw_Context *dc, void *pgr) +evas_common_gradient2_linear_fill_set(RGBA_Gradient2 *gr, float x0, float y0, float x1, float y1) { - Evas_Object_Gradient2 *ogr = pgr; - Evas_Object_Gradient2_Linear *lgr; - RGBA_Gradient2 *gr; Linear_Data *linear_data; - if (!dc || !ogr) return; - gr = ogr->engine_data; if (!gr) return; - lgr = (Evas_Object_Gradient2_Linear *)(ogr); - if (!lgr) return; if (gr->type.id != MAGIC_OBJ_GRADIENT_LINEAR) return; if (gr->type.geometer != &linear) return; linear_data = (Linear_Data *)gr->type.gdata; if (!linear_data) return; - linear_data->x0 = lgr->cur.fill.x0; linear_data->y0 = lgr->cur.fill.y0; - linear_data->x1 = lgr->cur.fill.x1; linear_data->y1 = lgr->cur.fill.y1; - - linear_update_geom(ogr); - - evas_common_gradient2_map(dc, ogr, linear_data->len); + linear_data->x0 = x0; linear_data->y0 = y0; + linear_data->x1 = x1; linear_data->y1 = y1; } -EAPI void -evas_common_gradient2_linear_render_post(void *pgr) -{ -} /** internal functions **/ @@ -142,45 +126,57 @@ linear_shutdown(void) static void linear_free_geom(void *gdata) { - Linear_Data *linear_data = gdata; + Linear_Data *data = (Linear_Data *)gdata; + if (data) free(data); +} + +static void +linear_init_geom(RGBA_Gradient2 *gr) +{ + Linear_Data *linear_data; - if (linear_data) free(linear_data); + if (!gr || (gr->type.geometer != &linear)) return; + linear_data = (Linear_Data *)gr->type.gdata; + if (!linear_data) + { + linear_data = calloc(1, sizeof(Linear_Data)); + if (!linear_data) return; + linear_data->ayy = 65536; linear_data->ayx = 0; + } + gr->type.gdata = linear_data; } + static void -linear_update_geom(void *pgr) +linear_update_geom(RGBA_Gradient2 *gr) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; Linear_Data *linear_data; double f; double fx0, fy0, fx1, fy1; int len; - if (!ogr) return; - gr = ogr->engine_data; if (!gr || (gr->type.geometer != &linear)) return; linear_data = (Linear_Data *)gr->type.gdata; if (!linear_data) return; linear_data->int_axis_aligned = 0; linear_data->len = 0; - f = (ogr->cur.fill.transform.mxx * (double)ogr->cur.fill.transform.myy) - (ogr->cur.fill.transform.mxy * (double)ogr->cur.fill.transform.myx); + f = (gr->fill.transform.mxx * (double)gr->fill.transform.myy) - (gr->fill.transform.mxy * (double)gr->fill.transform.myx); if (fabs(f) < LINEAR_EPSILON) return; f = 1.0 / f; - fx0 = (((ogr->cur.fill.transform.myy * (double)linear_data->x0) - (ogr->cur.fill.transform.mxy * (double)linear_data->y0)) * f) - ogr->cur.fill.transform.mxz; - fy0 = ((-(ogr->cur.fill.transform.myx * (double)linear_data->x0) + (ogr->cur.fill.transform.mxx * (double)linear_data->y0)) * f) - ogr->cur.fill.transform.myz; + fx0 = (((gr->fill.transform.myy * (double)linear_data->x0) - (gr->fill.transform.mxy * (double)linear_data->y0)) * f) - gr->fill.transform.mxz; + fy0 = ((-(gr->fill.transform.myx * (double)linear_data->x0) + (gr->fill.transform.mxx * (double)linear_data->y0)) * f) - gr->fill.transform.myz; - fx1 = (((ogr->cur.fill.transform.myy * (double)linear_data->x1) - (ogr->cur.fill.transform.mxy * (double)linear_data->y1)) * f) - ogr->cur.fill.transform.mxz; - fy1 = ((-(ogr->cur.fill.transform.myx * (double)linear_data->x1) + (ogr->cur.fill.transform.mxx * (double)linear_data->y1)) * f) - ogr->cur.fill.transform.myz; + fx1 = (((gr->fill.transform.myy * (double)linear_data->x1) - (gr->fill.transform.mxy * (double)linear_data->y1)) * f) - gr->fill.transform.mxz; + fy1 = ((-(gr->fill.transform.myx * (double)linear_data->x1) + (gr->fill.transform.mxx * (double)linear_data->y1)) * f) - gr->fill.transform.myz; f = hypot(fx1 - fx0, fy1 - fy0); linear_data->len = len = f + 0.5; if (!len) return; - linear_data->ayx = ((fx1 - fx0) * 65536) / f; - linear_data->ayy = ((fy1 - fy0) * 65536) / f; + linear_data->ayx = ((fx1 - fx0) / f) * 65536; + linear_data->ayy = ((fy1 - fy0) / f) * 65536; if (fabs(fy0 - fy1) < LINEAR_INT_TOLERANCE) { @@ -194,60 +190,55 @@ linear_update_geom(void *pgr) (fabs(((int)fx1) - fx1) < LINEAR_INT_TOLERANCE) ) { linear_data->int_axis_aligned = 1; linear_data->ayx = 0; } } - linear_data->x00 = linear_data->ayx * fx0; - linear_data->y00 = linear_data->ayy * fy0; + linear_data->fx0 = fx0; + linear_data->fy0 = fy0; } static int -linear_has_alpha(void *pgr, int op) +linear_has_alpha(RGBA_Gradient2 *gr, int op) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; - - if (!ogr) return 0; - gr = ogr->engine_data; if (!gr || (gr->type.geometer != &linear)) return 0; if (gr->has_alpha | gr->map.has_alpha) return 1; if ( (op == _EVAS_RENDER_COPY) || (op == _EVAS_RENDER_COPY_REL) || (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) ) return 0; - if (ogr->cur.fill.spread == _EVAS_TEXTURE_RESTRICT) + if (gr->fill.spread == _EVAS_TEXTURE_RESTRICT) return 1; return 0; } static int -linear_has_mask(void *pgr, int op) +linear_has_mask(RGBA_Gradient2 *gr, int op) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; - - if (!ogr) return 0; - gr = ogr->engine_data; if (!gr || (gr->type.geometer != &linear)) return 0; if ( (op == _EVAS_RENDER_COPY) || (op == _EVAS_RENDER_COPY_REL) || (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) ) { - if (ogr->cur.fill.spread == _EVAS_TEXTURE_RESTRICT) + if (gr->fill.spread == _EVAS_TEXTURE_RESTRICT) return 1; } return 0; } +static int +linear_get_map_len(RGBA_Gradient2 *gr) +{ + Linear_Data *linear_data; + + if (!gr || (gr->type.geometer != &linear)) return 0; + linear_data = (Linear_Data *)gr->type.gdata; + if (!linear_data) return 0; + return linear_data->len; +} static Gfx_Func_Gradient2_Fill -linear_get_fill_func(void *pgr, int op) +linear_get_fill_func(RGBA_Gradient2 *gr, int op) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; Linear_Data *linear_data; Gfx_Func_Gradient2_Fill sfunc = NULL; int masked_op = 0; - if (!ogr) return sfunc; - gr = ogr->engine_data; - if (!gr || (gr->type.geometer != &linear)) return sfunc; linear_data = (Linear_Data *)gr->type.gdata; @@ -257,7 +248,7 @@ linear_get_fill_func(void *pgr, int op) (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) ) masked_op = 1; - switch (ogr->cur.fill.spread) + switch (gr->fill.spread) { case _EVAS_TEXTURE_REPEAT: sfunc = linear_repeat_aa; @@ -303,8 +294,8 @@ linear_repeat_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len Linear_Data *gdata = (Linear_Data *)params_data; int yy; - yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) + - (gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768; + evas_common_cpu_end_opt(); + yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768; if (gdata->int_axis_aligned && (gdata->ayx == 0)) { @@ -362,8 +353,8 @@ linear_repeat_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len int l = (yy >> 16); int a = 1 + ((yy & 0xffff) >> 8); - if ((l >= src_len) || (l < -src_len)) l = l % src_len; - if (l < 0) l += src_len; + if ((l >= src_len) || (l < 0)) + { l = l % src_len; if (l < 0) l += src_len; } #ifdef BUILD_MMX MOV_P2R(src[l], mm1, mm0) @@ -402,8 +393,8 @@ linear_reflect_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_le Linear_Data *gdata = (Linear_Data *)params_data; int yy; - yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) + - (gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768; + evas_common_cpu_end_opt(); + yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768; if (gdata->int_axis_aligned && (gdata->ayx == 0)) { @@ -532,8 +523,8 @@ linear_restrict_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_l Linear_Data *gdata = (Linear_Data *)params_data; int yy; - yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) + - (gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768; + evas_common_cpu_end_opt(); + yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768; if (gdata->int_axis_aligned && (gdata->ayx == 0)) { @@ -645,8 +636,8 @@ linear_restrict_masked_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, in Linear_Data *gdata = (Linear_Data *)params_data; int yy; - yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) + - (gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768; + evas_common_cpu_end_opt(); + yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768; #ifdef BUILD_MMX pxor_r2r(mm0, mm0); @@ -698,8 +689,8 @@ linear_pad_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, int dst_len, Linear_Data *gdata = (Linear_Data *)params_data; int yy; - yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) + - (gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768; + evas_common_cpu_end_opt(); + yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768; #ifdef BUILD_MMX pxor_r2r(mm0, mm0); diff --git a/src/lib/engines/common/evas_gradient2_main.c b/src/lib/engines/common/evas_gradient2_main.c index 6a782bf..96b8539 100644 --- a/src/lib/engines/common/evas_gradient2_main.c +++ b/src/lib/engines/common/evas_gradient2_main.c @@ -1,7 +1,6 @@ #include "evas_common.h" #include "evas_blend_private.h" #include "evas_private.h" -#include "evas_object_gradient2.h" #include static void _evas_common_gradient2_stops_free(RGBA_Gradient2 *gr); @@ -10,10 +9,6 @@ static void _evas_common_gradient2_stops_scale(RGBA_Gradient2 *gr); static void _evas_common_gradient2_map_argb(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int len); static void _evas_common_gradient2_map_ahsv(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int len); -static void _evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr, - int x, int y, int w, int h); - -/* static int grad_initialised = 0; EAPI void @@ -32,7 +27,7 @@ evas_common_gradient2_init(void) grad_initialised = 1; } -EAPI void +void evas_common_gradient2_shutdown(void) { RGBA_Gradient2_Type *geom; @@ -47,12 +42,12 @@ evas_common_gradient2_shutdown(void) geom->shutdown(); grad_initialised = 0; } -*/ static void _evas_common_gradient2_stops_free(RGBA_Gradient2 *gr) { - if (gr && gr->stops.stops) + if (!gr) return; + if (gr->stops.stops) { Eina_Inlist *l; @@ -68,12 +63,14 @@ _evas_common_gradient2_stops_free(RGBA_Gradient2 *gr) } EAPI void -evas_common_rgba_gradient2_free(RGBA_Gradient2 *gr) +evas_common_gradient2_free(RGBA_Gradient2 *gr) { if (!gr) return; gr->references--; if (gr->references > 0) return; - _evas_common_gradient2_stops_free(gr); + evas_common_gradient2_clear(gr); + if (gr->stops.cdata) free(gr->stops.cdata); + if (gr->stops.adata) free(gr->stops.adata); if (gr->type.geometer && gr->type.gdata) gr->type.geometer->geom_free(gr->type.gdata); if (gr->map.data) free(gr->map.data); @@ -81,28 +78,20 @@ evas_common_rgba_gradient2_free(RGBA_Gradient2 *gr) } EAPI void -evas_common_gradient2_clear(void *pgr) +evas_common_gradient2_clear(RGBA_Gradient2 *gr) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; - - if (!ogr) return; - gr = ogr->engine_data; if (!gr) return; + _evas_common_gradient2_stops_free(gr); gr->has_alpha = 0; } EAPI void -evas_common_gradient2_color_np_stop_insert(void *pgr, int r, int g, int b, int a, float pos) +evas_common_gradient2_color_np_stop_insert(RGBA_Gradient2 *gr, int r, int g, int b, int a, float pos) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; RGBA_Gradient2_Color_Np_Stop *gc; Eina_Inlist *l; - if (!ogr) return; - gr = ogr->engine_data; if (!gr) return; if (!gr->stops.stops) { @@ -175,87 +164,47 @@ evas_common_gradient2_color_np_stop_insert(void *pgr, int r, int g, int b, int a gr->has_alpha = 1; } - -EAPI int -evas_common_gradient2_opaque(RGBA_Draw_Context *dc, void *pgr, - int x, int y, int w, int h) +EAPI void +evas_common_gradient2_fill_transform_set(RGBA_Gradient2 *gr, Evas_Common_Transform *t) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; - - if (!dc || !ogr) return 0; - gr = ogr->engine_data; - if (!gr || !gr->type.geometer) return 0; - if (dc->render_op != _EVAS_RENDER_BLEND) - return 0; - return !(gr->type.geometer->has_alpha(ogr, dc->render_op) | - gr->type.geometer->has_mask(ogr, dc->render_op)); + if (!gr) return; + if (!t) + { + gr->fill.transform.mxx = 1; gr->fill.transform.mxy = 0; gr->fill.transform.mxz = 0; + gr->fill.transform.myx = 0; gr->fill.transform.myy = 1; gr->fill.transform.myz = 0; + gr->fill.transform.mzx = 1; gr->fill.transform.mzy = 0; gr->fill.transform.mzz = 1; + return; + } + gr->fill.transform.mxx = t->mxx; gr->fill.transform.mxy = t->mxy; gr->fill.transform.mxz = t->mxz; + gr->fill.transform.myx = t->myx; gr->fill.transform.myy = t->myy; gr->fill.transform.myz = t->myz; + gr->fill.transform.mzx = t->mzx; gr->fill.transform.mzy = t->mzy; gr->fill.transform.mzz = t->mzz; } EAPI void -evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr, - int x, int y, int w, int h) +evas_common_gradient2_fill_spread_set(RGBA_Gradient2 *gr, int spread) { - Cutout_Rects *rects; - Cutout_Rect *r; - int c, cx, cy, cw, ch; - int i; - - /* handle cutouts here! */ - - if ((w <= 0) || (h <= 0)) return; - if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) - return; - /* save out clip info */ - c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h; - evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h); - /* no cutouts - cut right to the chase */ - if (!dc->cutout.rects) - { - _evas_common_gradient2_draw(dst, dc, pgr, x, y, w, h); - } - else - { - evas_common_draw_context_clip_clip(dc, x, y, w, h); - /* our clip is 0 size.. abort */ - if ((dc->clip.w > 0) && (dc->clip.h > 0)) - { - rects = evas_common_draw_context_apply_cutouts(dc); - for (i = 0; i < rects->active; ++i) - { - r = rects->rects + i; - evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); - _evas_common_gradient2_draw(dst, dc, pgr, x, y, w, h); - } - evas_common_draw_context_apply_clear_cutouts(rects); - } - } - /* restore clip info */ - dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; - evas_common_cpu_end_opt(); + if (!gr) return; + gr->fill.spread = spread; } -static void -_evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr, - int x, int y, int w, int h) +EAPI void +evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, + int x, int y, int w, int h, RGBA_Gradient2 *gr) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; - Gfx_Func_Gradient2_Fill gfunc; + Gfx_Func_Gradient2_Fill gfunc; RGBA_Gfx_Func bfunc; int len; int xin, yin, xoff, yoff; int clx, cly, clw, clh; DATA32 *pdst, *dst_end, *buf, *map; - RGBA_Image argb_buf; + RGBA_Image *argb_buf = NULL, *alpha_buf = NULL; DATA8 *mask = NULL; void *gdata; int direct_copy = 0, buf_step = 0; - if (!dc || !ogr || !dst || !dst->image.data) + if (!dst || !dc || !gr || !dst || !dst->image.data) return; - gr = ogr->engine_data; - if (!gr || !gr->map.data || !gr->type.geometer) + if (!gr->map.data || !gr->type.geometer) return; if ((w < 1) || (h < 1)) return; @@ -273,70 +222,93 @@ _evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr, xoff = (x - xin); yoff = (y - yin); - if (!gr->type.geometer->has_mask(ogr, dc->render_op)) + if (!gr->type.geometer->has_mask(gr, dc->render_op)) { if ((dc->render_op == _EVAS_RENDER_FILL) || (dc->render_op == _EVAS_RENDER_COPY)) { direct_copy = 1; buf_step = dst->cache_entry.w; - if (gr->type.geometer->has_alpha(ogr, dc->render_op)) + if (gr->type.geometer->has_alpha(gr, dc->render_op)) dst->cache_entry.flags.alpha = 1; } else if ((dc->render_op == _EVAS_RENDER_BLEND) && - !gr->type.geometer->has_alpha(ogr, dc->render_op)) + !gr->type.geometer->has_alpha(gr, dc->render_op)) { direct_copy = 1; buf_step = dst->cache_entry.w; } } if (!direct_copy) { - buf = alloca(w * sizeof(DATA32)); - if (!buf) return; - argb_buf.cache_entry.flags.alpha = gr->type.geometer->has_alpha(ogr, dc->render_op); - argb_buf.cache_entry.flags.alpha_sparse = 0; + argb_buf = evas_common_image_line_buffer_obtain(w); + if (!argb_buf) + return; + argb_buf->cache_entry.flags.alpha = gr->type.geometer->has_alpha(gr, dc->render_op) ? 1 : 0; - if (gr->type.geometer->has_mask(ogr, dc->render_op)) + if (gr->type.geometer->has_mask(gr, dc->render_op)) { - mask = alloca(w * sizeof(DATA8)); - if (!mask) return; - bfunc = evas_common_gfx_func_composite_pixel_mask_span_get(&argb_buf, dst, w, dc->render_op); + alpha_buf = evas_common_image_alpha_line_buffer_obtain(w); + if (!alpha_buf) + { + evas_common_image_line_buffer_release(argb_buf); + return; + } + bfunc = evas_common_gfx_func_composite_pixel_mask_span_get(argb_buf, dst, w, dc->render_op); } else - { - if (ogr->cur.fill.spread == _EVAS_TEXTURE_RESTRICT) - argb_buf.cache_entry.flags.alpha_sparse = 1; - bfunc = evas_common_gfx_func_composite_pixel_span_get(&argb_buf, dst, w, dc->render_op); - } - if (!bfunc) return; + bfunc = evas_common_gfx_func_composite_pixel_span_get(argb_buf, dst, w, dc->render_op); } - gfunc = gr->type.geometer->get_fill_func(ogr, dc->render_op); + gfunc = gr->type.geometer->get_fill_func(gr, dc->render_op); gdata = gr->type.gdata; - if (!gdata) return; + if (!gdata) + { + if (!direct_copy) + { + evas_common_image_line_buffer_release(argb_buf); + if (alpha_buf) + evas_common_image_alpha_line_buffer_release(alpha_buf); + } + return; + } map = gr->map.data; len = gr->map.len; pdst = dst->image.data + (y * dst->cache_entry.w) + x; dst_end = pdst + (h * dst->cache_entry.w); - if (direct_copy) buf = pdst; + if (!direct_copy) + { + buf = argb_buf->image.data; + if (alpha_buf) + mask = (DATA8 *)alpha_buf->image.data; + } + else + buf = pdst; while (pdst < dst_end) { #ifdef EVAS_SLI if ((y % dc->sli.h) == dc->sli.y) - { #endif + { gfunc(map, len, buf, mask, w, xoff, yoff, gdata); if (!direct_copy) bfunc(buf, mask, 0, pdst, w); -#ifdef EVAS_SLI - y++; } -#endif buf += buf_step; pdst += dst->cache_entry.w; yoff++; +#ifdef EVAS_SLI + y++; +#endif } + + if (!direct_copy) + { + evas_common_image_line_buffer_release(argb_buf); + if (alpha_buf) + evas_common_image_alpha_line_buffer_release(alpha_buf); + } + evas_common_cpu_end_opt(); } static void @@ -414,22 +386,23 @@ _evas_common_gradient2_map_argb(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int l { Eina_Inlist *lc; RGBA_Gradient2_Color_Np_Stop *gc, *gc_next; - DATA32 *map, *pmap, *map_end; - DATA8 *amap = NULL, *pamap = NULL; + DATA32 *pmap, *map_end; + DATA8 *pamap = NULL; int i, dii; int r, g, b, a; int next_r, next_g, next_b, next_a; int rr, drr, gg, dgg, bb, dbb, aa, daa; - map = alloca(gr->stops.len * sizeof(DATA32)); - if (!map) return; - pmap = map; map_end = pmap + gr->stops.len; + gr->stops.cdata = realloc(gr->stops.cdata, gr->stops.len * sizeof(DATA32)); + if (!gr->stops.cdata) return; + pmap = gr->stops.cdata; map_end = pmap + gr->stops.len; if (gr->has_alpha) { - amap = alloca(gr->stops.len * sizeof(DATA8)); - if (!amap) return; - pamap = amap; + gr->stops.adata = realloc(gr->stops.adata, gr->stops.len * sizeof(DATA8)); + if (!gr->stops.adata) + { free(gr->stops.cdata); gr->stops.cdata = NULL; return; } + pamap = gr->stops.adata; } gc = (RGBA_Gradient2_Color_Np_Stop *)gr->stops.stops; @@ -472,17 +445,17 @@ _evas_common_gradient2_map_argb(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int l if (pamap) *pamap++ = gc->a; } } + } - if (map && amap) + if (gr->stops.cdata && gr->stops.adata) { - evas_common_scale_rgba_a8_span(map, amap, gr->stops.len, + evas_common_scale_rgba_a8_span(gr->stops.cdata, gr->stops.adata, gr->stops.len, dc->mul.col, gr->map.data, gr->map.len, 1); return; } - evas_common_scale_rgba_span(map, NULL, gr->stops.len, + evas_common_scale_rgba_span(gr->stops.cdata, NULL, gr->stops.len, dc->mul.col, gr->map.data, gr->map.len, 1); - } gr->map.has_alpha |= (!!(255 - (dc->mul.col >> 24))); } @@ -513,8 +486,8 @@ _evas_common_gradient2_map_ahsv(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int l { Eina_Inlist *lc; RGBA_Gradient2_Color_Np_Stop *gc, *gc_next; - DATA32 *map, *pmap, *map_end; - DATA8 *amap = NULL, *pamap = NULL; + DATA32 *pmap, *map_end; + DATA8 *pamap = NULL; int i, dii; int h, s, v; int next_h, next_s, next_v; @@ -522,16 +495,16 @@ _evas_common_gradient2_map_ahsv(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int l int r, g, b, a; int next_r, next_g, next_b, next_a; - map = alloca(gr->stops.len * sizeof(DATA32)); - if (!map) return; - pmap = map; map_end = pmap + gr->stops.len; + gr->stops.cdata = realloc(gr->stops.cdata, gr->stops.len * sizeof(DATA32)); + if (!gr->stops.cdata) return; + pmap = gr->stops.cdata; map_end = pmap + gr->stops.len; if (gr->has_alpha) { - amap = alloca(gr->stops.len * sizeof(DATA8)); - if (!amap) - return; - pamap = amap; + gr->stops.adata = realloc(gr->stops.adata, gr->stops.len * sizeof(DATA8)); + if (!gr->stops.adata) + { free(gr->stops.cdata); gr->stops.cdata = NULL; return; } + pamap = gr->stops.adata; } gc = (RGBA_Gradient2_Color_Np_Stop *)gr->stops.stops; @@ -579,28 +552,23 @@ _evas_common_gradient2_map_ahsv(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int l if (pamap) *pamap++ = gc->a; } } + } - if (map && amap) + if (gr->stops.cdata && gr->stops.adata) { - evas_common_scale_hsva_a8_span(map, amap, gr->stops.len, + evas_common_scale_hsva_a8_span(gr->stops.cdata, gr->stops.adata, gr->stops.len, dc->mul.col, gr->map.data, gr->map.len, 1); return; } - evas_common_scale_hsva_span(map, NULL, gr->stops.len, + evas_common_scale_hsva_span(gr->stops.cdata, NULL, gr->stops.len, dc->mul.col, gr->map.data, gr->map.len, 1); - } gr->map.has_alpha |= (!!(255 - (dc->mul.col >> 24))); } EAPI void -evas_common_gradient2_map(RGBA_Draw_Context *dc, void *pgr, int len) +evas_common_gradient2_map(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int len) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; - - if (!ogr || !dc) return; - gr = ogr->engine_data; - if (!gr) return; + if (!gr || !dc) return; if (dc->interpolation.color_space == _EVAS_COLOR_SPACE_AHSV) { _evas_common_gradient2_map_ahsv(dc, gr, len); diff --git a/src/lib/engines/common/evas_gradient2_radial.c b/src/lib/engines/common/evas_gradient2_radial.c index 2ec2692..39939ba 100644 --- a/src/lib/engines/common/evas_gradient2_radial.c +++ b/src/lib/engines/common/evas_gradient2_radial.c @@ -1,6 +1,5 @@ #include "evas_common.h" #include "evas_private.h" -#include "evas_object_gradient2.h" #include #define RADIAL_EPSILON 0.000030517578125 @@ -24,24 +23,31 @@ static void radial_shutdown(void); static void -radial_update_geom(void *pgr); +radial_init_geom(RGBA_Gradient2 *gr); + +static void +radial_update_geom(RGBA_Gradient2 *gr); static void radial_free_geom(void *gdata); static int -radial_has_alpha(void *pgr, int op); +radial_has_alpha(RGBA_Gradient2 *gr, int op); + +static int +radial_has_mask(RGBA_Gradient2 *gr, int op); static int -radial_has_mask(void *pgr, int op); +radial_get_map_len(RGBA_Gradient2 *gr); static Gfx_Func_Gradient2_Fill -radial_get_fill_func(void *pgr, int op); +radial_get_fill_func(RGBA_Gradient2 *gr, int op); static RGBA_Gradient2_Type radial = {"radial", radial_init, radial_shutdown, - radial_free_geom, + radial_init_geom, + radial_update_geom, radial_free_geom, radial_has_alpha, radial_has_mask, - radial_get_fill_func}; + radial_get_map_len, radial_get_fill_func}; EAPI RGBA_Gradient2_Type * @@ -51,60 +57,32 @@ evas_common_gradient2_type_radial_get(void) } EAPI RGBA_Gradient2 * -evas_common_rgba_gradient2_radial_new(void) +evas_common_gradient2_radial_new(void) { RGBA_Gradient2 *gr; - Radial_Data *radial_data; gr = calloc(1, sizeof(RGBA_Gradient2)); if (!gr) return NULL; - radial_data = calloc(1, sizeof(Radial_Data)); - if (!radial_data) return; gr->references = 1; gr->type.id = MAGIC_OBJ_GRADIENT_RADIAL; gr->type.geometer = &radial; - - radial_data->cx = radial_data->cy = 0; - radial_data->rx = radial_data->ry = 0; - radial_data->axx = 65536; radial_data->axy = 0; - radial_data->ayx = 0; radial_data->ayy = 65536; - radial_data->len = 0; - gr->type.gdata = radial_data; - + radial_init_geom(gr); return gr; } EAPI void -evas_common_gradient2_radial_render_pre(RGBA_Draw_Context *dc, void *pgr) +evas_common_gradient2_radial_fill_set(RGBA_Gradient2 *gr, float cx, float cy, float rx, float ry) { - Evas_Object_Gradient2 *ogr = pgr; - Evas_Object_Gradient2_Radial *rgr; - RGBA_Gradient2 *gr; Radial_Data *radial_data; - float rx, ry; - if (!dc || !ogr) return; - rgr = (Evas_Object_Gradient2_Radial *)(ogr); - if (!rgr) return; - gr = ogr->engine_data; if (!gr) return; if (gr->type.id != MAGIC_OBJ_GRADIENT_RADIAL) return; if (gr->type.geometer != &radial) return; radial_data = (Radial_Data *)gr->type.gdata; if (!radial_data) return; - radial_data->cx = rgr->cur.fill.cx; radial_data->cy = rgr->cur.fill.cy; - rx = rgr->cur.fill.rx; ry = rgr->cur.fill.ry; if (rx < 0) rx = -rx; if (ry < 0) ry = -ry; + radial_data->cx = cx; radial_data->cy = cy; radial_data->rx = 1 + rx; radial_data->ry = 1 + ry; - - radial_update_geom(ogr); - - evas_common_gradient2_map(dc, ogr, radial_data->len); -} - -EAPI void -evas_common_gradient2_radial_render_post(void *pgr) -{ } @@ -144,23 +122,39 @@ radial_shutdown(void) static void radial_free_geom(void *gdata) { - Radial_Data *radial_data = (Radial_Data *)gdata; - if (radial_data) free(radial_data); + Radial_Data *data = (Radial_Data *)gdata; + if (data) free(data); } +static void +radial_init_geom(RGBA_Gradient2 *gr) +{ + Radial_Data *radial_data; + + if (!gr || (gr->type.geometer != &radial)) return; + + radial_data = (Radial_Data *)gr->type.gdata; + if (!radial_data) + { + radial_data = calloc(1, sizeof(Radial_Data)); + if (!radial_data) return; + radial_data->cx = radial_data->cy = 0; + radial_data->rx = radial_data->ry = 0; + radial_data->axx = 65536; radial_data->axy = 0; + radial_data->ayx = 0; radial_data->ayy = 65536; + radial_data->len = 0; + } + gr->type.gdata = radial_data; +} static void -radial_update_geom(void *pgr) +radial_update_geom(RGBA_Gradient2 *gr) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; Radial_Data *radial_data; double f, flen; double fx1, fy1; int len; - if (!ogr) return; - gr = ogr->engine_data; if (!gr || (gr->type.geometer != &radial)) return; radial_data = (Radial_Data *)gr->type.gdata; @@ -169,81 +163,86 @@ radial_update_geom(void *pgr) if ((radial_data->rx < RADIAL_EPSILON) || (radial_data->ry < RADIAL_EPSILON)) return; radial_data->len = 0; - f = (ogr->cur.fill.transform.mxx * (double)ogr->cur.fill.transform.myy) - (ogr->cur.fill.transform.mxy * (double)ogr->cur.fill.transform.myx); + f = (gr->fill.transform.mxx * (double)gr->fill.transform.myy) - (gr->fill.transform.mxy * (double)gr->fill.transform.myx); if (fabs(f) < RADIAL_EPSILON) return; f = 1.0 / f; - radial_data->cx0 = (((ogr->cur.fill.transform.myy * (double)radial_data->cx) - (ogr->cur.fill.transform.mxy * (double)radial_data->cy)) * f) - ogr->cur.fill.transform.mxz; - radial_data->cy0 = ((-(ogr->cur.fill.transform.myx * (double)radial_data->cx) + (ogr->cur.fill.transform.mxx * (double)radial_data->cy)) * f) - ogr->cur.fill.transform.myz; + radial_data->cx0 = (((gr->fill.transform.myy * (double)radial_data->cx) - (gr->fill.transform.mxy * (double)radial_data->cy)) * f) - gr->fill.transform.mxz; + radial_data->cy0 = ((-(gr->fill.transform.myx * (double)radial_data->cx) + (gr->fill.transform.mxx * (double)radial_data->cy)) * f) - gr->fill.transform.myz; - fx1 = (ogr->cur.fill.transform.myy * (double)radial_data->rx) * f; - fy1 = (ogr->cur.fill.transform.myx * (double)radial_data->rx) * f; + fx1 = (gr->fill.transform.myy * (double)radial_data->rx) * f; + fy1 = (gr->fill.transform.myx * (double)radial_data->rx) * f; flen = hypot(fx1, fy1); - fx1 = (ogr->cur.fill.transform.mxy * (double)radial_data->ry) * f; - fy1 = (ogr->cur.fill.transform.mxx * (double)radial_data->ry) * f; + fx1 = (gr->fill.transform.mxy * (double)radial_data->ry) * f; + fy1 = (gr->fill.transform.mxx * (double)radial_data->ry) * f; flen = sqrt(flen * hypot(fx1, fy1)); radial_data->len = len = flen + 0.5; if (!len) return; - radial_data->axx = (((double)ogr->cur.fill.transform.mxx * 65536) * flen) / radial_data->rx; - radial_data->axy = (((double)ogr->cur.fill.transform.mxy * 65536) * flen) / radial_data->rx; + radial_data->axx = (((double)gr->fill.transform.mxx * 65536) * flen) / radial_data->rx; + radial_data->axy = (((double)gr->fill.transform.mxy * 65536) * flen) / radial_data->rx; - radial_data->ayx = (((double)ogr->cur.fill.transform.myx * 65536) * flen) / radial_data->ry; - radial_data->ayy = (((double)ogr->cur.fill.transform.myy * 65536) * flen) / radial_data->ry; + radial_data->ayx = (((double)gr->fill.transform.myx * 65536) * flen) / radial_data->ry; + radial_data->ayy = (((double)gr->fill.transform.myy * 65536) * flen) / radial_data->ry; } static int -radial_has_alpha(void *pgr, int op) +radial_has_alpha(RGBA_Gradient2 *gr, int op) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; + Radial_Data *radial_data; - if (!ogr) return 0; - gr = ogr->engine_data; if (!gr || (gr->type.geometer != &radial)) return 0; if (gr->has_alpha | gr->map.has_alpha) return 1; if ( (op == _EVAS_RENDER_COPY) || (op == _EVAS_RENDER_COPY_REL) || (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) ) return 0; - if (ogr->cur.fill.spread == _EVAS_TEXTURE_RESTRICT) + radial_data = (Radial_Data *)gr->type.gdata; + if (!radial_data) return 0; + if (gr->fill.spread == _EVAS_TEXTURE_RESTRICT) return 1; return 0; } static int -radial_has_mask(void *pgr, int op) +radial_has_mask(RGBA_Gradient2 *gr, int op) { - Evas_Object_Gradient2 *ogr= pgr; - RGBA_Gradient2 *gr; + Radial_Data *radial_data; - if (!ogr) return 0; - gr = ogr->engine_data; if (!gr || (gr->type.geometer != &radial)) return 0; if ( (op == _EVAS_RENDER_COPY) || (op == _EVAS_RENDER_COPY_REL) || (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) ) { - if (ogr->cur.fill.spread == _EVAS_TEXTURE_RESTRICT) + radial_data = (Radial_Data *)gr->type.gdata; + if (!radial_data) return 0; + if (gr->fill.spread == _EVAS_TEXTURE_RESTRICT) return 1; } return 0; } +static int +radial_get_map_len(RGBA_Gradient2 *gr) +{ + Radial_Data *radial_data; + + if (!gr || (gr->type.geometer != &radial)) return 0; + radial_data = (Radial_Data *)gr->type.gdata; + if (!radial_data) return 0; + return radial_data->len; +} + static Gfx_Func_Gradient2_Fill -radial_get_fill_func(void *pgr, int op) +radial_get_fill_func(RGBA_Gradient2 *gr, int op) { - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; Radial_Data *radial_data; Gfx_Func_Gradient2_Fill sfunc = NULL; int masked_op = 0; - if (!ogr) return 0; - gr = ogr->engine_data; if (!gr || (gr->type.geometer != &radial)) return sfunc; radial_data = (Radial_Data *)gr->type.gdata; if (!radial_data) return sfunc; @@ -252,7 +251,7 @@ radial_get_fill_func(void *pgr, int op) (op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) ) masked_op = 1; - switch (ogr->cur.fill.spread) + switch (gr->fill.spread) { case _EVAS_TEXTURE_REPEAT: sfunc = radial_repeat_aa; diff --git a/src/lib/engines/common/evas_image.h b/src/lib/engines/common/evas_image.h index eb31d9d..2dfde62 100644 --- a/src/lib/engines/common/evas_image.h +++ b/src/lib/engines/common/evas_image.h @@ -28,9 +28,5 @@ EAPI void evas_common_image_alpha_line_buffer_free (RGBA_Image * EAPI RGBA_Image *evas_common_load_image_from_file (const char *file, const char *key, RGBA_Image_Loadopts *lo); EAPI int evas_common_save_image_to_file (RGBA_Image *im, const char *file, const char *key, int quality, int compress); -EAPI void evas_common_image_render_pre (RGBA_Draw_Context *dc, void *pim); -EAPI void evas_common_image_draw2 (RGBA_Image *dst, RGBA_Draw_Context *dc, void *pim, int x, int y, int w, int h); -EAPI int evas_common_image_is_opaque(RGBA_Draw_Context *dc, void *pim, int x, int y, int w, int h); -EAPI Gfx_Func_Image_Fill evas_common_image_fill_func_get(void *pim, int render_op); #endif /* _EVAS_IMAGE_H */ diff --git a/src/lib/engines/common/evas_image_draw.c b/src/lib/engines/common/evas_image_draw.c deleted file mode 100644 index 5e0df20..0000000 --- a/src/lib/engines/common/evas_image_draw.c +++ /dev/null @@ -1,241 +0,0 @@ -#include "evas_common.h" -#include "evas_blend_private.h" -#include "evas_private.h" -#include "evas_object_image.h" -#include "./evas_image_private.h" -#include - - -/* simple func that assumes a bunch of stuff... */ -static void -_evas_common_image_draw_simple(RGBA_Image *dst, RGBA_Draw_Context *dc, - RGBA_Image *im, int sx, int sy, int x, int y, int w, int h) -{ - RGBA_Gfx_Func bfunc; - int sw, dw; - DATA32 *pdst, *dst_end, *src; -// DATA8 *mask = NULL; - int use_col = 1; - DATA32 col; - - sw = im->cache_entry.w; dw = dst->cache_entry.w; - col = dc->mul.col; - if ((!dc->mul.use) || (dc->mul.col == 0xffffffff)) - use_col = 0; - if (!use_col) - bfunc = evas_common_gfx_func_composite_pixel_span_get(im, dst, w, dc->render_op); - else - bfunc = evas_common_gfx_func_composite_pixel_color_span_get(im, col, dst, w, dc->render_op); - if (!bfunc) return; - - src = im->image.data + (sy * im->cache_entry.w) + sx; - pdst = dst->image.data + (y * dst->cache_entry.w) + x; - dst_end = pdst + (h * dst->cache_entry.w); - - while (pdst < dst_end) - { -#ifdef EVAS_SLI - if ((y % dc->sli.h) == dc->sli.y) - { -#endif - bfunc(src, NULL, col, pdst, w); -#ifdef EVAS_SLI - y++; - } -#endif - src += sw; pdst += dw; - } -} - -static void -_evas_common_image_draw2(RGBA_Image *dst, RGBA_Draw_Context *dc, - void *pim, int x, int y, int w, int h) -{ - Evas_Object_Image *oim = pim; - RGBA_Image *im; - Gfx_Func_Image_Fill ifunc; - RGBA_Gfx_Func bfunc; - int xin, yin, xoff, yoff; - int clx, cly, clw, clh; - int sw, sh, dw; - DATA32 *pdst, *dst_end, *buf, *src; - RGBA_Image argb_buf; -// DATA8 *mask = NULL; - Image_Draw_Data idata; - int direct_copy = 0, buf_step = 0; - int buf_has_alpha, use_col = 1; - DATA32 col; - - if (!dc || !oim || !dst || !dst->image.data) return; - if ((w < 1) || (h < 1)) return; - - im = oim->engine_data; - if (!im || !im->image.data) return; - sw = im->cache_entry.w; sh = im->cache_entry.h; - if ((sw < 1) || (sh < 1)) return; - - clx = 0; cly = 0; clw = dst->cache_entry.w; clh = dst->cache_entry.h; - if ((clw < 1) || (clh < 1)) return; - - if (dc->clip.use) - RECTS_CLIP_TO_RECT(clx,cly,clw,clh, dc->clip.x,dc->clip.y,dc->clip.w,dc->clip.h); - if ((clw < 1) || (clh < 1)) return; - - xin = x; yin = y; - RECTS_CLIP_TO_RECT(x,y,w,h, clx,cly,clw,clh); - if ((w < 1) || (h < 1)) return; - - if ((oim->cur.fill.spread == _EVAS_TEXTURE_RESTRICT) && (dc->render_op != _EVAS_RENDER_FILL)) - { - int x0 = 0, y0 = 0, w0 = 0, h0 = 0; - - /* use one pixel border around fill to account for fuzzies... */ - evas_common_transform_affine_rect_bounds_get(&oim->cur.fill.transform, - oim->cur.fill.x - 1, oim->cur.fill.y - 1, - oim->cur.fill.w + 2, oim->cur.fill.h + 2, - &x0, &y0, &w0, &h0); - RECTS_CLIP_TO_RECT(x,y,w,h, x0 + xin,y0 + yin,w0,h0); - if ((w < 1) || (h < 1)) return; - } - - xoff = (x - xin); - yoff = (y - yin); - - /* - a quick hackism to take care of a simple but somewhat important case, - will have a better go at this a bit later. - */ - if ( oim->cur.fill.transform.is_identity && (oim->cur.fill.w == sw) && (oim->cur.fill.h == sh) && - (xoff >= oim->cur.fill.x) && (yoff >= oim->cur.fill.y) && - ((oim->cur.fill.x + sw) >= (xoff + w)) && ((oim->cur.fill.y + sh) >= (yoff + h)) ) - { - _evas_common_image_draw_simple(dst, dc, im, - xoff - oim->cur.fill.x, yoff - oim->cur.fill.y, x, y, w, h); - return; - } - - if (!evas_common_image_draw_data_setup(oim, &idata)) return; - - buf_has_alpha = im->cache_entry.flags.alpha; - if ( (oim->cur.fill.spread == _EVAS_TEXTURE_RESTRICT) || (!oim->cur.border.center_fill) ) - buf_has_alpha = 1; - - /* we'll ignore masked stuff for now. */ - - dw = dst->cache_entry.w; - col = dc->mul.col; - if ((!dc->mul.use) || (dc->mul.col == 0xffffffff)) - use_col = 0; - if (!use_col && ((dc->render_op == _EVAS_RENDER_FILL) || (dc->render_op == _EVAS_RENDER_COPY))) - { - direct_copy = 1; buf_step = dw; - if (buf_has_alpha) - dst->cache_entry.flags.alpha = 1; - } - else if (!use_col && (dc->render_op == _EVAS_RENDER_BLEND) && (!buf_has_alpha)) - { - direct_copy = 1; buf_step = dw; - } - - if (!direct_copy) - { - buf = alloca(w * sizeof(DATA32)); - if (!buf) return; - argb_buf.cache_entry.flags.alpha = buf_has_alpha; - argb_buf.cache_entry.flags.alpha_sparse = im->cache_entry.flags.alpha_sparse; - if ( (oim->cur.fill.spread == _EVAS_TEXTURE_RESTRICT) || (!oim->cur.border.center_fill) ) - argb_buf.cache_entry.flags.alpha_sparse = 1; - - if (!use_col) - bfunc = evas_common_gfx_func_composite_pixel_span_get(&argb_buf, dst, w, dc->render_op); - else - bfunc = evas_common_gfx_func_composite_pixel_color_span_get(&argb_buf, col, dst, w, dc->render_op); - if (!bfunc) return; - } - - ifunc = evas_common_image_fill_func_get(oim, dc->render_op); - if (!ifunc) return; - - src = im->image.data; - pdst = dst->image.data + (y * dw) + x; - dst_end = pdst + (h * dw); - if (direct_copy) buf = pdst; - - while (pdst < dst_end) - { -#ifdef EVAS_SLI - if ((y % dc->sli.h) == dc->sli.y) - { -#endif - ifunc(src, sw, sh, buf, NULL, w, xoff, yoff, &idata); - if (!direct_copy) - bfunc(buf, NULL, col, pdst, w); -#ifdef EVAS_SLI - y++; - } -#endif - buf += buf_step; - pdst += dw; - yoff++; - } -} - - -EAPI void -evas_common_image_render_pre(RGBA_Draw_Context *dc, void *pim) -{ - Evas_Object_Image *oim = pim; - RGBA_Image *im; - - if (!oim) return; - im = oim->engine_data; - if (!im) return; - if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888) - evas_cache_image_load_data(&im->cache_entry); - evas_common_image_colorspace_normalize(im); -} - - -EAPI void -evas_common_image_draw2(RGBA_Image *dst, RGBA_Draw_Context *dc, - void *pim, int x, int y, int w, int h) -{ - Cutout_Rects *rects; - Cutout_Rect *r; - int c, cx, cy, cw, ch; - int i; - - /* handle cutouts here! */ - - if (!dc || !dst || !dst->image.data) return; - if ((w < 1) || (h < 1)) return; - if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) - return; - /* save out clip info */ - c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h; - evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h); - /* no cutouts - cut right to the chase */ - if (!dc->cutout.rects) - { - _evas_common_image_draw2(dst, dc, pim, x, y, w, h); - } - else - { - evas_common_draw_context_clip_clip(dc, x, y, w, h); - /* our clip is 0 size.. abort */ - if ((dc->clip.w > 0) && (dc->clip.h > 0)) - { - rects = evas_common_draw_context_apply_cutouts(dc); - for (i = 0; i < rects->active; ++i) - { - r = rects->rects + i; - evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); - _evas_common_image_draw2(dst, dc, pim, x, y, w, h); - } - evas_common_draw_context_apply_clear_cutouts(rects); - } - } - /* restore clip info */ - dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; - evas_common_cpu_end_opt(); -} diff --git a/src/lib/engines/common/evas_image_fill_main.c b/src/lib/engines/common/evas_image_fill_main.c index 1b97785..f301c91 100644 --- a/src/lib/engines/common/evas_image_fill_main.c +++ b/src/lib/engines/common/evas_image_fill_main.c @@ -166,41 +166,41 @@ evas_common_image_draw_data_setup(void *pim, Image_Draw_Data *idata) EAPI Gfx_Func_Image_Fill evas_common_image_fill_func_get(void *pim, int render_op) { - Evas_Object_Image *oim = pim; - RGBA_Image *im; - Gfx_Func_Image_Fill sfunc = NULL; - int masked_op = 0; - - if (!oim) return sfunc; - im = oim->engine_data; - if (!im) return sfunc; - - if ( (render_op == _EVAS_RENDER_COPY) || (render_op == _EVAS_RENDER_COPY_REL) || - (render_op == _EVAS_RENDER_MASK) || (render_op == _EVAS_RENDER_MUL) ) - masked_op = 1; - - switch (oim->cur.fill.spread) - { - case _EVAS_TEXTURE_REPEAT: - sfunc = image_repeat_affine_get(oim, render_op); + Evas_Object_Image *oim = pim; + RGBA_Image *im; + Gfx_Func_Image_Fill sfunc = NULL; + int masked_op = 0; + + if (!oim) return sfunc; + im = oim->engine_data; + if (!im) return sfunc; + + if ( (render_op == _EVAS_RENDER_COPY) || (render_op == _EVAS_RENDER_COPY_REL) || + (render_op == _EVAS_RENDER_MASK) || (render_op == _EVAS_RENDER_MUL) ) + masked_op = 1; + + switch (oim->cur.fill.spread) + { + case _EVAS_TEXTURE_REPEAT: + sfunc = image_repeat_affine_get(oim, render_op); break; - case _EVAS_TEXTURE_REFLECT: - sfunc = image_reflect_affine_get(oim, render_op); + case _EVAS_TEXTURE_REFLECT: + sfunc = image_reflect_affine_get(oim, render_op); break; - case _EVAS_TEXTURE_RESTRICT: - if (masked_op) - sfunc = image_restrict_masked_affine_get(oim, render_op); - else - sfunc = image_restrict_affine_get(oim, render_op); + case _EVAS_TEXTURE_RESTRICT: + if (masked_op) + sfunc = image_restrict_masked_affine_get(oim, render_op); + else + sfunc = image_restrict_affine_get(oim, render_op); break; - case _EVAS_TEXTURE_PAD: - sfunc = image_pad_affine_get(oim, render_op); + case _EVAS_TEXTURE_PAD: + sfunc = image_pad_affine_get(oim, render_op); break; - default: - sfunc = image_repeat_affine_get(oim, render_op); + default: + sfunc = image_repeat_affine_get(oim, render_op); break; - } - return sfunc; + } + return sfunc; } diff --git a/src/lib/engines/common/evas_image_fill_pad.c b/src/lib/engines/common/evas_image_fill_pad.c deleted file mode 100644 index ef24082..0000000 --- a/src/lib/engines/common/evas_image_fill_pad.c +++ /dev/null @@ -1,10 +0,0 @@ - - -/* pad funcs */ - -/* FIXME: implement pad */ - -static Gfx_Func_Image_Fill image_pad_affine_get(void *pim, int render_op) -{ - return NULL; -} diff --git a/src/lib/engines/common/evas_image_fill_reflect.c b/src/lib/engines/common/evas_image_fill_reflect.c deleted file mode 100644 index 0024dc8..0000000 --- a/src/lib/engines/common/evas_image_fill_reflect.c +++ /dev/null @@ -1,1476 +0,0 @@ - - -/* reflect funcs */ - - -/* FIXME: implement optimiztions and special-cases for this mode */ - - -static void -src_a8r8g8b8_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - int ax = 1 + ((xx >> 8) & 0xff); - int ay = 1 + ((yy >> 8) & 0xff); - DATA32 *p, p3, p2, p1, p0; - - x = (xx >> 16); y = (yy >> 16); - if (x < 0) { x = -x; ax = 257 - ax; } - if (x >= iw) - { - int m = (x % (2 * iw)); - - x = (x % iw); - if (m >= iw) - { x = iw - x - 1; ax = 257 - ax; } - } - - if (y < 0) { y = -y; ay = 257 - ay; } - if (y >= ih) - { - int m = (y % (2 * ih)); - - y = (y % ih); - if (m >= ih) - { y = ih - y - 1; ay = 257 - ay; } - } - - p = im + (y * iw) + x; - p0 = p1 = p2 = p3 = *p; - if ((x + 1) < iw) - p1 = *(p + 1); - if ((y + 1) < ih) - { - p2 = *(p + iw); - if ((x + 1) < iw) - p3 = *(p + iw + 1); - } -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - axx = (axx * iaxx) >> 16; axy = (axy * iaxx) >> 16; - axz = ((axz - 32768) * iaxx) >> 16; - ayx = (ayx * iayy) >> 16; ayy = (ayy * iayy) >> 16; - ayz = ((ayz - 32768) * iayy) >> 16; - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - int ax = 1 + ((xx >> 8) & 0xff), ay = 1 + ((yy >> 8) & 0xff); - DATA32 *p, p3, p2, p1, p0; - - x = (xx >> 16); y = (yy >> 16); - if (x < 0) { x = -x; ax = 257 - ax; } - if (x >= iw) - { - int m = (x % (2 * iw)); - - x = (x % iw); - if (m >= iw) - { x = iw - x - 1; ax = 257 - ax; } - } - - if (y < 0) { y = -y; ay = 257 - ay; } - if (y >= ih) - { - int m = (y % (2 * ih)); - - y = (y % ih); - if (m >= ih) - { y = ih - y - 1; ay = 257 - ay; } - } - - p = im + (y * iw) + x; - p0 = p1 = p2 = p3 = *p; - if ((x + 1) < iw) - p1 = *(p + 1); - if ((y + 1) < ih) - { - p2 = *(p + iw); - if ((x + 1) < iw) - p3 = *(p + iw + 1); - } - -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_d_u_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int dax = idata->dax; - int ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - int iyy, ixx, ix, iy; - int txx, ntxx, tx, ntx; - DATA32 *p, p2, p1, p0 = 0; - int sgnx = 1, sgny = 1; - int ay; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - x = xx >> 16; y = yy >> 16; - if (x < 0) { x = -x; sgnx *= -1; } - if (x >= fw) - { - int m = (x % (2 * fw)); - - x = (x % fw); - if (m >= fw) - { x = fw - x - 1; sgnx *= -1; } - } - - if (y < 0) { y = -y; sgny *= -1; } - if (y >= fh) - { - int m = (y % (2 * fh)); - - y = (y % fh); - if (m >= fh) - { y = fh - y - 1; sgny *= -1; } - } - - iyy = (iayy * y); iy = iyy >> 16; - ixx = (iaxx * x); ix = ixx >> 16; - - ay = 1 + ((iyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm6) -#endif - p = im + (iy * iw) + ix; - - txx = (ibxx * ix); tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - - while (ix < iw) - { - p1 = p2 = *p; - if (iy + 1 < ih) p2 = *(p + iw); - -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p2) - { - MOV_P2R(p2, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p2) - p1 = INTERP_256(ay, p2, p1); -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_u_d_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day; - int ibyy = idata->ibyy; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - while (d < e) - { - int ixx, iyy, ix, iy; - int tyy, ntyy, ty, nty; - DATA32 *p, p3, p1, p0 = 0; - int sgnx = 1, sgny = 1; - int ax; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - x = (xx >> 16); y = (yy >> 16); - if (x < 0) { x = -x; sgnx *= -1; } - if (x >= fw) - { - int m = (x % (2 * fw)); - - x = (x % fw); - if (m >= fw) - { x = fw - x - 1; sgnx *= -1; } - } - - if (y < 0) { y = -y; sgny *= -1; } - if (y >= fh) - { - int m = (y % (2 * fh)); - - y = (y % fh); - if (m >= fh) - { y = fh - y - 1; sgny *= -1; } - } - - ixx = (iaxx * x); ix = ixx >> 16; - iyy = (iayy * y); iy = iyy >> 16; - - ax = 1 + ((ixx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm6) -#endif - p = im + (iy * iw) + ix; - - tyy = (ibyy * iy); ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - - while (iy < ih) - { - p3 = p1 = *p; - if ((ix + 1) < iw) p3 = *(p + 1); - -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ax, p3, p1); -#endif - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_d_d_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day, dax = idata->dax; - int ibyy = idata->ibyy, ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) - MOV_A2R(day, mm7) -#endif - while (d < e) - { - int ixx, iyy, ix, ix0, iy; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy, ntyy, ty, nty; - DATA32 *p, *ps, p3, p2, p0 = 0; - int sgnx = 1, sgny = 1; - - x = (xx >> 16); y = (yy >> 16); - if (x < 0) { x = -x; sgnx *= -1; } - if (x >= fw) - { - int m = (x % (2 * fw)); - - x = (x % fw); - if (m >= fw) - { x = fw - x - 1; sgnx *= -1; } - } - - if (y < 0) { y = -y; sgny *= -1; } - if (y >= fh) - { - int m = (y % (2 * fh)); - - y = (y % fh); - if (m >= fh) - { y = fh - y - 1; sgny *= -1; } - } - - ixx = (iaxx * x); ix0 = (ixx >> 16); - iyy = (iayy * y); iy = (iyy >> 16); - - ps = im + (iy * iw); - - tyy = (ibyy * iy); ty = (tyy >> 16); - ntyy = tyy + ibyy; nty = (ntyy >> 16); - - txx0 = (ibxx * ix0); tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - while (iy < ih) - { - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#else - p2 = 0; -#endif - while (ix < iw) - { - p3 = *p; -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p2 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p2 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p2 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p2 && (ty == y)) - p0 += MUL_256(day, p2); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - int ixx, ix, iyy, iy; - int ax, ay; - int sgnx = 1, sgny = 1; - DATA32 *p, p3, p2, p1, p0; - - x = (xx >> 16); y = (yy >> 16); - if (x < 0) { x = -x; sgnx *= -1; } - if (x >= fw) - { - int m = (x % (2 * fw)); - - x = (x % fw); - if (m >= fw) - { x = fw - x - 1; sgnx *= -1; } - } - - if (y < 0) { y = -y; sgny *= -1; } - if (y >= fh) - { - int m = (y % (2 * fh)); - - y = (y % fh); - if (m >= fh) - { y = fh - y - 1; sgny *= -1; } - } - - ixx = (iaxx * (x - l)); ix = l + (ixx >> 16); - iyy = (iayy * (y - t)); iy = t + (iyy >> 16); - - ax = 1 + ((ixx >> 8) & 0xff); - ay = 1 + ((iyy >> 8) & 0xff); - - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - if (sgnx < 0) ax = 257 - ax; - } - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - if (sgny < 0) ay = 257 - ay; - } - - p = im + (iy * iw) + ix; - p0 = p1 = p2 = p3 = *p; - if ((ix + 1) < iw) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } - -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_d_u_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx; - int dax = idata->dax; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha && idata->border_center_fill; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - int iyy, ixx, ix, iy; - int txx, ntxx, tx, ntx; - DATA32 *p, p3, p2, p1, p0 = 0; - int sgnx = 1, sgny = 1; - int ay, ax; - - x = (xx >> 16); y = (yy >> 16); - if (x < 0) { x = -x; sgnx *= -1; } - if (x >= fw) - { - int m = (x % (2 * fw)); - - x = (x % fw); - if (m >= fw) - { x = fw - x - 1; sgnx *= -1; } - } - - if (y < 0) { y = -y; sgny *= -1; } - if (y >= fh) - { - int m = (y % (2 * fh)); - - y = (y % fh); - if (m >= fh) - { y = fh - y - 1; sgny *= -1; } - } - - iyy = (iayy * (y - t)); iy = t + (iyy >> 16); - ay = 1 + ((iyy >> 8) & 0xff); - - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - if (sgny < 0) ay = 257 - ay; - } -#ifdef BUILD_MMX - MOV_A2R(ay, mm7) -#endif - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - if (sgnx < 0) ax = 257 - ax; - - p = im + (iy * iw) + ix; - p0 = p1 = p2 = p3 = *p; - if ((ix + 1) < iw) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } - -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - INTERP_256_R2R(mm7, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - ixx = iaxx * (x - l); ix = (ixx >> 16); - txx = (ibxx * ix) + ll; ix += l; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - p = im + (iy * iw) + ix; - - while (ix < iw) - { - p3 = p1 = *p; - if (iy + 1 < ih) p3 = *(p + iw); -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - done: - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_u_d_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibyy = idata->ibyy; - int day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha && idata->border_center_fill; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - while (d < e) - { - int iyy, ixx, ix, iy; - int tyy, ntyy, ty, nty; - DATA32 *p, p3, p2, p1, p0 = 0; - int sgnx = 1, sgny = 1; - int ay, ax; - - x = (xx >> 16); y = (yy >> 16); - if (x < 0) { x = -x; sgnx *= -1; } - if (x >= fw) - { - int m = (x % (2 * fw)); - - x = (x % fw); - if (m >= fw) - { x = fw - x - 1; sgnx *= -1; } - } - - if (y < 0) { y = -y; sgny *= -1; } - if (y >= fh) - { - int m = (y % (2 * fh)); - - y = (y % fh); - if (m >= fh) - { y = fh - y - 1; sgny *= -1; } - } - - ixx = (iaxx * (x - l)); ix = l + (ixx >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - if (sgnx < 0) ax = 257 - ax; - } -#ifdef BUILD_MMX - MOV_A2R(ax, mm7) -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - if (sgny < 0) ay = 257 - ay; - - p = im + (iy * iw) + ix; - p0 = p1 = p2 = p3 = *p; - if ((ix + 1) < iw) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm7, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - iyy = (iayy * (y - t)); iy = iyy >> 16; - tyy = (ibyy * iy) + tt; iy += t; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - p = im + (iy * iw) + ix; - - while (iy < ih) - { - p3 = p1 = *p; - if ((ix + 1) < iw) p3 = *(p + 1); -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ax, p3, p1); -#endif - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - done: - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_d_d_reflect(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx, ibyy = idata->ibyy; - int dax = idata->dax, day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha && idata->border_center_fill; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) - MOV_A2R(day, mm7) -#endif - while (d < e) - { - int iyy, ixx, ix, ix0, iy; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy, ntyy, ty, nty; - DATA32 *p, *ps, p3, p2, p1, p0 = 0; - int sgnx = 1, sgny = 1; - int ay, ax; - - x = (xx >> 16); y = (yy >> 16); - if (x < 0) { x = -x; sgnx *= -1; } - if (x >= fw) - { - int m = (x % (2 * fw)); - - x = (x % fw); - if (m >= fw) - { x = fw - x - 1; sgnx *= -1; } - } - - if (y < 0) { y = -y; sgny *= -1; } - if (y >= fh) - { - int m = (y % (2 * fh)); - - y = (y % fh); - if (m >= fh) - { y = fh - y - 1; sgny *= -1; } - } - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - if (sgny < 0) ay = 257 - ay; -#ifdef BUILD_MMX - MOV_A2R(ay, mm6) -#endif - - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - if (sgnx < 0) ax = 257 - ax; - - p = im + (iy * iw) + ix; - p0 = p1 = p2 = p3 = *p; - - if ((ix + 1) < iw) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } -#ifdef BUILD_MMX - MOV_P2R(p0, mm1, mm0) - if (p0 | p1 | p2 | p3) - { - MOV_A2R(ax, mm3) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm4, mm0) - INTERP_256_R2R(mm3, mm4, mm2, mm5) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_A2R(dax, mm4) - } -#else - if (p0 | p1 | p2 | p3) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - - ixx = iaxx * (x - l); ix = ixx >> 16; - txx = (ibxx * ix) + ll; ix += l; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - - p = im + (iy * iw) + ix; - while (ix < iw) - { - p3 = p1 = *p; - if (iy + 1 < ih) p3 = *(p + iw); -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - goto done; - } - - iyy = iayy * (y - t); iy = iyy >> 16; - tyy = (ibyy * iy) + tt; iy += t; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - if (sgnx < 0) ax = 257 - ax; -#ifdef BUILD_MMX - MOV_A2R(ax, mm6) -#endif - - p = im + (iy * iw) + ix; - while (iy < ih) - { - p3 = p1 = *p; - if ((ix + 1) < iw) p3 = *(p + 1); -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ax, p3, p1); -#endif - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - goto done; - } - - ixx = iaxx * (x - l); ix0 = ixx >> 16; - txx0 = (ibxx * ix0) + ll; ix0 += l; - tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - ps = im + (iy * iw); - - while (iy < ih) - { - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#else - p1 = 0; -#endif - while (ix < iw) - { - p3 = *p; -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p1 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p1 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p1 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - done: -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; xx += axx; yy += ayx; - } -} - - - -static Gfx_Func_Image_Fill image_reflect_affine_get(void *pim, int render_op) -{ - Evas_Object_Image *oim = pim; - Gfx_Func_Image_Fill func = NULL; - int src_scaled = 0, src_smooth = 0, src_border = 0; - - if ((oim->cur.image.w != oim->cur.fill.w) || (oim->cur.image.h != oim->cur.fill.h)) - src_scaled = 1; - if (oim->cur.smooth_scale) - src_smooth = 1; - if ((oim->cur.image.w <= oim->cur.fill.w) && (oim->cur.image.h <= oim->cur.fill.h)) - src_smooth = 0; - if ( (oim->cur.border.l > 0) || (oim->cur.border.r > 0) || - (oim->cur.border.t > 0) || (oim->cur.border.b > 0) ) - src_border = 1; - if (!src_scaled && oim->cur.border.center_fill) - src_border = 0; - - func = src_a8r8g8b8_reflect; - if (src_scaled) - { - if (src_border) - { - func = src_a8r8g8b8_border_scaled_reflect; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h <= oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_u_reflect; - if ((oim->cur.image.w <= oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_u_d_reflect; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_d_reflect; - } - } - else - { - func = src_a8r8g8b8_scaled_reflect; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h <= oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_u_reflect; - if ((oim->cur.image.w <= oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_u_d_reflect; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_d_reflect; - } - } - } - - return func; -} diff --git a/src/lib/engines/common/evas_image_fill_repeat.c b/src/lib/engines/common/evas_image_fill_repeat.c deleted file mode 100644 index d552222..0000000 --- a/src/lib/engines/common/evas_image_fill_repeat.c +++ /dev/null @@ -1,3083 +0,0 @@ - -/* repeat funcs */ - - -/* identity transform */ - -static void -src_a8r8g8b8_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - DATA32 *q, *qe; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= iw) || (x < -iw)) x = x % iw; - if (x < 0) x += iw; - if ((y >= ih) || (y < -ih)) y = y % ih; - if (y < 0) y += ih; - im += (y * iw); - - q = im + x; - if (x + len <= iw) - { - while (d < e) - *d++ = *q++; - return; - } - - qe = im + iw; - while (d < e) - { - *d++ = *q++; - if (q == qe) q = im; - } -} - -static void -src_a8r8g8b8_scaled_x_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - DATA32 *p; - int iaxx = idata->iaxx; - int fw = idata->fw; - int ixx, iww = iw << 16; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= ih) || (y < -ih)) y = y % ih; - if (y < 0) y += ih; - p = im + (y * iw); - ixx = iaxx * x; -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - int ix; - int ax; - DATA32 *q0, *q1; - DATA32 p0, p1; - - if (ixx >= iww) ixx = 0; - ix = ixx >> 16; - q0 = p + ix; q1 = p; - if ((ix + 1) < iw) - q1 = p + ix + 1; - p0 = *q0; p1 = *q1; - if (p0 | p1) -#ifdef BUILD_MMX - { - ax = 1 + ((ixx >> 8) & 0xff); - MOV_A2R(ax, mm3) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - ax = 1 + ((ixx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - } -#endif - *d++ = p0; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_scaled_y_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - DATA32 *p; - int iayy = idata->iayy; - int fw = idata->fw, fh = idata->fh; - int iyy, iy; - int ay; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= iw) || (x < -iw)) x = x % iw; - if (x < 0) x += iw; - iyy = iayy * y; - iy = iyy >> 16; - if ((iy >= ih) || (iy < -ih)) iy = iy % ih; - if (iy < 0) iy += ih; - p = im + (iy * iw); - ay = 1 + ((iyy >> 8) & 0xff); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(ay, mm3) -#endif - while (d < e) - { - DATA32 *q0, *q2; - DATA32 p0, p2; - - if (x == iw) x = 0; - q0 = p + x; q2 = im + x; - if ((iy + 1) < ih) - q2 = p + iw + x; - p0 = *q0; p2 = *q2; - if (p0 | p2) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p2, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ay, p2, p0); -#endif - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_scaled_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len, *p; - int iaxx = idata->iaxx, iayy = idata->iayy; - int fw = idata->fw, fh = idata->fh; - int ixx, iyy, ay, iww = iw << 16; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - ixx = (iaxx * x); - iyy = (iayy * y); - if (iyy >= (ih << 16)) iyy = 0; - y = iyy >> 16; - ay = 1 + ((iyy >> 8) & 0xff); - p = im + (y * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(ay, mm4) -#endif - while (d < e) - { - int ix; - int ax; - DATA32 *q3, *q2, *q1, *q0; - DATA32 p3, p2, p1, p0; - - if (ixx >= iww) ixx = 0; - ix = ixx >> 16; - q0 = p + ix; - q1 = q0 - ix; q2 = im + ix; q3 = im; - if (ix + 1 < iw) - q1 = q0 + 1; - if (y + 1 < ih) - { - q2 = q0 + iw; - q3 = q1 + iw; - } - p0 = *q0; p1 = *q1; p2 = *q2; p3 = *q3; -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((ixx >> 8) & 0xff); - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - INTERP_256_R2R(mm4, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((ixx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - *d++ = p0; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_scaled_dx_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx; - int dax = idata->dax; - int ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - DATA32 *q; - int no_alpha = !idata->has_alpha; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= ih) || (y < -ih)) y = y % ih; - if (y < 0) y += ih; - q = im + (y * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - int ixx, ix; - int txx, ntxx, tx, ntx; - int ay; - DATA32 *p; -#ifndef BUILD_MMX - DATA32 p0 = 0; -#else - pxor_r2r(mm1, mm1); -#endif - if (x == fw) x = 0; - ixx = iaxx * x; ix = ixx >> 16; - txx = (ibxx * ix); tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - p = q + ix; - while (ix < iw) - { - DATA32 p1 = *p; - -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } - else if (p1 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, *d, mm0) - if (no_alpha) *d |= 0xff000000; -#else - if (no_alpha) p0 |= 0xff000000; - *d = p0; -#endif - d++; x++; - } -} - -static void -src_a8r8g8b8_scaled_dy_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iayy = idata->iayy; - int day = idata->day; - int ibyy = idata->ibyy; - int fw = idata->fw, fh = idata->fh; - int iyy0, iy0; - int tyy0, ty0, ntyy0, nty0; - DATA32 *q; - int no_alpha = !idata->has_alpha; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= iw) || (x < -iw)) x = x % iw; - if (x < 0) x += iw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - iyy0 = (iayy * y); - iy0 = iyy0 >> 16; - tyy0 = (ibyy * iy0); ty0 = tyy0 >> 16; - ntyy0 = tyy0 + ibyy; nty0 = ntyy0 >> 16; - q = im + (iy0 * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(day, mm4) -#endif - while (d < e) - { - int iy = iy0; - int tyy = tyy0, ntyy = ntyy0, ty = ty0, nty = nty0; - DATA32 *p; -#ifndef BUILD_MMX - DATA32 p0 = 0; -#else - pxor_r2r(mm1, mm1); -#endif - if (x == iw) x = 0; - p = q + x; - while (iy < ih) - { - DATA32 p2 = *p; - -#ifdef BUILD_MMX - MOV_P2R(p2, mm2, mm0) -#endif - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } - else if (p2 && (ty == y)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - p0 += MUL_256(day, p2); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, *d, mm0) - if (no_alpha) *d |= 0xff000000; -#else - if (no_alpha) p0 |= 0xff000000; - *d = p0; -#endif - d++; x++; - } -} - -static void -src_a8r8g8b8_scaled_d_u_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int dax = idata->dax; - int ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int iyy, iy; - int ay; - DATA32 *q; - int no_alpha = !idata->has_alpha; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - iyy = (iayy * y); iy = iyy >> 16; - ay = 1 + ((iyy >> 8) & 0xff); - q = im + (iy * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) - MOV_A2R(ay, mm6) -#endif - while (d < e) - { - int ixx, ix; - int txx, ntxx, tx, ntx; - DATA32 *p; -#ifndef BUILD_MMX - DATA32 p0 = 0; -#else - pxor_r2r(mm1, mm1); -#endif - if (x == fw) x = 0; - ixx = (iaxx * x); ix = ixx >> 16; - txx = (ibxx * ix); tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - p = q + ix; - while (ix < iw) - { - DATA32 *q3, p3, p1; - - q3 = im + ix; - if ((iy + 1) < ih) - q3 = p + iw; - p1 = *p; p3 = *q3; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, *d, mm0) - if (no_alpha) *d |= 0xff000000; -#else - if (no_alpha) p0 |= 0xff000000; - *d = p0; -#endif - d++; x++; - } -} - -static void -src_a8r8g8b8_scaled_u_d_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day; - int ibyy = idata->ibyy; - int fw = idata->fw, fh = idata->fh; - int ixx, iyy0, iy0; - int tyy0, ty0, ntyy0, nty0; - DATA32 *q; - int iww = iw << 16; - int no_alpha = !idata->has_alpha; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - - ixx = (iaxx * x); - if (ixx >= iww) ixx = 0; - iyy0 = (iayy * y); iy0 = iyy0 >> 16; - tyy0 = (ibyy * iy0); ty0 = tyy0 >> 16; - ntyy0 = tyy0 + ibyy; nty0 = ntyy0 >> 16; - q = im + (iy0 * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - while (d < e) - { - int ix, iy = iy0; - int tyy = tyy0, ntyy = ntyy0, ty = ty0, nty = nty0; - int ax; - DATA32 *p; -#ifndef BUILD_MMX - DATA32 p0 = 0; -#else - pxor_r2r(mm1, mm1); -#endif - if (ixx >= iww) ixx = 0; - ix = ixx >> 16; - ax = 1 + ((ixx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm6) -#endif - p = q + ix; - while (iy < ih) - { - DATA32 *q3 = q, p3, p2; - - if ((ix + 1) < iw) - q3 = p + 1; - p2 = *p; p3 = *q3; -#ifdef BUILD_MMX - MOV_P2R(p2, mm2, mm0) - if (p2 | p3) - { - MOV_P2R(p3, mm7, mm0) - INTERP_256_R2R(mm6, mm7, mm2, mm5) - } -#else - if (p2 | p3) - p2 = INTERP_256(ax, p3, p2); -#endif - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p2 && (ty == y)) - p0 += MUL_256(day, p2); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, *d, mm0) - if (no_alpha) *d |= 0xff000000; -#else - if (no_alpha) p0 |= 0xff000000; - *d = p0; -#endif - d++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_scaled_d_d_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day, dax = idata->dax; - int ibyy = idata->ibyy, ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int iyy0, iy0; - int tyy0, ty0, ntyy0, nty0; - DATA32 *q; - int no_alpha = !idata->has_alpha; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - iyy0 = (iayy * y); iy0 = iyy0 >> 16; - tyy0 = (ibyy * iy0); ty0 = tyy0 >> 16; - ntyy0 = tyy0 + ibyy; nty0 = ntyy0 >> 16; - q = im + (iy0 * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(dax, mm4) - MOV_A2R(day, mm5) -#endif - while (d < e) - { - int ixx, ix, ix0, iy = iy0; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy = tyy0, ntyy = ntyy0, ty = ty0, nty = nty0; - DATA32 *p, *ps; - DATA32 p0 = 0; - - if (x == fw) x = 0; - ixx = (iaxx * x); ix0 = (ixx >> 16); - txx0 = (ibxx * ix0); tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - ps = q; -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - while (iy < ih) - { -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#else - DATA32 p2 = 0; -#endif - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; - while (ix < iw) - { - DATA32 p3 = *p; - -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p2 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p2 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p2 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm5, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p2 && (ty == y)) - p0 += MUL_256(day, p2); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; x++; - } -} - - -static void -src_a8r8g8b8_border_scaled_x_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx; - int l = idata->l, r = idata->r; - int fw = idata->fw, fh = idata->fh; - DATA32 *p; -// int center_fill = idata->border_center_fill; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= ih) || (y < -ih)) y = y % ih; - if (y < 0) y += ih; - p = im + (y * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - int ixx, ix; - int ax; - DATA32 *q1; - DATA32 p1, p0; - - if (x == fw) x = 0; - ixx = iaxx * (x - l); ix = l + (ixx >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - q1 = p; - if ((ix + 1) < iw) - q1 = (p + ix + 1); - p0 = *(p + ix); p1 = *q1; - if (ax && (p0 | p1)) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - MOV_A2R(ax, mm3) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ax, p1, p0); -#endif - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_border_scaled_y_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iayy = idata->iayy; - int t = idata->t, b = idata->b; - int fh = idata->fh; - int iyy, iy; - int ay; - DATA32 *p; -// int center_fill = idata->border_center_fill; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= iw) || (x < -iw)) x = x % iw; - if (x < 0) x += iw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - if ((y < t) || ((y + 2) > (fh - b))) - { - if ((y + 2) > (fh - b)) - y += (ih - fh); - p = im + (y * iw); - while (d < e) - { - if (x == iw) x = 0; - *d++ = *(p + x); x++; - } - return; - } - - iyy = iayy * (y - t); - iy = t + (iyy >> 16); - ay = 1 + ((iyy >> 8) & 0xff); - p = im + (iy * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(ay, mm3) -#endif - while (d < e) - { - DATA32 *q2; - DATA32 p2, p0; - - if (x == iw) x = 0; - q2 = im + x; - if ((iy + 1) < ih) - q2 = p + iw + x; - p0 = *(p + x); p2 = *q2; - if (p0 | p2) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p2, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ay, p2, p0); -#endif - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_border_scaled_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int ay, iy; - DATA32 *q; -// int center_fill = idata->border_center_fill; - - x += (idata->axz >> 16); y += (idata->ayz >> 16); - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - - if ((y < t) || ((y + 2) > (fh - b))) - { - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - - q = im + (iy * iw); - while (d < e) - { - int ixx, ix; - int ax; - DATA32 p1, p0; - - if (x == fw) x = 0; - ixx = iaxx * (x - l); - ix = l + (ixx >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - - p0 = *(q + ix); p1 = *q; - if (ix + 1 < iw) - p1 = *(q + ix + 1); - - if (ax && (p0 | p1)) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - MOV_A2R(ax, mm3) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ax, p1, p0); -#endif - *d++ = p0; x++; - } - return; - } - - iy = iayy * (y - t); - ay = 1 + ((iy >> 8) & 0xff); - iy = t + (iy >> 16); - q = im + (iy * iw); -#ifdef BUILD_MMX - MOV_A2R(ay, mm4) -#endif - while (d < e) - { - int ixx, ix; - int ax; - DATA32 *q3, *q2, *q1, *q0; - DATA32 p3, p2, p1, p0; - - if (x == fw) x = 0; - ixx = iaxx * (x - l); - ix = l + (ixx >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - q0 = q + ix; - q1 = q; q2 = im + ix; q3 = im; - if (ix + 1 < iw) - q1 = q0 + 1; - if (iy + 1 < ih) - { - q2 = q0 + iw; - q3 = q1 + iw; - } - p0 = *q0; p1 = *q1; p2 = *q2; p3 = *q3; - if (p0 | p1 | p2 | p3) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p2, mm2, mm0) - if (ax) - { - MOV_P2R(p1, mm3, mm0) - MOV_A2R(ax, mm6) - INTERP_256_R2R(mm6, mm3, mm1, mm5) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } - INTERP_256_R2R(mm4, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - if (ax) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - } - p0 = INTERP_256(ay, p2, p0); - } -#endif - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_border_scaled_d_u_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx; - int dax = idata->dax; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int iyy, iy; - int ay; - DATA32 *q; - int no_alpha = !idata->has_alpha && idata->border_center_fill; -// int center_fill = idata->border_center_fill; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - iyy = (iayy * (y - t)); iy = iyy >> 16; - ay = 1 + ((iyy >> 8) & 0xff); - iy += t; - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 0; - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - } - q = im + (iy * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(ay, mm6) - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - int ixx, ix; - int txx, ntxx, tx, ntx; - DATA32 *p, *q2; - DATA32 p2, p0 = 0; - - if (x == fw) x = 0; - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - p = q + ix; - p0 = *p; - if (ay) - { - q2 = (im + ix); - if ((iy + 1) < ih) - q2 = (p + iw); - p2 = *q2; - if (p0 | p2) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p2, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ay, p2, p0); -#endif - } - goto done; - } - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - ixx = (iaxx * (x - l)); ix = ixx >> 16; - txx = (ibxx * ix) + ll; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - ix += l; - p = q + ix; - while (ix < iw) - { - DATA32 p1 = *p; - -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (ay) - { - q2 = (im + ix); - if ((iy + 1) < ih) - q2 = (p + iw); - p2 = *q2; - if (p1 | p2) -#ifdef BUILD_MMX - { - MOV_P2R(p2, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - p1 = INTERP_256(ay, p2, p1); -#endif - } - - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - done: - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_border_scaled_u_d_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibyy = idata->ibyy; - int day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int no_alpha = !idata->has_alpha && idata->border_center_fill; -// int center_fill = idata->border_center_fill; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - DATA32 *p; - int iy = y; - - if ((y + 2) > (fh - b)) - iy += (ih - fh); - p = im + (iy * iw); - while (d < e) - { - int ixx, ix; - int ax; - DATA32 *q1, p1, p0; - - if (x == fw) x = 0; - ixx = (iaxx * (x - l)); ix = ixx >> 16; - ax = 1 + ((ixx >> 8) & 0xff); - ix += l; - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - p0 = *(p + ix); - if (ax) - { - q1 = p; - if ((ix + 1) < iw) - q1 = (p + ix + 1); - p1 = *q1; - if (p0 | p1) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - MOV_A2R(ax, mm3) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ax, p1, p0); -#endif - } - *d++ = p0; x++; - } - return; - } - - while (d < e) - { - int iyy, ixx, ix, iy; - int tyy, ntyy, ty, nty; - int ax; - DATA32 *p, p0 = 0; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if (x == fw) x = 0; - ixx = (iaxx * (x - l)); ix = ixx >> 16; - ax = 1 + ((ixx >> 8) & 0xff); - ix += l; - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - iyy = (iayy * (y - t)); iy = iyy >> 16; - tyy = (ibyy * iy) + tt; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - iy += t; - p = im + (iy * iw) + ix; - while (iy < ih) - { - DATA32 *q3, p3, p1 = *p; - -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (ax) - { - q3 = (p - ix); - if ((ix + 1) < iw) - q3 = (p + 1); - p3 = *q3; - if (p1 | p3) -#ifdef BUILD_MMX - { - MOV_P2R(p3, mm3, mm0) - MOV_A2R(ax, mm6) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - p1 = INTERP_256(ax, p3, p1); -#endif - } - - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_border_scaled_d_d_repeat_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx, ibyy = idata->ibyy; - int dax = idata->dax, day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int no_alpha = !idata->has_alpha && idata->border_center_fill; -// int center_fill = idata->border_center_fill; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(dax, mm4) - MOV_A2R(day, mm5) -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - DATA32 *q; - int iy = y; - - if ((y + 2) > (fh - b)) - iy += (ih - fh); - q = im + (iy * iw); - while (d < e) - { - int ixx, ix; - int txx, ntxx, tx, ntx; - DATA32 *p, p1, p0 = 0; - int ax; - - if (x == fw) x = 0; - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - p0 = *(q + ix); - goto done_t; - } - - ixx = iaxx * (x - l); ix = ixx >> 16; - txx = (ibxx * ix) + ll; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - ix += l; - p = q + ix; -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - while (ix < iw) - { - p1 = *p; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } - else if (p1 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - done_t: - *d++ = p0; x++; - } - return; - } - - while (d < e) - { - int iyy, ixx, ix, ix0, iy; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy, ntyy, ty, nty; - DATA32 *p, *ps, p0 = 0; - int ay, ax; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - iyy = iayy * (y - t); iy = iyy >> 16; - tyy = (ibyy * iy) + tt; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - iy += t; - if (x == fw) x = 0; - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - - p = im + (iy * iw) + ix; - while (iy < ih) - { - DATA32 p1 = *p; - -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } - else if (p1 && (ty == y)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm5, mm2) - paddw_r2r(mm2, mm1); - } -#else - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - goto done; - } - - ixx = iaxx * (x - l); ix0 = ixx >> 16; - txx0 = (ibxx * ix0) + ll; - tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - ps = im + (iy * iw); - ix0 += l; - while (iy < ih) - { - DATA32 p1 = 0; - - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#endif - while (ix < iw) - { - DATA32 p3 = *p; -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p1 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p1 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p1 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm5, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - done: -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; x++; - } -} - -/* also maybe border_scaled_dx/dy_repeat_simple */ - - -/* with transform */ - -static void -src_a8r8g8b8_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - int ax, ay; - DATA32 *q3, *q2, *q1, *q0; - DATA32 p3, p2, p1, p0; - - x = xx >> 16; - if ((x >= iw) || (x < -iw)) - x = x % iw; - if (x < 0) - x += iw; - y = yy >> 16; - if ((y >= ih) || (y < -ih)) - y = y % ih; - if (y < 0) - y += ih; - - q0 = im + (y * iw) + x; - q1 = q0 - x; q2 = im + x; q3 = im; - if (x + 1 < iw) - q1 = q0 + 1; - if (y + 1 < ih) - { - q2 = q0 + iw; - q3 = q1 + iw; - } - p0 = *q0; p1 = *q1; p2 = *q2; p3 = *q3; -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - ay = 1 + ((yy >> 8) & 0xff); - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - ay = 1 + ((yy >> 8) & 0xff); - p0 = INTERP_256(ay, p2, p0); - } -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - axx = (axx * iaxx) >> 16; axy = (axy * iaxx) >> 16; - axz = ((axz - 32768) * iaxx) >> 16; - ayx = (ayx * iayy) >> 16; ayy = (ayy * iayy) >> 16; - ayz = ((ayz - 32768) * iayy) >> 16; - xx = (axx * (x + 0.5)) + (axy * (y + 0.5)) + axz; - yy = (ayx * (x + 0.5)) + (ayy * (y + 0.5)) + ayz; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - int ix = xx >> 16, iy = yy >> 16; - int ax, ay; - DATA32 *q3, *q2, *q1, *q0; - DATA32 p3, p2, p1, p0; - - if ((ix >= iw) || (ix < -iw)) - ix = ix % iw; - if (ix < 0) - ix += iw; - if ((iy >= ih) || (iy < -ih)) - iy = iy % ih; - if (iy < 0) - iy += ih; - - q0 = im + (iy * iw) + ix; - q1 = q0 - ix; q2 = im + ix; q3 = im; - if (ix + 1 < iw) - q1 = q0 + 1; - if (iy + 1 < ih) - { - q2 = q0 + iw; - q3 = q1 + iw; - } - p0 = *q0; p1 = *q1; p2 = *q2; p3 = *q3; -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - ay = 1 + ((yy >> 8) & 0xff); - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - ay = 1 + ((yy >> 8) & 0xff); - p0 = INTERP_256(ay, p2, p0); - } -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_d_u_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int dax = idata->dax; - int ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - int iyy, ixx, ix, iy; - int txx, ntxx, tx, ntx; - DATA32 *q0, *q2, p2, p1, p0 = 0; - int ax, ay; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - x = xx >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - y = yy >> 16; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - iyy = (iayy * y); iy = iyy >> 16; - ixx = (iaxx * x); ix = ixx >> 16; - - q0 = im + (iy * iw) + ix; - ay = 1 + ((iyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm6) -#endif - txx = (ibxx * ix); tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - - while (ix < iw) - { - q2 = im + ix; - if (iy + 1 < ih) q2 = q0 + iw; - p1 = *q0; p2 = *q2; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p2) - { - MOV_P2R(p2, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p2) - p1 = INTERP_256(ay, p2, p1); -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - q0++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_u_d_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day; - int ibyy = idata->ibyy; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - while (d < e) - { - int ixx, iyy, ix, iy; - int tyy, ntyy, ty, nty; - DATA32 *q0, *q3, p3, p1, p0 = 0; - int ax; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - x = xx >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - y = yy >> 16; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - ixx = (iaxx * x); ix = ixx >> 16; - iyy = (iayy * y); iy = iyy >> 16; - - ax = 1 + ((ixx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm6) -#endif - q0 = im + (iy * iw); - - tyy = (ibyy * iy); ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - - while (iy < ih) - { - q3 = q0; - if ((ix + 1) < iw) q3 = q0 + ix + 1; - p1 = *(q0 + ix); p3 = *q3; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ax, p3, p1); -#endif - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - q0 += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_d_d_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day, dax = idata->dax; - int ibyy = idata->ibyy, ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) - MOV_A2R(day, mm7) -#endif - while (d < e) - { - int ixx, iyy, ix, ix0, iy; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy, ntyy, ty, nty; - DATA32 *p, *ps, p3, p2, p0 = 0; - - x = xx >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - y = yy >> 16; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - ixx = (iaxx * x); ix0 = (ixx >> 16); - iyy = (iayy * y); iy = (iyy >> 16); - - ps = im + (iy * iw); - - tyy = (ibyy * iy); ty = (tyy >> 16); - ntyy = tyy + ibyy; nty = (ntyy >> 16); - - txx0 = (ibxx * ix0); tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - while (iy < ih) - { - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#else - p2 = 0; -#endif - while (ix < iw) - { - p3 = *p; -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p2 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p2 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p2 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p2 && (ty == y)) - p0 += MUL_256(day, p2); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; -// int center_fill = idata->border_center_fill; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - int ixx, ix, iyy, iy; - int ax, ay; - DATA32 *q3, *q2, *q1, *q0; - DATA32 p3, p2, p1, p0; - - x = xx >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - y = yy >> 16; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - ixx = (iaxx * (x - l)); ix = l + (ixx >> 16); - iyy = (iayy * (y - t)); iy = t + (iyy >> 16); - - ax = 1 + ((ixx >> 8) & 0xff); - ay = 1 + ((iyy >> 8) & 0xff); - - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - } - - q0 = im + (iy * iw) + ix; - q1 = q0 - ix; q2 = im + ix; q3 = im; - if (ix + 1 < iw) - q1 = q0 + 1; - if (iy + 1 < ih) - { - q2 = q0 + iw; - q3 = q1 + iw; - } - p0 = *q0; p1 = *q1; p2 = *q2; p3 = *q3; -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_d_u_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx; - int dax = idata->dax; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha && idata->border_center_fill; -// int center_fill = idata->border_center_fill; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - int iyy, ixx, ix, iy; - int txx, ntxx, tx, ntx; - DATA32 *p, *q3, *q2, *q1; - DATA32 p3, p2, p1, p0 = 0; - int ay, ax; - - x = xx >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - y = yy >> 16; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - iyy = (iayy * (y - t)); iy = t + (iyy >> 16); - ay = 1 + ((iyy >> 8) & 0xff); - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - } -#ifdef BUILD_MMX - MOV_A2R(ay, mm7) -#endif - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - - p = im + (iy * iw) + ix; - q1 = p - ix; q2 = im + ix; q3 = im; - if (ix + 1 < iw) - q1 = p + 1; - if (iy + 1 < ih) - { - q2 = p + iw; - q3 = q1 + iw; - } - p0 = *p; p1 = *q1; p2 = *q2; p3 = *q3; -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - INTERP_256_R2R(mm7, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - ixx = iaxx * (x - l); ix = (ixx >> 16); - txx = (ibxx * ix) + ll; ix += l; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - p = im + (iy * iw) + ix; - - while (ix < iw) - { - q3 = im + ix; - if (iy + 1 < ih) q3 = p + iw; - p1 = *p; p3 = *q3; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - done: - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_u_d_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibyy = idata->ibyy; - int day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha && idata->border_center_fill; -// int center_fill = idata->border_center_fill; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - while (d < e) - { - int iyy, ixx, ix, iy; - int tyy, ntyy, ty, nty; - DATA32 *p, *q3, *q2, *q1; - DATA32 p3, p2, p1, p0 = 0; - int ay, ax; - - x = xx >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - y = yy >> 16; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - - ixx = (iaxx * (x - l)); ix = l + (ixx >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } -#ifdef BUILD_MMX - MOV_A2R(ax, mm7) -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - - p = im + (iy * iw) + ix; - q1 = p - ix; q2 = im + ix; q3 = im; - if (ix + 1 < iw) - q1 = p + 1; - if (iy + 1 < ih) - { - q2 = p + iw; - q3 = q1 + iw; - } - p0 = *p; p1 = *q1; p2 = *q2; p3 = *q3; -#ifdef BUILD_MMX - if (p0 | p1 | p2 | p3) - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm7, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - ay = 1 + ((yy >> 8) & 0xff); - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - if (p0 | p1 | p2 | p3) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - ay = 1 + ((yy >> 8) & 0xff); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - iyy = (iayy * (y - t)); iy = iyy >> 16; - tyy = (ibyy * iy) + tt; iy += t; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - p = im + (iy * iw) + ix; - - while (iy < ih) - { - q3 = p - ix; - if ((ix + 1) < iw) q3 = p + 1; - p1 = *p; p3 = *q3; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ax, p3, p1); -#endif - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - done: - *d++ = p0; xx += axx; yy += ayx; - } -} - - -static void -src_a8r8g8b8_border_scaled_d_d_repeat(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx, ibyy = idata->ibyy; - int dax = idata->dax, day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - int no_alpha = !idata->has_alpha && idata->border_center_fill; -// int center_fill = idata->border_center_fill; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) - MOV_A2R(day, mm7) -#endif - while (d < e) - { - int iyy, ixx, ix, ix0, iy; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy, ntyy, ty, nty; - DATA32 *p, *ps, *q3, *q2, *q1; - DATA32 p3, p2, p1, p0 = 0; - int ay, ax; - - x = xx >> 16; - if ((x >= fw) || (x < -fw)) x = x % fw; - if (x < 0) x += fw; - y = yy >> 16; - if ((y >= fh) || (y < -fh)) y = y % fh; - if (y < 0) y += fh; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm6) -#endif - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - - p = im + (iy * iw) + ix; - - q1 = p - ix; q2 = im + ix; q3 = im; - if (ix + 1 < iw) - q1 = p + 1; - if (iy + 1 < ih) - { - q2 = p + iw; - q3 = q1 + iw; - } - p0 = *p; p1 = *q1; p2 = *q2; p3 = *q3; -#ifdef BUILD_MMX - MOV_P2R(p0, mm1, mm0) - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - MOV_A2R(ax, mm3) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm4, mm0) - INTERP_256_R2R(mm3, mm4, mm2, mm5) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_A2R(dax, mm4) - } -#else - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - - ixx = iaxx * (x - l); ix = ixx >> 16; - txx = (ibxx * ix) + ll; ix += l; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - - p = im + (iy * iw) + ix; - while (ix < iw) - { - q3 = im + ix; - if (iy + 1 < ih) q3 = p + iw; - p1 = *p; p3 = *q3; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - goto done; - } - - iyy = iayy * (y - t); iy = iyy >> 16; - tyy = (ibyy * iy) + tt; iy += t; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm6) -#endif - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - - p = im + (iy * iw) + ix; - while (iy < ih) - { - q3 = p - ix; - if ((ix + 1) < iw) q3 = p + 1; - p1 = *p; p3 = *q3; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ax, p3, p1); -#endif - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - goto done; - } - - ixx = iaxx * (x - l); ix0 = ixx >> 16; - txx0 = (ibxx * ix0) + ll; ix0 += l; - tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - ps = im + (iy * iw); - - while (iy < ih) - { - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#else - p1 = 0; -#endif - while (ix < iw) - { - p3 = *p; -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p1 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p1 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p1 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - done: -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - if (no_alpha) p0 |= 0xff000000; - *d++ = p0; xx += axx; yy += ayx; - } -} - -/* also maybe [border_]scaled_x/y/dx/dy_repeat */ - - -static Gfx_Func_Image_Fill image_repeat_affine_get(void *pim, int render_op) -{ - Evas_Object_Image *oim = pim; - Gfx_Func_Image_Fill func = NULL; - int src_scaled = 0, src_smooth = 0, src_border = 0; - - if ((oim->cur.image.w != oim->cur.fill.w) || (oim->cur.image.h != oim->cur.fill.h)) - src_scaled = 1; - if (oim->cur.smooth_scale) - src_smooth = 1; - if ((oim->cur.image.w <= oim->cur.fill.w) && (oim->cur.image.h <= oim->cur.fill.h)) - src_smooth = 0; - if ( (oim->cur.border.l > 0) || (oim->cur.border.r > 0) || - (oim->cur.border.t > 0) || (oim->cur.border.b > 0) ) - src_border = 1; - if (!src_scaled && oim->cur.border.center_fill) - src_border = 0; - - func = src_a8r8g8b8_repeat; - if (oim->cur.fill.transform.is_identity) - { - func = src_a8r8g8b8_repeat_simple; - if (src_scaled) - { - if (src_border) - { - func = src_a8r8g8b8_border_scaled_repeat_simple; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h <= oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_u_repeat_simple; - if ((oim->cur.image.w <= oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_u_d_repeat_simple; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_d_repeat_simple; - } - else // scaled, bordered, not smooth or uu - { - if (oim->cur.image.h == oim->cur.fill.h) - return src_a8r8g8b8_border_scaled_x_repeat_simple; - if (oim->cur.image.w == oim->cur.fill.w) - return src_a8r8g8b8_border_scaled_y_repeat_simple; - } - return func; - } - else // scaled, no borders - { - func = src_a8r8g8b8_scaled_repeat_simple; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h < oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_u_repeat_simple; - if ((oim->cur.image.w < oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_u_d_repeat; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_d_repeat_simple; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h == oim->cur.fill.h)) - return src_a8r8g8b8_scaled_dx_repeat_simple; - if ((oim->cur.image.w == oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_dy_repeat_simple; - } - else // not smooth or uu - { - if (oim->cur.image.h == oim->cur.fill.h) - return src_a8r8g8b8_scaled_x_repeat_simple; - if (oim->cur.image.w == oim->cur.fill.w) - return src_a8r8g8b8_scaled_y_repeat_simple; - } - return func; - } - } - return func; - } - - // non-identity transform - if (src_scaled) - { - if (src_border) - { - func = src_a8r8g8b8_border_scaled_repeat; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h <= oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_u_repeat; - if ((oim->cur.image.w <= oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_u_d_repeat; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_d_repeat; - } - } - else // scaled, no borders - { - func = src_a8r8g8b8_scaled_repeat; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h <= oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_u_repeat; - if ((oim->cur.image.w <= oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_u_d_repeat; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_d_repeat; - } - } - } - return func; -} diff --git a/src/lib/engines/common/evas_image_fill_restrict.c b/src/lib/engines/common/evas_image_fill_restrict.c deleted file mode 100644 index 50910fd..0000000 --- a/src/lib/engines/common/evas_image_fill_restrict.c +++ /dev/null @@ -1,3149 +0,0 @@ - -/* restrict funcs */ - - -/* identity transform */ - -static void -src_a8r8g8b8_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - DATA32 *p; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= ih)) - { - while (d < e) - *d++ = 0; - return; - } - p = im + (y * iw) + x; - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < iw) - p0 = *p; - *d++ = p0; p++; x++; - } -} - -static void -src_a8r8g8b8_scaled_x_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - DATA32 *p; - int iaxx = idata->iaxx; - int fw = idata->fw; - int ixx; - - y += idata->ayz >> 16; - if ((y < 0) || (y >= ih)) - { - while (d < e) - *d++ = 0; - return; - } - x += idata->axz >> 16; - ixx = iaxx * x; - p = im + (y * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < fw) - { - int ix = ixx >> 16; - int ax = 1 + ((ixx >> 8) & 0xff); - DATA32 p1 = p0 = *(p + ix); - - if ((ix + 1) < iw) - p1 = *(p + ix + 1); - if (p0 | p1) -#ifdef BUILD_MMX - { - MOV_A2R(ax, mm3) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ax, p1, p0); -#endif - } - *d++ = p0; x++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_scaled_y_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - DATA32 *p; - int iayy = idata->iayy; - int fw = idata->fw, fh = idata->fh; - int iyy, iy; - int ay; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - iyy = iayy * y; - iy = iyy >> 16; - ay = 1 + ((iyy >> 8) & 0xff); - p = im + (iy * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(ay, mm3) -#endif - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < fw) - { - DATA32 p2 = p0 = *(p + x); - - if ((iy + 1) < ih) - p2 = *(p + iw + x); - if (p0 | p2) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p2, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ay, p2, p0); -#endif - } - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_scaled_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - DATA32 *q; - int iaxx = idata->iaxx, iayy = idata->iayy; - int fw = idata->fw, fh = idata->fh; - int ixx, iyy, iy; - int ay; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - ixx = iaxx * x; iyy = iayy * y; - iy = iyy >> 16; - q = im + (iy * iw); - ay = 1 + ((iyy >> 8) & 0xff); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(ay, mm4) -#endif - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < fw) - { - int ix = ixx >> 16; - int ax = 1 + ((ixx >> 8) & 0xff); - DATA32 *p = q + ix, p3, p2, p1; - - p0 = p1 = p2 = p3 = *p; - if ((ix + 1) < iw) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } - if (p0 | p1 | p2 | p3) -#ifdef BUILD_MMX - { - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - INTERP_256_R2R(mm4, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - } - *d++ = p0; x++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_scaled_dx_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx; - int dax = idata->dax; - int ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axz = idata->axz; - int ayz = idata->ayz; - int ixx; - DATA32 *q; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - ixx = (iaxx * x); - q = im + (y * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(dax, mm4) -#endif - while (d < e) - { -#ifndef BUILD_MMX - DATA32 p0 = 0; -#else - pxor_r2r(mm1, mm1); -#endif - if ((unsigned) x < fw) - { - int ix; - int txx, ntxx, tx, ntx; - DATA32 *p; - int ay; - - ix = ixx >> 16; - txx = (ibxx * ix); tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - p = q + ix; - while (ix < iw) - { - DATA32 p1 = *p; - -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } - else if (p1 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, *d, mm0) -#else - *d = p0; -#endif - d++; x++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_scaled_dy_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iayy = idata->iayy; - int day = idata->day; - int ibyy = idata->ibyy; - int fw = idata->fw, fh = idata->fh; - int axz = idata->axz; - int ayz = idata->ayz; - int iyy0, iy0; - int tyy0, ty0, ntyy0, nty0; - DATA32 *q; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - iyy0 = (iayy * y); iy0 = iyy0 >> 16; - tyy0 = (ibyy * iy0); ty0 = tyy0 >> 16; - ntyy0 = tyy0 + ibyy; nty0 = ntyy0 >> 16; - q = im + (iy0 * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(day, mm4) -#endif - while (d < e) - { -#ifndef BUILD_MMX - DATA32 p0 = 0; -#else - pxor_r2r(mm1, mm1); -#endif - if ((unsigned) x < fw) - { - int iy = iy0; - int tyy = tyy0, ntyy = ntyy0, ty = ty0, nty = nty0; - DATA32 *p = q + x; - - while (iy < ih) - { - DATA32 p2 = *p; -#ifdef BUILD_MMX - MOV_P2R(p2, mm2, mm0) -#endif - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } - else if (p2 && (ty == y)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - p0 += MUL_256(day, p2); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, *d, mm0) -#else - *d = p0; -#endif - d++; x++; - } -} - -static void -src_a8r8g8b8_scaled_d_u_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int dax = idata->dax; - int ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axz = idata->axz; - int ayz = idata->ayz; - int ixx, iyy, iy; - int ay; - DATA32 *q; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - ixx = (iaxx * x); - iyy = (iayy * y); iy = iyy >> 16; - ay = 1 + ((iyy >> 8) & 0xff); - q = im + (iy * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) - MOV_A2R(ay, mm6) -#endif - while (d < e) - { -#ifndef BUILD_MMX - DATA32 p0 = 0; -#else - pxor_r2r(mm1, mm1); -#endif - if ((unsigned) x < fw) - { - int ix; - int txx, ntxx, tx, ntx; - DATA32 *p; - - ix = ixx >> 16; - txx = (ibxx * ix); tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - p = q + ix; - while (ix < iw) - { - DATA32 p3, p1 = p3 = *p; - - if ((iy + 1) < ih) - p3 = *(p + iw); -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, *d, mm0) -#else - *d = p0; -#endif - d++; x++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_scaled_u_d_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day; - int ibyy = idata->ibyy; - int fw = idata->fw, fh = idata->fh; - int axz = idata->axz; - int ayz = idata->ayz; - int ixx, iyy0, iy0; - int tyy0, ty0, ntyy0, nty0; - DATA32 *q; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - ixx = (iaxx * x); - iyy0 = (iayy * y); iy0 = iyy0 >> 16; - tyy0 = (ibyy * iy0); ty0 = tyy0 >> 16; - ntyy0 = tyy0 + ibyy; nty0 = ntyy0 >> 16; - q = im + (iy0 * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - while (d < e) - { -#ifndef BUILD_MMX - DATA32 p0 = 0; -#else - pxor_r2r(mm1, mm1); -#endif - if ((unsigned) x < fw) - { - int ix, iy = iy0; - int tyy = tyy0, ntyy = ntyy0, ty = ty0, nty = nty0; - DATA32 *p; - int ax; - - ix = ixx >> 16; - ax = 1 + ((ixx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm6) -#endif - p = q + ix; - while (iy < ih) - { - DATA32 p3, p2 = p3 = *p; - - if ((ix + 1) < iw) - p3 = *(p + 1); -#ifdef BUILD_MMX - MOV_P2R(p2, mm2, mm0) - if (p2 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p2 | p3) - p2 = INTERP_256(ax, p3, p2); -#endif - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p2 && (ty == y)) - p0 += MUL_256(day, p2); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, *d, mm0) -#else - *d = p0; -#endif - d++; x++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_scaled_d_d_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day, dax = idata->dax; - int ibyy = idata->ibyy, ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axz = idata->axz; - int ayz = idata->ayz; - int ixx, iyy0, iy0; - int tyy0, ty0, ntyy0, nty0; - DATA32 *q; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - ixx = (iaxx * x); - iyy0 = (iayy * y); iy0 = iyy0 >> 16; - tyy0 = (ibyy * iy0); ty0 = tyy0 >> 16; - ntyy0 = tyy0 + ibyy; nty0 = ntyy0 >> 16; - q = im + (iy0 * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(dax, mm4) - MOV_A2R(day, mm7) -#endif - while (d < e) - { - DATA32 p0 = 0; - - if ((unsigned) x < fw) - { - int ix, ix0, iy = iy0; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy = tyy0, ntyy = ntyy0, ty = ty0, nty = nty0; - DATA32 *p, *ps; - - ix0 = (ixx >> 16); - txx0 = (ibxx * ix0); tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - ps = q; -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - while (iy < ih) - { -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#else - DATA32 p2 = 0; -#endif - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; - while (ix < iw) - { - DATA32 p3 = *p; - -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p2 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p2 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p2 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p2 && (ty == y)) - p0 += MUL_256(day, p2); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } - *d++ = p0; x++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_border_scaled_x_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx; - int l = idata->l, r = idata->r; - int fw = idata->fw, fh = idata->fh; - int ixx; - DATA32 *p; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - ixx = iaxx * (x - l); - p = im + (y * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < fw) - { - int ix; - int ax; - DATA32 p1; - - ix = l + (ixx >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - p0 = p1 = *(p + ix); - if ((ix + 1) < iw) - p1 = *(p + ix + 1); - if (ax && (p0 | p1)) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - MOV_A2R(ax, mm3) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ax, p1, p0); -#endif - } - *d++ = p0; x++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_border_scaled_y_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iayy = idata->iayy; - int t = idata->t, b = idata->b; - int fh = idata->fh; - int iyy, iy; - int ay; - DATA32 *p; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - if ((y < t) || ((y + 2) > (fh - b))) - { - if ((y + 2) > (fh - b)) - y += (ih - fh); - p = im + (y * iw) + x; - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < iw) - p0 = *p; - *d++ = p0; p++; x++; - } - return; - } - - iyy = iayy * (y - t); - iy = t + (iyy >> 16); - ay = 1 + ((iyy >> 8) & 0xff); - p = im + (iy * iw) + x; -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(ay, mm3) -#endif - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < iw) - { - DATA32 p2 = p0 = *p; - - if ((iy + 1) < ih) - p2 = *(p + iw); - if (p0 | p2) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p2, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ay, p2, p0); -#endif - } - *d++ = p0; p++; x++; - } -} - -static void -src_a8r8g8b8_border_scaled_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int ixx, iyy, iy; - int ay; - DATA32 *q; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - ixx = iaxx * (x - l); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - - q = im + (iy * iw); - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < fw) - { - int ix; - int ax; - DATA32 p1; - - ix = l + (ixx >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - - p0 = *(q + ix); p1 = *q; - if (ix + 1 < iw) - p1 = *(q + ix + 1); - - if (ax && (p0 | p1)) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - MOV_A2R(ax, mm3) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ax, p1, p0); -#endif - } - *d++ = p0; x++; ixx += iaxx; - } - return; - } - - iyy = iayy * (y - t); - ay = 1 + ((iyy >> 8) & 0xff); - iy = t + (iyy >> 16); - q = im + (iy * iw); -#ifdef BUILD_MMX - MOV_A2R(ay, mm4) -#endif - while (d < e) - { - DATA32 p0 = 0; - - if (((unsigned) x) < fw) - { - int ix; - int ax; - DATA32 *p, p3, p2, p1; - - ix = l + (ixx >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - p = q + ix; - p0 = p1 = p2 = p3 = *p; - if ((ix + 1) < iw) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } - if (p0 | p1 | p2 | p3) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p2, mm2, mm0) - if (ax) - { - MOV_P2R(p1, mm3, mm0) - MOV_A2R(ax, mm6) - INTERP_256_R2R(mm6, mm3, mm1, mm5) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } - INTERP_256_R2R(mm4, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - if (ax) - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - } - p0 = INTERP_256(ay, p2, p0); - } -#endif - } - *d++ = p0; x++; ixx += iaxx; - } -} - -static void -src_a8r8g8b8_border_scaled_d_u_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx; - int dax = idata->dax; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int iyy, iy; - int ay; - DATA32 *q; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - - iyy = (iayy * (y - t)); iy = iyy >> 16; - ay = 1 + ((iyy >> 8) & 0xff); - iy += t; - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 0; - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - } - q = im + (iy * iw); -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(ay, mm6) - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - DATA32 p0 = 0; - - if ((unsigned) x < fw) - { - int ixx, ix; - int txx, ntxx, tx, ntx; - DATA32 *p, p2; - int ax; - - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - - p = q + ix; - p0 = *p; - if (ay) - { - p2 = p0; - if ((iy + 1) < ih) - p2 = *(p + iw); - if (p0 | p2) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p2, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ay, p2, p0); -#endif - } - goto done; - } - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - ixx = (iaxx * (x - l)); ix = ixx >> 16; - txx = (ibxx * ix) + ll; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - ix += l; - p = q + ix; - while (ix < iw) - { - DATA32 p1 = p2 = *p; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (ay && ((iy + 1) < ih)) - { - p2 = *(p + iw); - if (p1 | p2) -#ifdef BUILD_MMX - { - MOV_P2R(p2, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - p1 = INTERP_256(ay, p2, p1); -#endif - } - - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); - p0 = MUL_256(ax, p1); - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - done: - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_border_scaled_u_d_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibyy = idata->ibyy; - int day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - DATA32 *p; - int iy = y; - - if ((y + 2) > (fh - b)) - iy += (ih - fh); - p = im + (iy * iw); - while (d < e) - { - DATA32 p0 = 0; - - if ((unsigned) x < fw) - { - int ixx, ix; - DATA32 p1; - int ax; - - ixx = (iaxx * (x - l)); ix = ixx >> 16; - ax = 1 + ((ixx >> 8) & 0xff); - ix += l; - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - p0 = *(p + ix); - if (ax) - { - p1 = p0; - if ((ix + 1) < iw) - p1 = *(p + ix + 1); - if (p0 | p1) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - MOV_A2R(ax, mm3) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - p0 = INTERP_256(ax, p1, p0); -#endif - } - } - *d++ = p0; x++; - } - return; - } - - while (d < e) - { - DATA32 p0 = 0; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if ((unsigned) x < fw) - { - int iyy, ixx, ix, iy; - int tyy, ntyy, ty, nty; - DATA32 *p, p3, p1; - int ay, ax; - - ixx = (iaxx * (x - l)); ix = ixx >> 16; - ax = 1 + ((ixx >> 8) & 0xff); - ix += l; - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 0; - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - iyy = (iayy * (y - t)); iy = iyy >> 16; - tyy = (ibyy * iy) + tt; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - iy += t; - p = im + (iy * iw) + ix; - while (iy < ih) - { - p3 = p1 = *p; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (ax) - { - if ((ix + 1) < iw) - p3 = *(p + 1); - if (p1 | p3) -#ifdef BUILD_MMX - { - MOV_P2R(p3, mm3, mm0) - MOV_A2R(ax, mm6) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - p1 = INTERP_256(ax, p3, p1); -#endif - } - - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - *d++ = p0; x++; - } -} - -static void -src_a8r8g8b8_border_scaled_d_d_restrict_simple(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx, ibyy = idata->ibyy; - int dax = idata->dax, day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - - x += idata->axz >> 16; y += idata->ayz >> 16; - if ((y < 0) || (y >= fh)) - { - while (d < e) - *d++ = 0; - return; - } - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(dax, mm4) - MOV_A2R(day, mm5) -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - DATA32 *q; - int iy = y; - - if ((y + 2) > (fh - b)) - iy += (ih - fh); - q = im + (iy * iw); - while (d < e) - { - int ixx, ix; - int txx, ntxx, tx, ntx; - DATA32 *p, p1, p0 = 0; - int ax; - - if ((unsigned) x < fw) - { - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - p0 = *(q + ix); - goto done_t; - } - ixx = iaxx * (x - l); ix = ixx >> 16; - txx = (ibxx * ix) + ll; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - ix += l; - p = q + ix; -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - while (ix < iw) - { - p1 = *p; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } - else if (p1 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - done_t: - *d++ = p0; x++; - } - return; - } - - while (d < e) - { - DATA32 p0 = 0; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if ((unsigned) x < fw) - { - int iyy, ixx, ix, ix0, iy; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy, ntyy, ty, nty; - DATA32 *p, *ps, p3, p1; - int ay, ax; - - iyy = iayy * (y - t); iy = iyy >> 16; - tyy = (ibyy * iy) + tt; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - iy += t; - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - p = im + (iy * iw) + ix; - while (iy < ih) - { - p1 = *p; -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) -#endif - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } - else if (p1 && (ty == y)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm5, mm2) - paddw_r2r(mm2, mm1); - } -#else - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - goto done; - } - - ixx = iaxx * (x - l); ix0 = ixx >> 16; - txx0 = (ibxx * ix0) + ll; - tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - ps = im + (iy * iw); - ix0 += l; - while (iy < ih) - { - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; - p1 = 0; -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#endif - while (ix < iw) - { - p3 = *p; -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p1 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p1 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p1 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm5, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } - done: -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - *d++ = p0; x++; - } -} - -/* also maybe border_scaled_dx/dy_restrict_simple */ - - -/* with transform */ - -static void -src_a8r8g8b8_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - - if ( (((unsigned) (x + 1)) < (iw + 1)) && (((unsigned) (y + 1)) < (ih + 1)) ) - { - DATA32 p3 = 0, p2 = 0, p1 = 0; - DATA32 *p = im + (y * iw) + x; - int ax, ay; - - if ((x > -1) && (y > -1)) - p0 = *p; - if ((y > -1) && ((x + 1) < iw)) - p1 = *(p + 1); - if ((y + 1) < ih) - { - if (x > -1) - p2 = *(p + iw); - if ((x + 1) < iw) - p3 = *(p + iw + 1); - } - - if (p0 | p1 | p2 | p3) -#ifdef BUILD_MMX - { - ax = 1 + ((xx >> 8) & 0xff); - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - ay = 1 + ((yy >> 8) & 0xff); - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - ax = 1 + ((xx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - ay = 1 + ((yy >> 8) & 0xff); - p0 = INTERP_256(ay, p2, p0); - } -#endif - } - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - - #ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - - if ( (((unsigned) (x + 1)) < (fw + 1)) && (((unsigned) (y + 1)) < (fh + 1)) ) - { - int ixx, ix, iyy, iy; - int ax, ay; - DATA32 *p, p3 = 0, p2 = 0, p1 = 0; - - ixx = (iaxx * xx) >> 16; ix = ixx >> 16; - iyy = (iayy * yy) >> 16; iy = iyy >> 16; - ax = 1 + ((ixx >> 8) & 0xff); - ay = 1 + ((iyy >> 8) & 0xff); - if ((x < 0) || ((x + 2) > fw)) - ax = 1 + ((xx >> 8) & 0xff); - if ((y < 0) || ((y + 2) > fh)) - ay = 1 + ((yy >> 8) & 0xff); - - p = im + (iy * iw) + ix; - - if ((ix > -1) && (iy > -1)) - p0 = *p; - if ((iy > -1) && ((ix + 1) < iw)) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - if (ix > -1) - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } - if (p0 | p1 | p2 | p3) -#ifdef BUILD_MMX - { - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - } - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_d_u_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int dax = idata->dax; - int ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if ( (((unsigned) (x + 1)) < (fw + 1)) && (((unsigned) (y + 1)) < (fh + 1)) ) - { - int iyy, ixx, ix, iy; - int txx, ntxx, tx, ntx; - DATA32 *p, p3 = 0, p1 = 0; - int ay; - - iyy = (iayy * yy) >> 16; iy = iyy >> 16; - ixx = (iaxx * xx) >> 16; ix = ixx >> 16; - txx = (ibxx * ix) - (xx & 0xffff); tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - ay = 1 + ((iyy >> 8) & 0xff); - if ((y < 0) || ((y + 2) > fh)) - ay = 1 + ((yy >> 8) & 0xff); - p = im + (iy * iw) + ix; -#ifdef BUILD_MMX - MOV_A2R(ay, mm6) -#endif - while (ix < iw) - { - p3 = p1 = 0; - if (ix > -1) - { - if (iy > -1) - p1 = *p; - if ((iy + 1) < ih) - p3 = *(p + iw); - } -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_u_d_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day; - int ibyy = idata->ibyy; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if ( (((unsigned) (x + 1)) < (fw + 1)) && (((unsigned) (y + 1)) < (fh + 1)) ) - { - int ixx, iyy, ix, iy; - int tyy, ntyy, ty, nty; - DATA32 *p, p3 = 0, p2 = 0; - int ax; - - ixx = (iaxx * xx) >> 16; ix = ixx >> 16; - iyy = (iayy * yy) >> 16; iy = iyy >> 16; - tyy = (ibyy * iy) - (yy & 0xffff); ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - ax = 1 + ((ixx >> 8) & 0xff); - if ((x < 0) || ((x + 2) > fw)) - ax = 1 + ((xx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm6) -#endif - p = im + (iy * iw) + ix; - - while (iy < ih) - { - p3 = p2 = 0; - if (iy > -1) - { - if (ix > -1) - p2 = *p; - if ((ix + 1) < iw) - p3 = *(p + 1); - } -#ifdef BUILD_MMX - MOV_P2R(p2, mm2, mm0) - if (p2 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p2 | p3) - p2 = INTERP_256(ax, p3, p2); -#endif - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p2 && (ty == y)) - p0 += MUL_256(day, p2); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_scaled_d_d_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int day = idata->day, dax = idata->dax; - int ibyy = idata->ibyy, ibxx = idata->ibxx; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) - MOV_A2R(day, mm7) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if ( (((unsigned) (x + 1)) < (fw + 1)) && (((unsigned) (y + 1)) < (fh + 1)) ) - { - int ixx, iyy, ix, ix0, iy; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy, ntyy, ty, nty; - DATA32 *p, *ps, p3, p2; - - ixx = ((iaxx * xx) >> 16); ix0 = (ixx >> 16); - iyy = ((iayy * yy) >> 16); iy = (iyy >> 16); - tyy = (ibyy * iy) - (yy & 0xffff); ty = (tyy >> 16); - ntyy = tyy + ibyy; nty = (ntyy >> 16); - txx0 = (ibxx * ix0) - (xx & 0xffff); tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - ps = im + (iy * iw); - - while (iy < ih) - { - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#else - p2 = 0; -#endif - while (ix < iw) - { - p3 = 0; - if ((ix > -1) && (iy > -1)) - p3 = *p; -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - int ax; - - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p2 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p2 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p2 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - int ay; - - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p2); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p2); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p2 && (ty == y)) - p0 += MUL_256(day, p2); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int ibyy = idata->ibyy, ibxx = idata->ibxx; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - - if ( (((unsigned) (x + 1)) < (fw + 1)) && (((unsigned) (y + 1)) < (fh + 1)) ) - { - int ixx, ix, iyy, iy; - int ax, ay; - DATA32 *p, p3 = 0, p2 = 0, p1 = 0; - - ixx = (iaxx * (xx - ll)) >> 16; ix = l + (ixx >> 16); - iyy = (iayy * (yy - tt)) >> 16; iy = t + (iyy >> 16); - ax = 1 + ((ixx >> 8) & 0xff); - ay = 1 + ((iyy >> 8) & 0xff); - - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - } - - p = im + (iy * iw) + ix; - - if ((ix > -1) && (iy > -1)) - p0 = *p; - if ((iy > -1) && ((ix + 1) < iw)) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - if (ix > -1) - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } - if (p0 | p1 | p2 | p3) -#ifdef BUILD_MMX - { - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - } - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_d_u_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx; - int dax = idata->dax; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - - if ( (((unsigned) (x + 1)) < (fw + 1)) && (((unsigned) (y + 1)) < (fh + 1)) ) - { - int iyy, ixx, ix, iy; - int txx, ntxx, tx, ntx; - DATA32 *p, p3 = 0, p2 = 0, p1 = 0; - int ay, ax; - - iyy = (iayy * (yy - tt)) >> 16; iy = iyy >> 16; - ay = 1 + ((iyy >> 8) & 0xff); - iy += t; - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - } -#ifdef BUILD_MMX - MOV_A2R(ay, mm7) -#endif - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - - p = im + (iy * iw) + ix; - - if ((ix > -1) && (iy > -1)) - p0 = *p; - if ((iy > -1) && ((ix + 1) < iw)) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - if (ix > -1) - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } - - if (p0 | p1 | p2 | p3) -#ifdef BUILD_MMX - { - ax = 1 + ((xx >> 8) & 0xff); - MOV_A2R(ax, mm6) - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - INTERP_256_R2R(mm7, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - ax = 1 + ((xx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - - ixx = (iaxx * (xx - ll)) >> 16; ix = ixx >> 16; - txx = (ibxx * ix) - (xx & 0xffff) + ll; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - ix += l; - p = im + (iy * iw) + ix; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - while (ix < iw) - { - p1 = p3 = 0; - if (ix > -1) - { - if (iy > -1) - p1 = *p; - if ((iy + 1) < ih) - p3 = *(p + iw); - } -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - done: - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_u_d_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int ibyy = idata->ibyy; - int day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(day, mm4) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - - if ( (((unsigned) (x + 1)) < (fw + 1)) && (((unsigned) (y + 1)) < (fh + 1)) ) - { - int iyy, ixx, ix, iy; - int tyy, ntyy, ty, nty; - DATA32 *p, p3 = 0, p2 = 0, p1 = 0; - int ay, ax; - - ixx = (iaxx * (xx - ll)) >> 16; ix = ixx >> 16; - ax = 1 + ((ixx >> 8) & 0xff); - ix += l; - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - } -#ifdef BUILD_MMX - MOV_A2R(ax, mm7) -#endif - if ((y < t) || ((y + 2) > (fh - b))) - { - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); - - p = im + (iy * iw) + ix; - - if ((ix > -1) && (iy > -1)) - p0 = *p; - if ((iy > -1) && ((ix + 1) < iw)) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - if (ix > -1) - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } - - if (p0 | p1 | p2 | p3) -#ifdef BUILD_MMX - { - MOV_P2R(p0, mm1, mm0) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm7, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - ay = 1 + ((yy >> 8) & 0xff); - MOV_A2R(ay, mm6) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_R2P(mm1, p0, mm0) - } -#else - { - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - ay = 1 + ((yy >> 8) & 0xff); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - - iyy = (iayy * (yy - tt)) >> 16; iy = iyy >> 16; - tyy = (ibyy * iy) - (yy & 0xffff) + tt; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - iy += t; - p = im + (iy * iw) + ix; - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - while (iy < ih) - { - p1 = p3 = 0; - if (iy > -1) - { - if (ix > -1) - p1 = *p; - if ((ix + 1) < iw) - p3 = *(p + 1); - } -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm7, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ax, p3, p1); -#endif - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - done: - *d++ = p0; xx += axx; yy += ayx; - } -} - -static void -src_a8r8g8b8_border_scaled_d_d_restrict(DATA32 *im, int iw, int ih, DATA32 *buf, DATA8 *mask, int len, - int x, int y, void *data) -{ - Image_Draw_Data *idata = data; - DATA32 *d = buf, *e = d + len; - long long int iaxx = idata->iaxx, iayy = idata->iayy; - int ibxx = idata->ibxx, ibyy = idata->ibyy; - int dax = idata->dax, day = idata->day; - int l = idata->l, ll = (l << 16), r = idata->r; - int t = idata->t, tt = (t << 16), b = idata->b; - int fw = idata->fw, fh = idata->fh; - int axx = idata->axx, axy = idata->axy, axz = idata->axz; - int ayx = idata->ayx, ayy = idata->ayy, ayz = idata->ayz; - int xx, yy; - - xx = (axx * x) + (axx >> 1) + (axy * y) + (axy >> 1) + axz - 32768; - yy = (ayx * x) + (ayx >> 1) + (ayy * y) + (ayy >> 1) + ayz - 32768; - -#ifdef BUILD_MMX - pxor_r2r(mm0, mm0); - MOV_A2R(ALPHA_255, mm5) - MOV_A2R(dax, mm4) - MOV_A2R(day, mm7) -#endif - while (d < e) - { - DATA32 p0 = 0; - - x = (xx >> 16); - y = (yy >> 16); - -#ifdef BUILD_MMX - pxor_r2r(mm1, mm1); -#endif - if ( (((unsigned) (x + 1)) < (fw + 1)) && (((unsigned) (y + 1)) < (fh + 1)) ) - { - int iyy, ixx, ix, ix0, iy; - int txx, txx0, ntxx, ntxx0, tx, tx0, ntx, ntx0; - int tyy, ntyy, ty, nty; - DATA32 *p, *ps, p3 = 0, p2 = 0, p1 = 0; - int ay, ax; - - if ((y < t) || ((y + 2) > (fh - b))) - { - ay = 1 + ((yy >> 8) & 0xff); - iy = y; - if ((y + 2) > (fh - b)) - iy += (ih - fh); -#ifdef BUILD_MMX - MOV_A2R(ay, mm6) -#endif - if ((x < l) || ((x + 2) > (fw - r))) - { - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - - p = im + (iy * iw) + ix; - - if ((ix > -1) && (iy > -1)) - p0 = *p; - if ((iy > -1) && ((ix + 1) < iw)) - p1 = *(p + 1); - if ((iy + 1) < ih) - { - if (ix > -1) - p2 = *(p + iw); - if ((ix + 1) < iw) - p3 = *(p + iw + 1); - } -#ifdef BUILD_MMX - MOV_P2R(p0, mm1, mm0) - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - MOV_A2R(ax, mm3) - MOV_P2R(p1, mm2, mm0) - INTERP_256_R2R(mm3, mm2, mm1, mm5) - MOV_P2R(p2, mm2, mm0) - MOV_P2R(p3, mm4, mm0) - INTERP_256_R2R(mm3, mm4, mm2, mm5) - INTERP_256_R2R(mm6, mm2, mm1, mm5) - MOV_A2R(dax, mm4) - } -#else - if (p0 | p1 | p2 | p3) - { - ax = 1 + ((xx >> 8) & 0xff); - p0 = INTERP_256(ax, p1, p0); - p2 = INTERP_256(ax, p3, p2); - p0 = INTERP_256(ay, p2, p0); - } -#endif - goto done; - } - - ixx = (iaxx * (xx - ll)) >> 16; ix = ixx >> 16; - txx = (ibxx * ix) - (xx & 0xffff) + ll; - tx = txx >> 16; - ntxx = txx + ibxx; ntx = ntxx >> 16; - ix += l; - p = im + (iy * iw) + ix; - while (ix < iw) - { - p1 = p3 = 0; - if (ix > -1) - { - if (iy > -1) - p1 = *p; - if ((iy + 1) < ih) - p3 = *(p + iw); - } -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ay, p3, p1); -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ax, p1); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ax, p1); -#endif - tx = ntx; - } -#ifdef BUILD_MMX - else if (tx == x) - { - MUL4_256_R2R(mm4, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (tx == x)) - p0 += MUL_256(dax, p1); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - goto done; - } - - iyy = (iayy * (yy - tt)) >> 16; iy = iyy >> 16; - tyy = (ibyy * iy) - (yy & 0xffff) + tt; - ty = tyy >> 16; - ntyy = tyy + ibyy; nty = ntyy >> 16; - iy += t; - - if ((x < l) || ((x + 2) > (fw - r))) - { - ax = 1 + ((xx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm6) -#endif - ix = x; - if ((x + 2) > (fw - r)) - ix += (iw - fw); - - p = im + (iy * iw) + ix; - while (iy < ih) - { - p1 = p3 = 0; - if (iy > -1) - { - if (ix > -1) - p1 = *p; - if ((ix + 1) < iw) - p3 = *(p + 1); - } -#ifdef BUILD_MMX - MOV_P2R(p1, mm2, mm0) - if (p1 | p3) - { - MOV_P2R(p3, mm3, mm0) - INTERP_256_R2R(mm6, mm3, mm2, mm5) - } -#else - if (p1 | p3) - p1 = INTERP_256(ax, p3, p1); -#endif - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - p += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - goto done; - } - - ixx = (iaxx * (xx - ll)) >> 16; ix0 = ixx >> 16; - txx0 = (ibxx * ix0) - (xx & 0xffff) + ll; - tx0 = (txx0 >> 16); - ntxx0 = (txx0 + ibxx); ntx0 = (ntxx0 >> 16); - ps = im + (iy * iw); - ix0 += l; - - while (iy < ih) - { - txx = txx0; tx = tx0; - ntxx = ntxx0; ntx = ntx0; - ix = ix0; p = ps + ix; - p1 = 0; -#ifdef BUILD_MMX - pxor_r2r(mm2, mm2); -#endif - while (ix < iw) - { - p3 = 0; - if ((ix > -1) && (iy > -1)) - p3 = *p; -#ifdef BUILD_MMX - MOV_P2R(p3, mm6, mm0) -#endif - if (ntx != tx) - { - if (ntx != x) - { - ax = 256 - ((txx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - paddw_r2r(mm6, mm2); -#else - p1 += MUL_256(ax, p3); -#endif - break; - } - ax = 1 + ((ntxx >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ax, mm3) - MUL4_256_R2R(mm3, mm6) - movq_r2r(mm6, mm2); -#else - p1 = MUL_256(ax, p3); -#endif - tx = ntx; - } - else if (p3 && (tx == x)) -#ifdef BUILD_MMX - { - MUL4_256_R2R(mm4, mm6) - paddw_r2r(mm6, mm2); - } -#else - p1 += MUL_256(dax, p3); -#endif - p++; ix++; - txx = ntxx; ntxx += ibxx; ntx = ntxx >> 16; - } - - if (nty != ty) - { - if (nty != y) - { - ay = 256 - ((tyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - paddw_r2r(mm2, mm1); -#else - p0 += MUL_256(ay, p1); -#endif - break; - } - ay = 1 + ((ntyy >> 8) & 0xff); -#ifdef BUILD_MMX - MOV_A2R(ay, mm3) - MUL4_256_R2R(mm3, mm2) - movq_r2r(mm2, mm1); -#else - p0 = MUL_256(ay, p1); -#endif - ty = nty; - } -#ifdef BUILD_MMX - else if (ty == y) - { - MUL4_256_R2R(mm7, mm2) - paddw_r2r(mm2, mm1); - } -#else - else if (p1 && (ty == y)) - p0 += MUL_256(day, p1); -#endif - ps += iw; iy++; - tyy = ntyy; ntyy += ibyy; nty = ntyy >> 16; - } - } - done: -#ifdef BUILD_MMX - MOV_R2P(mm1, p0, mm0) -#endif - *d++ = p0; xx += axx; yy += ayx; - } -} - -/* also maybe [border_]scaled_x/y/dx/dy_restrict */ - - -static Gfx_Func_Image_Fill image_restrict_affine_get(void *pim, int render_op) -{ - Evas_Object_Image *oim = pim; - Gfx_Func_Image_Fill func = NULL; - int src_scaled = 0, src_smooth = 0, src_border = 0; - - if ((oim->cur.image.w != oim->cur.fill.w) || (oim->cur.image.h != oim->cur.fill.h)) - src_scaled = 1; - if (oim->cur.smooth_scale) - src_smooth = 1; - if ((oim->cur.image.w <= oim->cur.fill.w) && (oim->cur.image.h <= oim->cur.fill.h)) - src_smooth = 0; - if ( (oim->cur.border.l > 0) || (oim->cur.border.r > 0) || - (oim->cur.border.t > 0) || (oim->cur.border.b > 0) ) - src_border = 1; - if (!src_scaled && oim->cur.border.center_fill) - src_border = 0; - - func = src_a8r8g8b8_restrict; - if (oim->cur.fill.transform.is_identity) - { - func = src_a8r8g8b8_restrict_simple; - if (src_scaled) - { - if (src_border) - { - func = src_a8r8g8b8_border_scaled_restrict_simple; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h <= oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_u_restrict_simple; - if ((oim->cur.image.w <= oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_u_d_restrict_simple; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_d_restrict_simple; - } - else // scaled, bordered, not smooth or uu - { - if (oim->cur.image.h == oim->cur.fill.h) - return src_a8r8g8b8_border_scaled_x_restrict_simple; - if (oim->cur.image.w == oim->cur.fill.w) - return src_a8r8g8b8_border_scaled_y_restrict_simple; - } - return func; - } - else // scaled, no borders - { - func = src_a8r8g8b8_scaled_restrict_simple; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h < oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_u_restrict_simple; - if ((oim->cur.image.w < oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_u_d_restrict; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_d_restrict_simple; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h == oim->cur.fill.h)) - return src_a8r8g8b8_scaled_dx_restrict_simple; - if ((oim->cur.image.w == oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_dy_restrict_simple; - } - else // not smooth or uu - { - if (oim->cur.image.h == oim->cur.fill.h) - return src_a8r8g8b8_scaled_x_restrict_simple; - if (oim->cur.image.w == oim->cur.fill.w) - return src_a8r8g8b8_scaled_y_restrict_simple; - } - return func; - } - } - return func; - } - - // non-identity transform - if (src_scaled) - { - if (src_border) - { - func = src_a8r8g8b8_border_scaled_restrict; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h <= oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_u_restrict; - if ((oim->cur.image.w <= oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_u_d_restrict; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_border_scaled_d_d_restrict; - } - } - else // scaled, no borders - { - func = src_a8r8g8b8_scaled_restrict; - if (src_smooth) - { - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h <= oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_u_restrict; - if ((oim->cur.image.w <= oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_u_d_restrict; - if ((oim->cur.image.w > oim->cur.fill.w) & (oim->cur.image.h > oim->cur.fill.h)) - return src_a8r8g8b8_scaled_d_d_restrict; - } - } - } - return func; -} - - -/* masked restrict funcs */ - -/* FIXME: implement masked restrict (fairly straightforward) */ - -static Gfx_Func_Image_Fill image_restrict_masked_affine_get(void *pim, int render_op) -{ - return NULL; -} diff --git a/src/lib/engines/common/evas_image_private.h b/src/lib/engines/common/evas_image_private.h index 7361b32..5f07e8c 100644 --- a/src/lib/engines/common/evas_image_private.h +++ b/src/lib/engines/common/evas_image_private.h @@ -1,22 +1,6 @@ #ifndef _EVAS_IMAGE_PRIVATE_H #define _EVAS_IMAGE_PRIVATE_H -typedef struct _Image_Draw_Data Image_Draw_Data; -struct _Image_Draw_Data -{ - int axx, axy, axz; - int ayx, ayy, ayz; - - int fw, fh; - int iaxx, iayy; - int ibxx, ibyy; - int dax, day; - - int l, r, t, b; - unsigned char has_alpha : 1; - unsigned char border_center_fill : 1; -}; - int evas_common_load_rgba_image_module_from_file (Image_Entry *im); int evas_common_load_rgba_image_data_from_file (Image_Entry *im); @@ -25,6 +9,5 @@ int evas_common_rgba_image_from_copied_data (Image_Entry* dst, int evas_common_rgba_image_from_data (Image_Entry* dst, int w, int h, DATA32 *image_data, int alpha, int cspace); int evas_common_rgba_image_colorspace_set (Image_Entry* dst, int cspace); -int evas_common_image_draw_data_setup(void *pim, Image_Draw_Data *idata); #endif /* _EVAS_IMAGE_PRIVATE_H */ diff --git a/src/lib/engines/common/evas_op_mul/op_mul_mask_color_i386.c b/src/lib/engines/common/evas_op_mul/op_mul_mask_color_i386.c index a859efc..8fd486e 100644 --- a/src/lib/engines/common/evas_op_mul/op_mul_mask_color_i386.c +++ b/src/lib/engines/common/evas_op_mul/op_mul_mask_color_i386.c @@ -5,11 +5,11 @@ static void _op_mul_mas_c_dp_mmx(DATA32 *s, DATA8 *m, DATA32 c, DATA32 *d, int l) { DATA32 *e = d + l; - pxor_r2r(mm0, mm0); MOV_P2R(c, mm2, mm0) c = ~c; MOV_P2R(c, mm3, mm0) MOV_A2R(ALPHA_255, mm5) + pxor_r2r(mm0, mm0); while (d < e) { DATA32 a = *m; switch(a) @@ -61,9 +61,9 @@ static void _op_mul_pt_mas_c_dp_mmx(DATA32 s, DATA8 m, DATA32 c, DATA32 *d) { s = m + 1; c = ~c; - pxor_r2r(mm0, mm0); MOV_P2R(c, mm3, mm0) MOV_A2R(ALPHA_255, mm4) + pxor_r2r(mm0, mm0); MOV_A2R(s, mm1) MUL4_256_R2R(mm3, mm1) psubw_r2r(mm1, mm4); diff --git a/src/lib/engines/common/evas_pipe.c b/src/lib/engines/common/evas_pipe.c index 5935ae5..d3d5d7e 100644 --- a/src/lib/engines/common/evas_pipe.c +++ b/src/lib/engines/common/evas_pipe.c @@ -439,13 +439,10 @@ evas_common_pipe_grad_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, } /**************** GRAD2 ******************/ -#include "evas_object_gradient2.h" static void evas_common_pipe_op_grad2_free(RGBA_Pipe_Op *op) { - Evas_Object_Gradient2 *ogr = op->op.grad2.grad; - if (ogr) - evas_common_rgba_gradient2_free(ogr->engine_data); + evas_common_gradient2_free(op->op.grad2.grad); evas_common_pipe_op_free(op); } @@ -462,26 +459,24 @@ evas_common_pipe_grad2_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thre #else evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h); #endif - evas_common_gradient2_draw(dst, &(context), op->op.grad2.grad, + evas_common_gradient2_draw(dst, &(context), op->op.grad2.x, op->op.grad2.y, - op->op.grad2.w, op->op.grad2.h); + op->op.grad2.w, op->op.grad2.h, + op->op.grad2.grad); } else - evas_common_gradient2_draw(dst, &(op->context), op->op.grad2.grad, + evas_common_gradient2_draw(dst, &(op->context), op->op.grad2.x, op->op.grad2.y, - op->op.grad2.w, op->op.grad2.h); + op->op.grad2.w, op->op.grad2.h, + op->op.grad2.grad); } EAPI void -evas_common_pipe_grad2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr, - int x, int y, int w, int h) +evas_common_pipe_grad2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, + int x, int y, int w, int h, RGBA_Gradient2 *gr) { RGBA_Pipe_Op *op; - Evas_Object_Gradient2 *ogr = pgr; - RGBA_Gradient2 *gr; - if (!ogr) return; - gr = ogr->engine_data; if (!gr) return; dst->pipe = evas_common_pipe_add(dst->pipe, &op); if (!dst->pipe) return; @@ -490,7 +485,7 @@ evas_common_pipe_grad2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr, op->op.grad2.w = w; op->op.grad2.h = h; gr->references++; - op->op.grad2.grad = ogr; + op->op.grad2.grad = gr; op->op_func = evas_common_pipe_grad2_draw_do; op->free_func = evas_common_pipe_op_grad2_free; evas_common_pipe_draw_context_copy(dc, op); @@ -548,18 +543,12 @@ evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, } /**************** IMAGE *****************/ -#include "evas_object_image.h" static void evas_common_pipe_op_image_free(RGBA_Pipe_Op *op) { - Evas_Object_Image *oim = op->op.image.im; - RGBA_Image *im; - - if (!oim) return; - im = oim->engine_data; - im->ref--; - if (im->ref == 0) - evas_cache_image_drop(&im->cache_entry); + op->op.image.src->ref--; + if (op->op.image.src->ref == 0) + evas_cache_image_drop(&op->op.image.src->cache_entry); evas_common_pipe_op_free(op); } @@ -576,35 +565,81 @@ evas_common_pipe_image_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thre #else evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h); #endif - evas_common_image_draw2(dst, &(context), op->op.image.im, - op->op.image.x, op->op.image.y, - op->op.image.w, op->op.image.h); + if (op->op.image.smooth) + evas_common_scale_rgba_in_to_out_clip_smooth(op->op.image.src, + dst, &(context), + op->op.image.sx, + op->op.image.sy, + op->op.image.sw, + op->op.image.sh, + op->op.image.dx, + op->op.image.dy, + op->op.image.dw, + op->op.image.dh); + else + evas_common_scale_rgba_in_to_out_clip_sample(op->op.image.src, + dst, &(context), + op->op.image.sx, + op->op.image.sy, + op->op.image.sw, + op->op.image.sh, + op->op.image.dx, + op->op.image.dy, + op->op.image.dw, + op->op.image.dh); } else - evas_common_image_draw2(dst, &(op->context), op->op.image.im, - op->op.image.x, op->op.image.y, - op->op.image.w, op->op.image.h); + { + if (op->op.image.smooth) + evas_common_scale_rgba_in_to_out_clip_smooth(op->op.image.src, + dst, &(op->context), + op->op.image.sx, + op->op.image.sy, + op->op.image.sw, + op->op.image.sh, + op->op.image.dx, + op->op.image.dy, + op->op.image.dw, + op->op.image.dh); + else + evas_common_scale_rgba_in_to_out_clip_sample(op->op.image.src, + dst, &(op->context), + op->op.image.sx, + op->op.image.sy, + op->op.image.sw, + op->op.image.sh, + op->op.image.dx, + op->op.image.dy, + op->op.image.dw, + op->op.image.dh); + } } EAPI void -evas_common_pipe_image_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pim, - int x, int y, int w, int h) +evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst, + RGBA_Draw_Context *dc, int smooth, + int src_region_x, int src_region_y, + int src_region_w, int src_region_h, + int dst_region_x, int dst_region_y, + int dst_region_w, int dst_region_h) { RGBA_Pipe_Op *op; - Evas_Object_Image *oim = pim; - RGBA_Image *im; - if (!oim || !dst) return; - im = oim->engine_data; - if (!im) return; + if (!src) return; +// evas_common_pipe_flush(src); dst->pipe = evas_common_pipe_add(dst->pipe, &op); if (!dst->pipe) return; - op->op.image.x = x; - op->op.image.y = y; - op->op.image.w = w; - op->op.image.h = h; - im->ref++; - op->op.image.im = oim; + op->op.image.smooth = smooth; + op->op.image.sx = src_region_x; + op->op.image.sy = src_region_y; + op->op.image.sw = src_region_w; + op->op.image.sh = src_region_h; + op->op.image.dx = dst_region_x; + op->op.image.dy = dst_region_y; + op->op.image.dw = dst_region_w; + op->op.image.dh = dst_region_h; + src->ref++; + op->op.image.src = src; op->op_func = evas_common_pipe_image_draw_do; op->free_func = evas_common_pipe_op_image_free; evas_common_pipe_draw_context_copy(dc, op); diff --git a/src/lib/engines/common/evas_pipe.h b/src/lib/engines/common/evas_pipe.h index 7aa77f4..55c1aed 100644 --- a/src/lib/engines/common/evas_pipe.h +++ b/src/lib/engines/common/evas_pipe.h @@ -13,11 +13,9 @@ EAPI void evas_common_pipe_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc EAPI void evas_common_pipe_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1); EAPI void evas_common_pipe_poly_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points); EAPI void evas_common_pipe_grad_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h, RGBA_Gradient *gr); +EAPI void evas_common_pipe_grad2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h, RGBA_Gradient2 *gr); EAPI void evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int x, int y, const char *text); - -EAPI void evas_common_pipe_grad2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr, int x, int y, int w, int h); - -EAPI void evas_common_pipe_image_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pim, int x, int y, int w, int h); +EAPI void evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int smooth, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); #endif /* _EVAS_PIPE_H */ diff --git a/src/lib/engines/common/evas_transform.c b/src/lib/engines/common/evas_transform.c deleted file mode 100644 index f91ac46..0000000 --- a/src/lib/engines/common/evas_transform.c +++ /dev/null @@ -1,61 +0,0 @@ -#include "evas_common.h" -#include "evas_private.h" -#include - -EAPI void -evas_common_transform_affine_rect_bounds_get(Evas_Common_Transform *t, - int x, int y, int w, int h, - int *x_out, int *y_out, int *w_out, int *h_out) -{ - double d; - int axx, axy, ayx, ayy; - int z, x0, x1, y0, y1; - - evas_common_cpu_end_opt(); // work damn it! - - if (!t || !x_out || !y_out || !w_out || !h_out) return; - if (t->is_identity) - { - *x_out = x; *y_out = y; - *w_out = w; *h_out = h; - return; - } - d = (t->mxx * (double)t->myy) - (t->mxy * (double)t->myx); - if (fabs(d) < 0.000030517578125) - { - *x_out = 0; *y_out = 0; - *w_out = 0; *h_out = 0; - return; - } - d = 1.0 / d; - axx = d * t->myy * 65536; ayy = d * t->mxx * 65536; - axy = -d * t->mxy * 65536; ayx = -d * t->myx * 65536; - - x0 = x1 = (axx * x) + (axy * y); - z = (axx * (x + w)) + (axy * y); - if (z < x0) x0 = z; - if (z > x1) x1 = z; - z = (axx * x) + (axy * (y + h)); - if (z < x0) x0 = z; - if (z > x1) x1 = z; - z = (axx * (x + w)) + (axy * (y + h)); - if (z < x0) x0 = z; - if (z > x1) x1 = z; - z = x0 - (((axx * (t->mxz - 0.5)) + (axy * (t->myz - 0.5)))) - 32768; - *x_out = z >> 16; - *w_out = ((x1 + 65535) >> 16) - ((x0 - 65535) >> 16); // kludgy, but... - - y0 = y1 = (ayx * x) + (ayy * y); - z = (ayx * (x + w)) + (ayy * y); - if (z < y0) y0 = z; - if (z > y1) y1 = z; - z = (ayx * x) + (ayy * (y + h)); - if (z < y0) y0 = z; - if (z > y1) y1 = z; - z = (ayx * (x + w)) + (ayy * (y + h)); - if (z < y0) y0 = z; - if (z > y1) y1 = z; - z = y0 - ((ayx * (t->mxz - 0.5)) + (ayy * (t->myz - 0.5))) - 32768; - *y_out = z >> 16; - *h_out = ((y1 + 65535) >> 16) - ((y0 - 65535) >> 16); // kludgy, but... -} diff --git a/src/lib/engines/common/evas_transform.h b/src/lib/engines/common/evas_transform.h deleted file mode 100755 index 89cdf39..0000000 --- a/src/lib/engines/common/evas_transform.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _EVAS_TRANSFORM_H -#define _EVAS_TRANSFORM_H - -EAPI void evas_common_transform_affine_rect_bounds_get(Evas_Common_Transform *t, int x, int y, int w, int h, - int *x_out, int *y_out, int *w_out, int *h_out); - -#endif /* _EVAS_TRANSFORM_H */ diff --git a/src/lib/include/evas_common.h b/src/lib/include/evas_common.h index a890fb4..59f3834 100644 --- a/src/lib/include/evas_common.h +++ b/src/lib/include/evas_common.h @@ -191,10 +191,6 @@ typedef void (*Gfx_Func_Gradient2_Fill)(DATA32 *src, int src_len, int x, int y, void *geom_data); -typedef void (*Gfx_Func_Image_Fill)(DATA32 *src, int src_w, int src_h, - DATA32 *dst, DATA8 *mask, int len, - int x, int y, - void *geom_data); #include "../cache/evas_cache.h" /*****************************************************************************/ @@ -354,8 +350,6 @@ struct _Evas_Common_Transform float mxx, mxy, mxz; float myx, myy, myz; float mzx, mzy, mzz; - unsigned char is_identity : 1; - unsigned char is_projective : 1; }; struct _RGBA_Draw_Context @@ -411,7 +405,7 @@ struct _RGBA_Pipe_Op int x, y, w, h; } grad; struct { - void *grad; + RGBA_Gradient2 *grad; int x, y, w, h; } grad2; struct { @@ -420,8 +414,10 @@ struct _RGBA_Pipe_Op char *text; } text; struct { - void *im; - int x, y, w, h; + RGBA_Image *src; + int sx, sy, sw, sh, dx, dy, dw, dh; + int smooth; + char *text; } image; } op; }; @@ -569,11 +565,18 @@ struct _RGBA_Gradient2 struct { Eina_Inlist *stops; int nstops; + DATA32 *cdata; + DATA8 *adata; int len; } stops; struct { + Evas_Common_Transform transform; + int spread; + } fill; + struct + { int id; RGBA_Gradient2_Type *geometer; void *gdata; @@ -589,10 +592,13 @@ struct _RGBA_Gradient2_Type const char *name; void (*init)(void); void (*shutdown)(void); + void (*geom_init)(RGBA_Gradient2 *gr); + void (*geom_update)(RGBA_Gradient2 *gr); void (*geom_free)(void *gdata); - int (*has_alpha)(void *ogr, int render_op); - int (*has_mask)(void *ogr, int render_op); - Gfx_Func_Gradient2_Fill (*get_fill_func)(void *ogr, int render_op); + int (*has_alpha)(RGBA_Gradient2 *gr, int render_op); + int (*has_mask)(RGBA_Gradient2 *gr, int render_op); + int (*get_map_len)(RGBA_Gradient2 *gr); + Gfx_Func_Gradient2_Fill (*get_fill_func)(RGBA_Gradient2 *gr, int render_op); }; @@ -877,7 +883,6 @@ EAPI void evas_common_cpu_end_opt (void); EAPI int evas_common_cpu_count (void); /****/ -#include "../engines/common/evas_transform.h" #include "../engines/common/evas_blend.h" EAPI Gfx_Func_Copy evas_common_draw_func_copy_get (int pixels, int reverse); diff --git a/src/lib/include/evas_private.h b/src/lib/include/evas_private.h index 74e56ff..0c322a2 100644 --- a/src/lib/include/evas_private.h +++ b/src/lib/include/evas_private.h @@ -578,9 +578,12 @@ struct _Evas_Func void (*gradient2_color_np_stop_insert) (void *data, void *gradient, int r, int g, int b, int a, float pos); void (*gradient2_clear) (void *data, void *gradient); + void (*gradient2_fill_transform_set) (void *data, void *gradient, void *transform); + void (*gradient2_fill_spread_set) (void *data, void *gradient, int spread); void *(*gradient2_linear_new) (void *data); void (*gradient2_linear_free) (void *data, void *linear_gradient); + void (*gradient2_linear_fill_set) (void *data, void *linear_gradient, float x0, float y0, float x1, float y1); int (*gradient2_linear_is_opaque) (void *data, void *context, void *linear_gradient, int x, int y, int w, int h); int (*gradient2_linear_is_visible) (void *data, void *context, void *linear_gradient, int x, int y, int w, int h); void (*gradient2_linear_render_pre) (void *data, void *context, void *linear_gradient); @@ -589,6 +592,7 @@ struct _Evas_Func void *(*gradient2_radial_new) (void *data); void (*gradient2_radial_free) (void *data, void *radial_gradient); + void (*gradient2_radial_fill_set) (void *data, void *radial_gradient, float cx, float cy, float rx, float ry); int (*gradient2_radial_is_opaque) (void *data, void *context, void *radial_gradient, int x, int y, int w, int h); int (*gradient2_radial_is_visible) (void *data, void *context, void *radial_gradient, int x, int y, int w, int h); void (*gradient2_radial_render_pre) (void *data, void *context, void *radial_gradient); @@ -629,10 +633,9 @@ struct _Evas_Func void (*image_data_preload_cancel) (void *data, void *image); void *(*image_alpha_set) (void *data, void *image, int has_alpha); int (*image_alpha_get) (void *data, void *image); - int (*image_is_opaque) (void *data, void *context, void *image, int x, int y, int w, int h); - void (*image_render_pre) (void *data, void *context, void *image); - void (*image_render_post) (void *data, void *image); - void (*image_draw) (void *data, void *context, void *surface, void *image, int x, int y, int w, int h); + void *(*image_border_set) (void *data, void *image, int l, int r, int t, int b); + void (*image_border_get) (void *data, void *image, int *l, int *r, int *t, int *b); + void (*image_draw) (void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth); char *(*image_comment_get) (void *data, void *image, char *key); char *(*image_format_get) (void *data, void *image); void (*image_colorspace_set) (void *data, void *image, int cspace); diff --git a/src/modules/engines/gl_x11/evas_engine.c b/src/modules/engines/gl_x11/evas_engine.c index 51cbdee..1c56809 100644 --- a/src/modules/engines/gl_x11/evas_engine.c +++ b/src/modules/engines/gl_x11/evas_engine.c @@ -385,6 +385,17 @@ eng_gradient2_clear(void *data, void *gradient) { } +static void +eng_gradient2_fill_transform_set(void *data, void *gradient, void *transform) +{ +} + +static void +eng_gradient2_fill_spread_set +(void *data, void *gradient, int spread) +{ +} + static void * eng_gradient2_linear_new(void *data) { @@ -396,6 +407,11 @@ eng_gradient2_linear_free(void *data, void *linear_gradient) { } +static void +eng_gradient2_linear_fill_set(void *data, void *linear_gradient, int x0, int y0, int x1, int y1) +{ +} + static int eng_gradient2_linear_is_opaque(void *data, void *context, void *linear_gradient, int x, int y, int w, int h) { @@ -434,6 +450,11 @@ eng_gradient2_radial_free(void *data, void *radial_gradient) { } +static void +eng_gradient2_radial_fill_set(void *data, void *radial_gradient, float cx, float cy, float rx, float ry) +{ +} + static int eng_gradient2_radial_is_opaque(void *data, void *context, void *radial_gradient, int x, int y, int w, int h) { @@ -652,6 +673,23 @@ eng_image_alpha_set(void *data, void *image, int has_alpha) return image; } +static void * +eng_image_border_set(void *data, void *image, int l, int r, int t, int b) +{ + Render_Engine *re; + + re = (Render_Engine *)data; + return image; +} + +static void +eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b) +{ + Render_Engine *re; + + re = (Render_Engine *)data; +} + static char * eng_image_comment_get(void *data, void *image, char *key) { @@ -952,23 +990,6 @@ eng_image_data_preload_cancel(void *data, void *image) evas_cache_image_preload_cancel(&im->cache_entry); } -static int -eng_image_is_opaque(void *data, void *context, void *image, int x, int y, int w, int h) -{ - return 0; -} - -static void -eng_image_render_pre(void *data, void *context, void *image) -{ -} - -static void -eng_image_render_post(void *data, void *image) -{ -} - -#if 0 static void eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth) { @@ -983,12 +1004,6 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, dst_x, dst_y, dst_w, dst_h, smooth); } -#endif - -static void -eng_image_draw(void *data, void *context, void *surface, void *image, int x, int y, int w, int h) -{ -} static void eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y, int w, int h, int ow, int oh, const char *text) @@ -1077,7 +1092,6 @@ module_open(Evas_Module *em) ORD(context_cutout_clear); ORD(output_flush); ORD(output_idle_flush); - ORD(rectangle_draw); ORD(line_draw); ORD(polygon_point_add); @@ -1086,8 +1100,11 @@ module_open(Evas_Module *em) ORD(gradient2_color_np_stop_insert); ORD(gradient2_clear); + ORD(gradient2_fill_transform_set); + ORD(gradient2_fill_spread_set); ORD(gradient2_linear_new); ORD(gradient2_linear_free); + ORD(gradient2_linear_fill_set); ORD(gradient2_linear_is_opaque); ORD(gradient2_linear_is_visible); ORD(gradient2_linear_render_pre); @@ -1095,6 +1112,7 @@ module_open(Evas_Module *em) ORD(gradient2_linear_draw); ORD(gradient2_radial_new); ORD(gradient2_radial_free); + ORD(gradient2_radial_fill_set); ORD(gradient2_radial_is_opaque); ORD(gradient2_radial_is_visible); ORD(gradient2_radial_render_pre); @@ -1120,7 +1138,6 @@ module_open(Evas_Module *em) ORD(gradient_render_pre); ORD(gradient_render_post); ORD(gradient_draw); - ORD(image_load); ORD(image_new_from_data); ORD(image_new_from_copied_data); @@ -1134,9 +1151,8 @@ module_open(Evas_Module *em) ORD(image_data_preload_cancel); ORD(image_alpha_set); ORD(image_alpha_get); - ORD(image_is_opaque); - ORD(image_render_pre); - ORD(image_render_post); + ORD(image_border_set); + ORD(image_border_get); ORD(image_draw); ORD(image_comment_get); ORD(image_format_get); @@ -1144,7 +1160,6 @@ module_open(Evas_Module *em) ORD(image_colorspace_get); ORD(image_native_set); ORD(image_native_get); - ORD(font_draw); /* now advertise out own api */ em->functions = (void *)(&func); diff --git a/src/modules/engines/software_generic/evas_engine.c b/src/modules/engines/software_generic/evas_engine.c index 5251fc0..1435b31 100644 --- a/src/modules/engines/software_generic/evas_engine.c +++ b/src/modules/engines/software_generic/evas_engine.c @@ -193,7 +193,6 @@ eng_polygon_draw(void *data, void *context, void *surface, void *polygon) } } -/* new gradient engine funcs */ static void eng_gradient2_color_np_stop_insert(void *data, void *gradient, int r, int g, int b, int a, float pos) { @@ -206,22 +205,46 @@ eng_gradient2_clear(void *data, void *gradient) evas_common_gradient2_clear(gradient); } +static void +eng_gradient2_fill_transform_set(void *data, void *gradient, void *transform) +{ + evas_common_gradient2_fill_transform_set(gradient, transform); +} + +static void +eng_gradient2_fill_spread_set +(void *data, void *gradient, int spread) +{ + evas_common_gradient2_fill_spread_set(gradient, spread); +} + static void * eng_gradient2_linear_new(void *data) { - return evas_common_rgba_gradient2_linear_new(); + return evas_common_gradient2_linear_new(); } static void eng_gradient2_linear_free(void *data, void *linear_gradient) { - evas_common_rgba_gradient2_free(linear_gradient); + evas_common_gradient2_free(linear_gradient); +} + +static void +eng_gradient2_linear_fill_set(void *data, void *linear_gradient, float x0, float y0, float x1, float y1) +{ + evas_common_gradient2_linear_fill_set(linear_gradient, x0, y0, x1, y1); } static int eng_gradient2_linear_is_opaque(void *data, void *context, void *linear_gradient, int x, int y, int w, int h) { - return evas_common_gradient2_opaque(context, linear_gradient, x, y, w, h); + RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context; + RGBA_Gradient2 *gr = (RGBA_Gradient2 *)linear_gradient; + + if (!dc || !gr || !gr->type.geometer) return 0; + return !(gr->type.geometer->has_alpha(gr, dc->render_op) | + gr->type.geometer->has_mask(gr, dc->render_op)); } static int @@ -236,8 +259,14 @@ eng_gradient2_linear_is_visible(void *data, void *context, void *linear_gradient static void eng_gradient2_linear_render_pre(void *data, void *context, void *linear_gradient) { - if (!context || !linear_gradient) return; - evas_common_gradient2_linear_render_pre(context, linear_gradient); + RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context; + RGBA_Gradient2 *gr = (RGBA_Gradient2 *)linear_gradient; + int len; + + if (!dc || !gr || !gr->type.geometer) return; + gr->type.geometer->geom_update(gr); + len = gr->type.geometer->get_map_len(gr); + evas_common_gradient2_map(dc, gr, len); } static void @@ -250,28 +279,39 @@ eng_gradient2_linear_draw(void *data, void *context, void *surface, void *linear { #ifdef BUILD_PTHREAD if (cpunum > 1) - evas_common_pipe_grad2_draw(surface, context, linear_gradient, x, y, w, h); + evas_common_pipe_grad2_draw(surface, context, x, y, w, h, linear_gradient); else #endif - evas_common_gradient2_draw(surface, context, linear_gradient, x, y, w, h); + evas_common_gradient2_draw(surface, context, x, y, w, h, linear_gradient); } static void * eng_gradient2_radial_new(void *data) { - return evas_common_rgba_gradient2_radial_new(); + return evas_common_gradient2_radial_new(); } static void eng_gradient2_radial_free(void *data, void *radial_gradient) { - evas_common_rgba_gradient2_free(radial_gradient); + evas_common_gradient2_free(radial_gradient); +} + +static void +eng_gradient2_radial_fill_set(void *data, void *radial_gradient, float cx, float cy, float rx, float ry) +{ + evas_common_gradient2_radial_fill_set(radial_gradient, cx, cy, rx, ry); } static int eng_gradient2_radial_is_opaque(void *data, void *context, void *radial_gradient, int x, int y, int w, int h) { - return evas_common_gradient2_opaque(context, radial_gradient, x, y, w, h); + RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context; + RGBA_Gradient2 *gr = (RGBA_Gradient2 *)radial_gradient; + + if (!dc || !gr || !gr->type.geometer) return 0; + return !(gr->type.geometer->has_alpha(gr, dc->render_op) | + gr->type.geometer->has_mask(gr, dc->render_op)); } static int @@ -286,8 +326,14 @@ eng_gradient2_radial_is_visible(void *data, void *context, void *radial_gradient static void eng_gradient2_radial_render_pre(void *data, void *context, void *radial_gradient) { - if (!context || !radial_gradient) return; - evas_common_gradient2_radial_render_pre(context, radial_gradient); + RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context; + RGBA_Gradient2 *gr = (RGBA_Gradient2 *)radial_gradient; + int len; + + if (!dc || !gr || !gr->type.geometer) return; + gr->type.geometer->geom_update(gr); + len = gr->type.geometer->get_map_len(gr); + evas_common_gradient2_map(dc, gr, len); } static void @@ -300,13 +346,12 @@ eng_gradient2_radial_draw(void *data, void *context, void *surface, void *radial { #ifdef BUILD_PTHREAD if (cpunum > 1) - evas_common_pipe_grad2_draw(surface, context, radial_gradient, x, y, w, h); + evas_common_pipe_grad2_draw(surface, context, x, y, w, h, radial_gradient); else #endif - evas_common_gradient2_draw(surface, context, radial_gradient, x, y, w, h); + evas_common_gradient2_draw(surface, context, x, y, w, h, radial_gradient); } -/* old gradient engine funcs */ static void * eng_gradient_new(void *data) { @@ -443,7 +488,106 @@ eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int } } -/* image engine funcs */ +static int +eng_image_alpha_get(void *data, void *image) +{ + Image_Entry *im; + + if (!image) return 1; + im = image; + switch (im->space) + { + case EVAS_COLORSPACE_ARGB8888: + if (im->flags.alpha) return 1; + default: + break; + } + return 0; +} + +static int +eng_image_colorspace_get(void *data, void *image) +{ + Image_Entry *im; + + if (!image) return EVAS_COLORSPACE_ARGB8888; + im = image; + return im->space; +} + +static void * +eng_image_alpha_set(void *data, void *image, int has_alpha) +{ + RGBA_Image *im; + + if (!image) return NULL; + im = image; + if (im->cache_entry.space != EVAS_COLORSPACE_ARGB8888) + { + im->cache_entry.flags.alpha = 0; + return im; + } + im = (RGBA_Image *) evas_cache_image_alone(&im->cache_entry); + evas_common_image_colorspace_dirty(im); + + im->cache_entry.flags.alpha = has_alpha ? 1 : 0; + return im; +} + +static void * +eng_image_border_set(void *data, void *image, int l, int r, int t, int b) +{ + RGBA_Image *im; + + im = image; + return im; +} + +static void +eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b) +{ + RGBA_Image *im; + + im = image; +} + +static char * +eng_image_comment_get(void *data, void *image, char *key) +{ + RGBA_Image *im; + + if (!image) return NULL; + im = image; + return im->info.comment; +} + +static char * +eng_image_format_get(void *data, void *image) +{ + return NULL; +} + +static void +eng_image_colorspace_set(void *data, void *image, int cspace) +{ + Image_Entry *im; + + if (!image) return; + im = image; + evas_cache_image_colorspace(im, cspace); +} + +static void +eng_image_native_set(void *data, void *image, void *native) +{ +} + +static void * +eng_image_native_get(void *data, void *image) +{ + return NULL; +} + static void * eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) { @@ -527,9 +671,6 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data) return im; } -static int eng_image_alpha_get(void *data, void *image); -static int eng_image_colorspace_get(void *data, void *image); - static void * eng_image_data_put(void *data, void *image, DATA32 *image_data) { @@ -590,116 +731,34 @@ eng_image_data_preload_cancel(void *data, void *image) evas_cache_image_preload_cancel(&im->cache_entry); } -static void * -eng_image_alpha_set(void *data, void *image, int has_alpha) +static void +eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth) { RGBA_Image *im; - if (!image) return NULL; - im = image; - if (im->cache_entry.space != EVAS_COLORSPACE_ARGB8888) - { - im->cache_entry.flags.alpha = 0; - return im; - } - im = (RGBA_Image *) evas_cache_image_alone(&im->cache_entry); - evas_common_image_colorspace_dirty(im); - - im->cache_entry.flags.alpha = has_alpha ? 1 : 0; - return im; -} - -static int -eng_image_alpha_get(void *data, void *image) -{ - Image_Entry *im; - - if (!image) return 1; + if (!image) return; im = image; - switch (im->space) - { - case EVAS_COLORSPACE_ARGB8888: - if (im->flags.alpha) return 1; - default: - break; - } - return 0; -} - -/* maybe just get rid of this func? */ -static int -eng_image_is_opaque(void *data, void *context, void *image, int x, int y, int w, int h) -{ - return 0; -} - -static void -eng_image_render_pre(void *data, void *context, void *image) -{ - evas_common_image_render_pre(context, image); -} - -static void -eng_image_render_post(void *data, void *image) -{ -} - -static void -eng_image_draw(void *data, void *context, void *surface, void *image, int x, int y, int w, int h) -{ + if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888) + evas_cache_image_load_data(&im->cache_entry); + evas_common_image_colorspace_normalize(im); #ifdef BUILD_PTHREAD if (cpunum > 1) - evas_common_pipe_image_draw(surface, context, image, x, y, w, h); + evas_common_pipe_image_draw(im, surface, context, smooth, + src_x, src_y, src_w, src_h, + dst_x, dst_y, dst_w, dst_h); else #endif - evas_common_image_draw2(surface, context, image, x, y, w, h); -} - -static char * -eng_image_comment_get(void *data, void *image, char *key) -{ - RGBA_Image *im; - - if (!image) return NULL; - im = image; - return im->info.comment; -} - -static char * -eng_image_format_get(void *data, void *image) -{ - return NULL; -} - -static void -eng_image_colorspace_set(void *data, void *image, int cspace) -{ - Image_Entry *im; - - if (!image) return; - im = image; - evas_cache_image_colorspace(im, cspace); -} - -static int -eng_image_colorspace_get(void *data, void *image) -{ - Image_Entry *im; - - if (!image) return EVAS_COLORSPACE_ARGB8888; - im = image; - return im->space; -} - -static void -eng_image_native_set(void *data, void *image, void *native) -{ -} - -static void * -eng_image_native_get(void *data, void *image) -{ - return NULL; + { + if (smooth) + evas_common_scale_rgba_in_to_out_clip_smooth(im, surface, context, + src_x, src_y, src_w, src_h, + dst_x, dst_y, dst_w, dst_h); + else + evas_common_scale_rgba_in_to_out_clip_sample(im, surface, context, + src_x, src_y, src_w, src_h, + dst_x, dst_y, dst_w, dst_h); + evas_common_cpu_end_opt(); + } } static void @@ -916,13 +975,15 @@ static Evas_Func func = eng_polygon_point_add, eng_polygon_points_clear, eng_polygon_draw, - - /* gradient2 engine funcs */ + /* gradient draw funcs */ eng_gradient2_color_np_stop_insert, eng_gradient2_clear, + eng_gradient2_fill_transform_set, + eng_gradient2_fill_spread_set, eng_gradient2_linear_new, eng_gradient2_linear_free, + eng_gradient2_linear_fill_set, eng_gradient2_linear_is_opaque, eng_gradient2_linear_is_visible, eng_gradient2_linear_render_pre, @@ -931,13 +992,13 @@ static Evas_Func func = eng_gradient2_radial_new, eng_gradient2_radial_free, + eng_gradient2_radial_fill_set, eng_gradient2_radial_is_opaque, eng_gradient2_radial_is_visible, eng_gradient2_radial_render_pre, eng_gradient2_radial_render_post, eng_gradient2_radial_draw, - /* old gradient funcs */ eng_gradient_new, eng_gradient_free, eng_gradient_color_stop_add, @@ -957,8 +1018,7 @@ static Evas_Func func = eng_gradient_render_pre, eng_gradient_render_post, eng_gradient_draw, - - /* image emgine funcs */ + /* image draw funcs */ eng_image_load, eng_image_new_from_data, eng_image_new_from_copied_data, @@ -973,9 +1033,8 @@ static Evas_Func func = eng_image_data_preload_cancel, eng_image_alpha_set, eng_image_alpha_get, - eng_image_is_opaque, - eng_image_render_pre, - eng_image_render_post, + eng_image_border_set, + eng_image_border_get, eng_image_draw, eng_image_comment_get, eng_image_format_get, @@ -987,8 +1046,7 @@ static Evas_Func func = eng_image_cache_flush, eng_image_cache_set, eng_image_cache_get, - - /* font engine functions */ + /* font draw functions */ eng_font_load, eng_font_memory_load, eng_font_add, diff --git a/src/modules/engines/xrender_x11/evas_engine.c b/src/modules/engines/xrender_x11/evas_engine.c index cd89e37..755b045 100644 --- a/src/modules/engines/xrender_x11/evas_engine.c +++ b/src/modules/engines/xrender_x11/evas_engine.c @@ -339,6 +339,7 @@ eng_polygon_draw(void *data, void *context, void *surface, void *polygon) _xre_poly_draw((Xrender_Surface *)surface, (RGBA_Draw_Context *)context, (RGBA_Polygon_Point *)polygon); } + static void eng_gradient2_color_np_stop_insert(void *data, void *gradient, int r, int g, int b, int a, float pos) { @@ -349,6 +350,17 @@ eng_gradient2_clear(void *data, void *gradient) { } +static void +eng_gradient2_fill_transform_set(void *data, void *gradient, void *transform) +{ +} + +static void +eng_gradient2_fill_spread_set +(void *data, void *gradient, int spread) +{ +} + static void * eng_gradient2_linear_new(void *data) { @@ -360,6 +372,11 @@ eng_gradient2_linear_free(void *data, void *linear_gradient) { } +static void +eng_gradient2_linear_fill_set(void *data, void *linear_gradient, int x0, int y0, int x1, int y1) +{ +} + static int eng_gradient2_linear_is_opaque(void *data, void *context, void *linear_gradient, int x, int y, int w, int h) { @@ -398,6 +415,11 @@ eng_gradient2_radial_free(void *data, void *radial_gradient) { } +static void +eng_gradient2_radial_fill_set(void *data, void *radial_gradient, float cx, float cy, float rx, float ry) +{ +} + static int eng_gradient2_radial_is_opaque(void *data, void *context, void *radial_gradient, int x, int y, int w, int h) { @@ -600,6 +622,21 @@ eng_image_alpha_set(void *data, void *image, int has_alpha) return im; } +static void * +eng_image_border_set(void *data, void *image, int l, int r, int t, int b) +{ + if (!image) return image; + _xre_image_border_set((XR_Image *)image, l, r, t, b); + return image; +} + +static void +eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b) +{ + if (!image) return; + _xre_image_border_get((XR_Image *)image, l, r, t, b); +} + static char * eng_image_comment_get(void *data, void *image, char *key) { @@ -886,23 +923,6 @@ eng_image_data_preload_cancel(void *data, void *image) evas_cache_image_preload_cancel(&im->cache_entry); } -static int -eng_image_is_opaque(void *data, void *context, void *image, int x, int y, int w, int h) -{ - return 0; -} - -static void -eng_image_render_pre(void *data, void *context, void *image) -{ -} - -static void -eng_image_render_post(void *data, void *image) -{ -} - -#if 0 static void eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth) { @@ -916,12 +936,6 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, dst_x, dst_y, dst_w, dst_h, smooth); } -#endif - -static void -eng_image_draw(void *data, void *context, void *surface, void *image, int x, int y, int w, int h) -{ -} static void eng_image_cache_flush(void *data) @@ -1008,8 +1022,11 @@ module_open(Evas_Module *em) ORD(gradient2_color_np_stop_insert); ORD(gradient2_clear); + ORD(gradient2_fill_transform_set); + ORD(gradient2_fill_spread_set); ORD(gradient2_linear_new); ORD(gradient2_linear_free); + ORD(gradient2_linear_fill_set); ORD(gradient2_linear_is_opaque); ORD(gradient2_linear_is_visible); ORD(gradient2_linear_render_pre); @@ -1017,6 +1034,7 @@ module_open(Evas_Module *em) ORD(gradient2_linear_draw); ORD(gradient2_radial_new); ORD(gradient2_radial_free); + ORD(gradient2_radial_fill_set); ORD(gradient2_radial_is_opaque); ORD(gradient2_radial_is_visible); ORD(gradient2_radial_render_pre); @@ -1042,7 +1060,6 @@ module_open(Evas_Module *em) ORD(gradient_render_pre); ORD(gradient_render_post); ORD(gradient_draw); - ORD(image_load); ORD(image_new_from_data); ORD(image_new_from_copied_data); @@ -1056,9 +1073,8 @@ module_open(Evas_Module *em) ORD(image_data_preload_cancel); ORD(image_alpha_set); ORD(image_alpha_get); - ORD(image_is_opaque); - ORD(image_render_pre); - ORD(image_render_post); + ORD(image_border_set); + ORD(image_border_get); ORD(image_draw); ORD(image_comment_get); ORD(image_format_get); @@ -1069,7 +1085,6 @@ module_open(Evas_Module *em) ORD(image_cache_flush); ORD(image_cache_set); ORD(image_cache_get); - ORD(font_draw); /* now advertise out own api */ em->functions = (void *)(&func); -- 2.7.4