jose's transform patches. some things to note:
1. nearest scaling is now broken - it's always linear interpolation. this will lead to slowdowns. i need to fix this - a must. 2. i think it's time i put in a transformed image cache that can cache an image object at a transform (and share it) automatically. 3. transforms in non-software-engines will not work - broken. need to at least do xrender and gl engines. any volunteers to help? SVN revision: 37447
This commit is contained in:
parent
f0129584b5
commit
3e984fee34
|
@ -916,6 +916,9 @@ 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 */
|
||||
|
|
|
@ -24,6 +24,8 @@ 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 \
|
||||
|
@ -46,7 +48,7 @@ evas_async_events.c \
|
|||
evas_transform.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
evas_object_gradient2_linear.c \
|
||||
evas_object_gradient2_radial.c
|
||||
evas_object_gradient2.h \
|
||||
evas_object_image.h
|
||||
|
||||
libevas_canvas_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
|
|
@ -1,24 +1,6 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_private.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;
|
||||
};
|
||||
|
||||
|
||||
#include "evas_object_gradient2.h"
|
||||
|
||||
/**
|
||||
* @defgroup Evas_Object_Gradient2_Group Gradient2 Object Functions
|
||||
|
@ -51,7 +33,6 @@ 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;
|
||||
|
@ -60,10 +41,9 @@ 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();
|
||||
engine_data = obj->func->engine_data_get(obj);
|
||||
if (engine_data)
|
||||
if (og->engine_data)
|
||||
obj->layer->evas->engine.func->gradient2_color_np_stop_insert(obj->layer->evas->engine.data.output,
|
||||
engine_data,
|
||||
og,
|
||||
r, g, b, a, pos);
|
||||
og->gradient_changed = 1;
|
||||
evas_object_change(obj);
|
||||
|
@ -77,7 +57,6 @@ EAPI void
|
|||
evas_object_gradient2_clear(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Gradient2 *og;
|
||||
void *engine_data;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return;
|
||||
|
@ -86,10 +65,9 @@ evas_object_gradient2_clear(Evas_Object *obj)
|
|||
MAGIC_CHECK(og, Evas_Object_Gradient2, MAGIC_OBJ_GRADIENT);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
engine_data = obj->func->engine_data_get(obj);
|
||||
if (engine_data)
|
||||
if (og->engine_data)
|
||||
obj->layer->evas->engine.func->gradient2_clear(obj->layer->evas->engine.data.output,
|
||||
engine_data);
|
||||
og);
|
||||
og->gradient_changed = 1;
|
||||
og->cur.gradient_opaque = 0;
|
||||
evas_object_change(obj);
|
||||
|
@ -168,16 +146,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.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;
|
||||
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;
|
||||
|
||||
og->cur.fill.transform.mxx = t->mxx;
|
||||
og->cur.fill.transform.mxy = t->mxy;
|
||||
|
@ -189,6 +167,11 @@ 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);
|
||||
}
|
||||
|
@ -218,12 +201,3 @@ 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"
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
#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
|
|
@ -1,30 +1,10 @@
|
|||
#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);
|
||||
|
@ -89,7 +69,7 @@ evas_object_gradient2_linear_add(Evas *e)
|
|||
evas_object_inject(obj, e);
|
||||
if (obj->object_data)
|
||||
{
|
||||
Evas_Object_Gradient2_Linear *o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
|
||||
Evas_Object_Gradient2 *o = (Evas_Object_Gradient2 *)(obj->object_data);
|
||||
|
||||
o->engine_data = e->engine.func->gradient2_linear_new(e->engine.data.output);
|
||||
}
|
||||
|
@ -226,6 +206,7 @@ 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);
|
||||
|
@ -233,9 +214,10 @@ evas_object_gradient2_linear_free(Evas_Object *obj)
|
|||
return;
|
||||
MAGIC_CHECK_END();
|
||||
/* free obj */
|
||||
if (o->engine_data)
|
||||
og = (Evas_Object_Gradient2 *)o;
|
||||
if (og->engine_data)
|
||||
obj->layer->evas->engine.func->gradient2_linear_free(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
og->engine_data);
|
||||
free(o);
|
||||
obj->object_data = NULL;
|
||||
}
|
||||
|
@ -249,18 +231,20 @@ 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_unset(output, context);
|
||||
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_anti_alias_set(output, context, obj->cur.anti_alias);
|
||||
obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur.render_op);
|
||||
if (o->engine_data)
|
||||
{
|
||||
obj->layer->evas->engine.func->context_color_interpolation_set(output, context,
|
||||
obj->cur.interpolation_color_space);
|
||||
if (o)
|
||||
obj->layer->evas->engine.func->gradient2_linear_draw(output, context, surface,
|
||||
o->engine_data,
|
||||
o,
|
||||
obj->cur.geometry.x + x,
|
||||
obj->cur.geometry.y + y,
|
||||
obj->cur.geometry.w,
|
||||
obj->cur.geometry.h);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -303,11 +287,9 @@ 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 && o->engine_data)
|
||||
if (o->changed && og->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);
|
||||
|
@ -319,24 +301,15 @@ 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->engine_data);
|
||||
}
|
||||
o);
|
||||
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->engine_data,
|
||||
o,
|
||||
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 */
|
||||
|
@ -371,13 +344,12 @@ 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);
|
||||
|
@ -433,9 +405,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_Linear *o;
|
||||
Evas_Object_Gradient2 *o;
|
||||
|
||||
o = (Evas_Object_Gradient2_Linear *)(obj->object_data);
|
||||
o = (Evas_Object_Gradient2 *)(obj->object_data);
|
||||
if (!o) return NULL;
|
||||
return o->engine_data;
|
||||
}
|
||||
|
@ -444,27 +416,23 @@ 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_Linear *o;
|
||||
Evas_Object_Gradient2 *og;
|
||||
Evas_Object_Gradient2 *o;
|
||||
|
||||
/* 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_Linear *)(obj->object_data);
|
||||
if (!o->engine_data) return 0;
|
||||
og = (Evas_Object_Gradient2 *)(o);
|
||||
return og->cur.gradient_opaque;
|
||||
o = (Evas_Object_Gradient2 *)(obj->object_data);
|
||||
if (!o || !o->engine_data) return 0;
|
||||
return o->cur.gradient_opaque;
|
||||
}
|
||||
|
||||
static int
|
||||
evas_object_gradient2_linear_was_opaque(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Gradient2_Linear *o;
|
||||
Evas_Object_Gradient2 *og;
|
||||
Evas_Object_Gradient2 *o;
|
||||
|
||||
/* 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_Linear *)(obj->object_data);
|
||||
if (!o->engine_data) return 0;
|
||||
og = (Evas_Object_Gradient2 *)(o);
|
||||
return og->prev.gradient_opaque;
|
||||
o = (Evas_Object_Gradient2 *)(obj->object_data);
|
||||
if (!o || !o->engine_data) return 0;
|
||||
return o->prev.gradient_opaque;
|
||||
}
|
||||
|
|
|
@ -1,30 +1,10 @@
|
|||
#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);
|
||||
|
@ -89,7 +69,7 @@ evas_object_gradient2_radial_add(Evas *e)
|
|||
evas_object_inject(obj, e);
|
||||
if (obj->object_data)
|
||||
{
|
||||
Evas_Object_Gradient2_Radial *o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
|
||||
Evas_Object_Gradient2 *o = (Evas_Object_Gradient2 *)(obj->object_data);
|
||||
|
||||
o->engine_data = e->engine.func->gradient2_radial_new(e->engine.data.output);
|
||||
}
|
||||
|
@ -225,6 +205,7 @@ 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);
|
||||
|
@ -232,9 +213,10 @@ evas_object_gradient2_radial_free(Evas_Object *obj)
|
|||
return;
|
||||
MAGIC_CHECK_END();
|
||||
/* free obj */
|
||||
if (o->engine_data)
|
||||
og = (Evas_Object_Gradient2 *)o;
|
||||
if (og->engine_data)
|
||||
obj->layer->evas->engine.func->gradient2_radial_free(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
og->engine_data);
|
||||
free(o);
|
||||
obj->object_data = NULL;
|
||||
}
|
||||
|
@ -248,18 +230,20 @@ 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_unset(output, context);
|
||||
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_anti_alias_set(output, context, obj->cur.anti_alias);
|
||||
obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur.render_op);
|
||||
if (o->engine_data)
|
||||
{
|
||||
obj->layer->evas->engine.func->context_color_interpolation_set(output, context,
|
||||
obj->cur.interpolation_color_space);
|
||||
if (o)
|
||||
obj->layer->evas->engine.func->gradient2_radial_draw(output, context, surface,
|
||||
o->engine_data,
|
||||
o,
|
||||
obj->cur.geometry.x + x,
|
||||
obj->cur.geometry.y + y,
|
||||
obj->cur.geometry.w,
|
||||
obj->cur.geometry.h);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -302,11 +286,9 @@ 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 && o->engine_data)
|
||||
if (o->changed && og->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);
|
||||
|
@ -318,24 +300,15 @@ 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->engine_data);
|
||||
}
|
||||
o);
|
||||
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->engine_data,
|
||||
o,
|
||||
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 */
|
||||
|
@ -369,13 +342,12 @@ 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);
|
||||
|
@ -431,9 +403,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_Radial *o;
|
||||
Evas_Object_Gradient2 *o;
|
||||
|
||||
o = (Evas_Object_Gradient2_Radial *)(obj->object_data);
|
||||
o = (Evas_Object_Gradient2 *)(obj->object_data);
|
||||
if (!o) return NULL;
|
||||
return o->engine_data;
|
||||
}
|
||||
|
@ -442,27 +414,23 @@ 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_Radial *o;
|
||||
Evas_Object_Gradient2 *og;
|
||||
Evas_Object_Gradient2 *o;
|
||||
|
||||
/* 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_Radial *)(obj->object_data);
|
||||
if (!o->engine_data) return 0;
|
||||
og = (Evas_Object_Gradient2 *)(o);
|
||||
return og->cur.gradient_opaque;
|
||||
o = (Evas_Object_Gradient2 *)(obj->object_data);
|
||||
if (!o || !o->engine_data) return 0;
|
||||
return o->cur.gradient_opaque;
|
||||
}
|
||||
|
||||
static int
|
||||
evas_object_gradient2_radial_was_opaque(Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Gradient2_Radial *o;
|
||||
Evas_Object_Gradient2 *og;
|
||||
Evas_Object_Gradient2 *o;
|
||||
|
||||
/* 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_Radial *)(obj->object_data);
|
||||
if (!o->engine_data) return 0;
|
||||
og = (Evas_Object_Gradient2 *)(o);
|
||||
return og->prev.gradient_opaque;
|
||||
o = (Evas_Object_Gradient2 *)(obj->object_data);
|
||||
if (!o || !o->engine_data) return 0;
|
||||
return o->prev.gradient_opaque;
|
||||
}
|
||||
|
|
|
@ -7,63 +7,15 @@
|
|||
#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);
|
||||
|
@ -430,10 +382,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.fill) && (fill)) ||
|
||||
((!o->cur.border.fill) && (!fill)))
|
||||
if (((o->cur.border.center_fill) && (fill)) ||
|
||||
((!o->cur.border.center_fill) && (!fill)))
|
||||
return;
|
||||
o->cur.border.fill = fill;
|
||||
o->cur.border.center_fill = fill;
|
||||
o->changed = 1;
|
||||
evas_object_change(obj);
|
||||
}
|
||||
|
@ -459,7 +411,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.fill;
|
||||
return o->cur.border.center_fill;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -565,8 +517,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.spread) return;
|
||||
o->cur.spread = spread;
|
||||
if (spread == o->cur.fill.spread) return;
|
||||
o->cur.fill.spread = spread;
|
||||
o->changed = 1;
|
||||
evas_object_change(obj);
|
||||
}
|
||||
|
@ -588,7 +540,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.spread;
|
||||
return o->cur.fill.spread;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -605,41 +557,45 @@ evas_object_image_fill_transform_set (Evas_Object *obj, Evas_Transform *t)
|
|||
MAGIC_CHECK_END();
|
||||
if (!t)
|
||||
{
|
||||
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->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->changed = 1;
|
||||
evas_object_change(obj);
|
||||
return;
|
||||
}
|
||||
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;
|
||||
|
||||
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;
|
||||
o->changed = 1;
|
||||
evas_object_change(obj);
|
||||
}
|
||||
|
@ -658,15 +614,15 @@ evas_object_image_fill_transform_get (const Evas_Object *obj, Evas_Transform *t)
|
|||
MAGIC_CHECK_END();
|
||||
if (t)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1871,50 +1827,6 @@ 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)
|
||||
{
|
||||
|
@ -1950,10 +1862,11 @@ evas_object_image_new(void)
|
|||
o->cur.fill.w = 1;
|
||||
o->cur.fill.h = 1;
|
||||
o->cur.smooth_scale = 1;
|
||||
o->cur.border.fill = 1;
|
||||
o->cur.border.center_fill = 1;
|
||||
o->cur.cspace = EVAS_COLORSPACE_ARGB8888;
|
||||
o->cur.transform.mxx = o->cur.transform.myy = o->cur.transform.mzz = 1;
|
||||
o->cur.spread = EVAS_TEXTURE_REPEAT;
|
||||
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->prev = o->cur;
|
||||
return o;
|
||||
}
|
||||
|
@ -2016,6 +1929,10 @@ 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;
|
||||
|
@ -2030,152 +1947,11 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su
|
|||
}
|
||||
o->dirty_pixels = 0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2237,11 +2013,13 @@ 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)) ||
|
||||
|
@ -2270,6 +2048,21 @@ 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);
|
||||
|
@ -2279,7 +2072,8 @@ 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 (((obj->cur.geometry.x != obj->prev.geometry.x) ||
|
||||
if ( o->cur.fill.transform.is_identity && o->prev.fill.transform.is_identity &&
|
||||
((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)) &&
|
||||
|
@ -2335,8 +2129,10 @@ 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 = 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);
|
||||
idx = o->cur.fill.x;
|
||||
idw = o->cur.fill.w;
|
||||
idy = o->cur.fill.y;
|
||||
idh = o->cur.fill.h;
|
||||
|
||||
if (idw < 1) idw = 1;
|
||||
if (idh < 1) idh = 1;
|
||||
|
@ -2402,6 +2198,10 @@ 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
|
||||
|
@ -2472,16 +2272,17 @@ 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.fill)) return 0;
|
||||
(!o->cur.border.center_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 (obj->cur.render_op != EVAS_RENDER_BLEND)
|
||||
if ((o->cur.fill.spread == EVAS_TEXTURE_RESTRICT) &&
|
||||
((!o->cur.fill.transform.is_identity) || (o->cur.fill.x != 0) || (o->cur.fill.y != 0)))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
@ -2494,20 +2295,22 @@ 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.fill)) return 0;
|
||||
(!o->prev.border.center_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 (obj->prev.render_op != EVAS_RENDER_BLEND)
|
||||
if ((o->prev.fill.spread == EVAS_TEXTURE_RESTRICT) &&
|
||||
((!o->prev.fill.transform.is_identity) || (o->prev.fill.x != 0) || (o->prev.fill.y != 0)))
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
#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
|
|
@ -22,8 +22,9 @@ 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;
|
||||
|
||||
|
@ -45,13 +46,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
|
||||
|
@ -115,3 +116,77 @@ 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...
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ 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)\" \
|
||||
|
@ -53,6 +54,8 @@ 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 \
|
||||
|
@ -62,7 +65,8 @@ evas_scale_smooth.c \
|
|||
evas_scale_span.c \
|
||||
evas_tiler.c \
|
||||
evas_regionbuf.c \
|
||||
evas_pipe.c
|
||||
evas_pipe.c \
|
||||
evas_transform.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
evas_blend.h \
|
||||
|
@ -96,8 +100,13 @@ 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_pipe.h \
|
||||
evas_transform.h
|
||||
|
||||
libevas_engine_common_la_DEPENDENCIES = \
|
||||
$(top_builddir)/config.h
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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,17 +751,12 @@ _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;
|
||||
unsigned char *dp1, *dp2;
|
||||
DATA32 *dp1, *dp2;
|
||||
int crv, cbu, cgu, cgv;
|
||||
|
||||
/* destination pointers */
|
||||
dp1 = rgb;
|
||||
dp2 = rgb + (w * 4);
|
||||
|
||||
crv = CRV; /* 1.596 */
|
||||
cbu = CBU; /* 2.018 */
|
||||
cgu = CGU; /* 0.391 */
|
||||
cgv = CGV; /* 0.813 */
|
||||
dp1 = (DATA32 *)rgb;
|
||||
dp2 = dp1 + w;
|
||||
|
||||
for (yy = 0; yy < h; yy += 2)
|
||||
{
|
||||
|
@ -776,47 +771,46 @@ _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 * 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);
|
||||
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);
|
||||
|
||||
dp1 += 4;
|
||||
|
||||
/* yuv to rgb */
|
||||
y = YMUL * ((*yp1++) - 16);
|
||||
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;
|
||||
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);
|
||||
|
||||
/* do the bottom 2 pixels */
|
||||
/* yuv to rgb */
|
||||
y = YMUL * ((*yp2++) - 16);
|
||||
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;
|
||||
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);
|
||||
|
||||
/* yuv to rgb */
|
||||
y = YMUL * ((*yp2++) - 16);
|
||||
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;
|
||||
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);
|
||||
}
|
||||
/* jump down one line since we are doing 2 at once */
|
||||
dp1 += (w * 4);
|
||||
dp2 += (w * 4);
|
||||
dp1 += w;
|
||||
dp2 += w;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -828,11 +822,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;
|
||||
unsigned char *dp1, *dp2;
|
||||
DATA32 *dp1, *dp2;
|
||||
|
||||
/* destination pointers */
|
||||
dp1 = rgb;
|
||||
dp2 = rgb + (w * 4);
|
||||
dp1 = (DATA32 *)rgb;
|
||||
dp2 = dp1 + w;
|
||||
|
||||
for (yy = 0; yy < h; yy += 2)
|
||||
{
|
||||
|
@ -857,35 +851,27 @@ _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++];
|
||||
*((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
|
||||
|
||||
dp1 += 4;
|
||||
*dp1++ = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
|
||||
|
||||
/* yuv to rgb */
|
||||
y = _v1164[*yp1++];
|
||||
*((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
|
||||
|
||||
dp1 += 4;
|
||||
*dp1++ = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
|
||||
|
||||
/* do the bottom 2 pixels */
|
||||
/* yuv to rgb */
|
||||
y = _v1164[*yp2++];
|
||||
*((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
|
||||
|
||||
dp2 += 4;
|
||||
*dp2++ = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
|
||||
|
||||
/* yuv to rgb */
|
||||
y = _v1164[*yp2++];
|
||||
*((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
|
||||
*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 * 4);
|
||||
dp2 += (w * 4);
|
||||
dp1 += w;
|
||||
dp2 += w;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,18 +28,21 @@ 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_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 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 RGBA_Gradient2_Type *evas_common_gradient2_type_linear_get (void);
|
||||
EAPI RGBA_Gradient2_Type *evas_common_gradient2_type_radial_get (void);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_private.h"
|
||||
#include "evas_object_gradient2.h"
|
||||
#include <math.h>
|
||||
|
||||
#define LINEAR_EPSILON 0.000030517578125
|
||||
|
@ -12,7 +13,7 @@ typedef struct _Linear_Data Linear_Data;
|
|||
struct _Linear_Data
|
||||
{
|
||||
float x0, y0, x1, y1;
|
||||
float fx0, fy0;
|
||||
int x00, y00;
|
||||
int ayx, ayy;
|
||||
int len;
|
||||
unsigned char int_axis_aligned : 1;
|
||||
|
@ -25,32 +26,25 @@ linear_init(void);
|
|||
static void
|
||||
linear_shutdown(void);
|
||||
|
||||
static void
|
||||
linear_init_geom(RGBA_Gradient2 *gr);
|
||||
|
||||
static void
|
||||
linear_update_geom(RGBA_Gradient2 *gr);
|
||||
linear_update_geom(void *pgr);
|
||||
|
||||
static void
|
||||
linear_free_geom(void *gdata);
|
||||
linear_free_geom(void *pgr);
|
||||
|
||||
static int
|
||||
linear_has_alpha(RGBA_Gradient2 *gr, int op);
|
||||
linear_has_alpha(void *pgr, int op);
|
||||
|
||||
static int
|
||||
linear_has_mask(RGBA_Gradient2 *gr, int op);
|
||||
|
||||
static int
|
||||
linear_get_map_len(RGBA_Gradient2 *gr);
|
||||
linear_has_mask(void *pgr, int op);
|
||||
|
||||
static Gfx_Func_Gradient2_Fill
|
||||
linear_get_fill_func(RGBA_Gradient2 *gr, int op);
|
||||
linear_get_fill_func(void *pgr, int op);
|
||||
|
||||
static RGBA_Gradient2_Type linear = {"linear", linear_init, linear_shutdown,
|
||||
linear_init_geom,
|
||||
linear_update_geom, linear_free_geom,
|
||||
linear_free_geom,
|
||||
linear_has_alpha, linear_has_mask,
|
||||
linear_get_map_len, linear_get_fill_func};
|
||||
linear_get_fill_func};
|
||||
|
||||
|
||||
EAPI RGBA_Gradient2_Type *
|
||||
|
@ -60,33 +54,55 @@ evas_common_gradient2_type_linear_get(void)
|
|||
}
|
||||
|
||||
EAPI RGBA_Gradient2 *
|
||||
evas_common_gradient2_linear_new(void)
|
||||
evas_common_rgba_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_init_geom(gr);
|
||||
linear_data->ayy = 65536; linear_data->ayx = 0;
|
||||
gr->type.gdata = linear_data;
|
||||
|
||||
return gr;
|
||||
}
|
||||
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_linear_fill_set(RGBA_Gradient2 *gr, float x0, float y0, float x1, float y1)
|
||||
evas_common_gradient2_linear_render_pre(RGBA_Draw_Context *dc, void *pgr)
|
||||
{
|
||||
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 = x0; linear_data->y0 = y0;
|
||||
linear_data->x1 = x1; linear_data->y1 = y1;
|
||||
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);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_linear_render_post(void *pgr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/** internal functions **/
|
||||
|
@ -126,57 +142,45 @@ linear_shutdown(void)
|
|||
static void
|
||||
linear_free_geom(void *gdata)
|
||||
{
|
||||
Linear_Data *data = (Linear_Data *)gdata;
|
||||
if (data) free(data);
|
||||
Linear_Data *linear_data = gdata;
|
||||
|
||||
if (linear_data) free(linear_data);
|
||||
}
|
||||
|
||||
static void
|
||||
linear_init_geom(RGBA_Gradient2 *gr)
|
||||
{
|
||||
Linear_Data *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(RGBA_Gradient2 *gr)
|
||||
linear_update_geom(void *pgr)
|
||||
{
|
||||
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 = (gr->fill.transform.mxx * (double)gr->fill.transform.myy) - (gr->fill.transform.mxy * (double)gr->fill.transform.myx);
|
||||
f = (ogr->cur.fill.transform.mxx * (double)ogr->cur.fill.transform.myy) - (ogr->cur.fill.transform.mxy * (double)ogr->cur.fill.transform.myx);
|
||||
if (fabs(f) < LINEAR_EPSILON) return;
|
||||
|
||||
f = 1.0 / f;
|
||||
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;
|
||||
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;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
f = hypot(fx1 - fx0, fy1 - fy0);
|
||||
linear_data->len = len = f + 0.5;
|
||||
if (!len) return;
|
||||
|
||||
linear_data->ayx = ((fx1 - fx0) / f) * 65536;
|
||||
linear_data->ayy = ((fy1 - fy0) / f) * 65536;
|
||||
linear_data->ayx = ((fx1 - fx0) * 65536) / f;
|
||||
linear_data->ayy = ((fy1 - fy0) * 65536) / f;
|
||||
|
||||
if (fabs(fy0 - fy1) < LINEAR_INT_TOLERANCE)
|
||||
{
|
||||
|
@ -190,55 +194,60 @@ linear_update_geom(RGBA_Gradient2 *gr)
|
|||
(fabs(((int)fx1) - fx1) < LINEAR_INT_TOLERANCE) )
|
||||
{ linear_data->int_axis_aligned = 1; linear_data->ayx = 0; }
|
||||
}
|
||||
linear_data->fx0 = fx0;
|
||||
linear_data->fy0 = fy0;
|
||||
linear_data->x00 = linear_data->ayx * fx0;
|
||||
linear_data->y00 = linear_data->ayy * fy0;
|
||||
}
|
||||
|
||||
static int
|
||||
linear_has_alpha(RGBA_Gradient2 *gr, int op)
|
||||
linear_has_alpha(void *pgr, 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 (gr->fill.spread == _EVAS_TEXTURE_RESTRICT)
|
||||
if (ogr->cur.fill.spread == _EVAS_TEXTURE_RESTRICT)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
linear_has_mask(RGBA_Gradient2 *gr, int op)
|
||||
linear_has_mask(void *pgr, 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 (gr->fill.spread == _EVAS_TEXTURE_RESTRICT)
|
||||
if (ogr->cur.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(RGBA_Gradient2 *gr, int op)
|
||||
linear_get_fill_func(void *pgr, 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;
|
||||
|
@ -248,7 +257,7 @@ linear_get_fill_func(RGBA_Gradient2 *gr, int op)
|
|||
(op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) )
|
||||
masked_op = 1;
|
||||
|
||||
switch (gr->fill.spread)
|
||||
switch (ogr->cur.fill.spread)
|
||||
{
|
||||
case _EVAS_TEXTURE_REPEAT:
|
||||
sfunc = linear_repeat_aa;
|
||||
|
@ -294,8 +303,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;
|
||||
|
||||
evas_common_cpu_end_opt();
|
||||
yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
|
||||
yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) +
|
||||
(gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768;
|
||||
|
||||
if (gdata->int_axis_aligned && (gdata->ayx == 0))
|
||||
{
|
||||
|
@ -353,8 +362,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 < 0))
|
||||
{ l = l % src_len; if (l < 0) l += src_len; }
|
||||
if ((l >= src_len) || (l < -src_len)) l = l % src_len;
|
||||
if (l < 0) l += src_len;
|
||||
|
||||
#ifdef BUILD_MMX
|
||||
MOV_P2R(src[l], mm1, mm0)
|
||||
|
@ -393,8 +402,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;
|
||||
|
||||
evas_common_cpu_end_opt();
|
||||
yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
|
||||
yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) +
|
||||
(gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768;
|
||||
|
||||
if (gdata->int_axis_aligned && (gdata->ayx == 0))
|
||||
{
|
||||
|
@ -523,8 +532,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;
|
||||
|
||||
evas_common_cpu_end_opt();
|
||||
yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
|
||||
yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) +
|
||||
(gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768;
|
||||
|
||||
if (gdata->int_axis_aligned && (gdata->ayx == 0))
|
||||
{
|
||||
|
@ -636,8 +645,8 @@ linear_restrict_masked_aa(DATA32 *src, int src_len, DATA32 *dst, DATA8 *mask, in
|
|||
Linear_Data *gdata = (Linear_Data *)params_data;
|
||||
int yy;
|
||||
|
||||
evas_common_cpu_end_opt();
|
||||
yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
|
||||
yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) +
|
||||
(gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768;
|
||||
|
||||
#ifdef BUILD_MMX
|
||||
pxor_r2r(mm0, mm0);
|
||||
|
@ -689,8 +698,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;
|
||||
|
||||
evas_common_cpu_end_opt();
|
||||
yy = (gdata->ayx * (x - gdata->fx0 + 0.5)) + (gdata->ayy * (y - gdata->fy0 + 0.5)) - 32768;
|
||||
yy = (gdata->ayx * x) - gdata->x00 + (gdata->ayx >> 1) +
|
||||
(gdata->ayy * y) - gdata->y00 + (gdata->ayy >> 1) - 32768;
|
||||
|
||||
#ifdef BUILD_MMX
|
||||
pxor_r2r(mm0, mm0);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_blend_private.h"
|
||||
#include "evas_private.h"
|
||||
#include "evas_object_gradient2.h"
|
||||
#include <math.h>
|
||||
|
||||
static void _evas_common_gradient2_stops_free(RGBA_Gradient2 *gr);
|
||||
|
@ -9,6 +10,10 @@ 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
|
||||
|
@ -27,7 +32,7 @@ evas_common_gradient2_init(void)
|
|||
grad_initialised = 1;
|
||||
}
|
||||
|
||||
void
|
||||
EAPI void
|
||||
evas_common_gradient2_shutdown(void)
|
||||
{
|
||||
RGBA_Gradient2_Type *geom;
|
||||
|
@ -42,12 +47,12 @@ evas_common_gradient2_shutdown(void)
|
|||
geom->shutdown();
|
||||
grad_initialised = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
_evas_common_gradient2_stops_free(RGBA_Gradient2 *gr)
|
||||
{
|
||||
if (!gr) return;
|
||||
if (gr->stops.stops)
|
||||
if (gr && gr->stops.stops)
|
||||
{
|
||||
Eina_Inlist *l;
|
||||
|
||||
|
@ -63,14 +68,12 @@ _evas_common_gradient2_stops_free(RGBA_Gradient2 *gr)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_free(RGBA_Gradient2 *gr)
|
||||
evas_common_rgba_gradient2_free(RGBA_Gradient2 *gr)
|
||||
{
|
||||
if (!gr) return;
|
||||
gr->references--;
|
||||
if (gr->references > 0) return;
|
||||
evas_common_gradient2_clear(gr);
|
||||
if (gr->stops.cdata) free(gr->stops.cdata);
|
||||
if (gr->stops.adata) free(gr->stops.adata);
|
||||
_evas_common_gradient2_stops_free(gr);
|
||||
if (gr->type.geometer && gr->type.gdata)
|
||||
gr->type.geometer->geom_free(gr->type.gdata);
|
||||
if (gr->map.data) free(gr->map.data);
|
||||
|
@ -78,20 +81,28 @@ evas_common_gradient2_free(RGBA_Gradient2 *gr)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_clear(RGBA_Gradient2 *gr)
|
||||
evas_common_gradient2_clear(void *pgr)
|
||||
{
|
||||
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(RGBA_Gradient2 *gr, int r, int g, int b, int a, float pos)
|
||||
evas_common_gradient2_color_np_stop_insert(void *pgr, 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)
|
||||
{
|
||||
|
@ -164,47 +175,87 @@ evas_common_gradient2_color_np_stop_insert(RGBA_Gradient2 *gr, int r, int g, int
|
|||
gr->has_alpha = 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_fill_transform_set(RGBA_Gradient2 *gr, Evas_Common_Transform *t)
|
||||
|
||||
EAPI int
|
||||
evas_common_gradient2_opaque(RGBA_Draw_Context *dc, void *pgr,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
if (!gr) return;
|
||||
if (!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));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr,
|
||||
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 ((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)
|
||||
{
|
||||
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;
|
||||
_evas_common_gradient2_draw(dst, dc, pgr, x, y, w, h);
|
||||
}
|
||||
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;
|
||||
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();
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_fill_spread_set(RGBA_Gradient2 *gr, int spread)
|
||||
static void
|
||||
_evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
if (!gr) return;
|
||||
gr->fill.spread = spread;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
|
||||
int x, int y, int w, int h, RGBA_Gradient2 *gr)
|
||||
{
|
||||
Gfx_Func_Gradient2_Fill gfunc;
|
||||
Evas_Object_Gradient2 *ogr = pgr;
|
||||
RGBA_Gradient2 *gr;
|
||||
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 = NULL, *alpha_buf = NULL;
|
||||
RGBA_Image argb_buf;
|
||||
DATA8 *mask = NULL;
|
||||
void *gdata;
|
||||
int direct_copy = 0, buf_step = 0;
|
||||
|
||||
if (!dst || !dc || !gr || !dst || !dst->image.data)
|
||||
if (!dc || !ogr || !dst || !dst->image.data)
|
||||
return;
|
||||
if (!gr->map.data || !gr->type.geometer)
|
||||
gr = ogr->engine_data;
|
||||
if (!gr || !gr->map.data || !gr->type.geometer)
|
||||
return;
|
||||
if ((w < 1) || (h < 1))
|
||||
return;
|
||||
|
@ -222,93 +273,70 @@ evas_common_gradient2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
|
|||
xoff = (x - xin);
|
||||
yoff = (y - yin);
|
||||
|
||||
if (!gr->type.geometer->has_mask(gr, dc->render_op))
|
||||
if (!gr->type.geometer->has_mask(ogr, 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(gr, dc->render_op))
|
||||
if (gr->type.geometer->has_alpha(ogr, dc->render_op))
|
||||
dst->cache_entry.flags.alpha = 1;
|
||||
}
|
||||
else if ((dc->render_op == _EVAS_RENDER_BLEND) &&
|
||||
!gr->type.geometer->has_alpha(gr, dc->render_op))
|
||||
!gr->type.geometer->has_alpha(ogr, dc->render_op))
|
||||
{
|
||||
direct_copy = 1; buf_step = dst->cache_entry.w;
|
||||
}
|
||||
}
|
||||
if (!direct_copy)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
|
||||
if (gr->type.geometer->has_mask(gr, dc->render_op))
|
||||
if (gr->type.geometer->has_mask(ogr, 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);
|
||||
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);
|
||||
}
|
||||
else
|
||||
bfunc = evas_common_gfx_func_composite_pixel_span_get(argb_buf, dst, w, dc->render_op);
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
gfunc = gr->type.geometer->get_fill_func(gr, dc->render_op);
|
||||
gfunc = gr->type.geometer->get_fill_func(ogr, dc->render_op);
|
||||
gdata = gr->type.gdata;
|
||||
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;
|
||||
}
|
||||
if (!gdata) 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 = argb_buf->image.data;
|
||||
if (alpha_buf)
|
||||
mask = (DATA8 *)alpha_buf->image.data;
|
||||
}
|
||||
else
|
||||
buf = pdst;
|
||||
if (direct_copy) buf = pdst;
|
||||
|
||||
while (pdst < dst_end)
|
||||
{
|
||||
#ifdef EVAS_SLI
|
||||
if ((y % dc->sli.h) == dc->sli.y)
|
||||
#endif
|
||||
{
|
||||
#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
|
||||
|
@ -386,23 +414,22 @@ _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 *pmap, *map_end;
|
||||
DATA8 *pamap = NULL;
|
||||
DATA32 *map, *pmap, *map_end;
|
||||
DATA8 *amap = NULL, *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;
|
||||
|
||||
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;
|
||||
map = alloca(gr->stops.len * sizeof(DATA32));
|
||||
if (!map) return;
|
||||
pmap = map; map_end = pmap + gr->stops.len;
|
||||
|
||||
if (gr->has_alpha)
|
||||
{
|
||||
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;
|
||||
amap = alloca(gr->stops.len * sizeof(DATA8));
|
||||
if (!amap) return;
|
||||
pamap = amap;
|
||||
}
|
||||
|
||||
gc = (RGBA_Gradient2_Color_Np_Stop *)gr->stops.stops;
|
||||
|
@ -445,17 +472,17 @@ _evas_common_gradient2_map_argb(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int l
|
|||
if (pamap) *pamap++ = gc->a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gr->stops.cdata && gr->stops.adata)
|
||||
if (map && amap)
|
||||
{
|
||||
evas_common_scale_rgba_a8_span(gr->stops.cdata, gr->stops.adata, gr->stops.len,
|
||||
evas_common_scale_rgba_a8_span(map, amap, gr->stops.len,
|
||||
dc->mul.col, gr->map.data, gr->map.len, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
evas_common_scale_rgba_span(gr->stops.cdata, NULL, gr->stops.len,
|
||||
evas_common_scale_rgba_span(map, NULL, gr->stops.len,
|
||||
dc->mul.col, gr->map.data, gr->map.len, 1);
|
||||
}
|
||||
gr->map.has_alpha |= (!!(255 - (dc->mul.col >> 24)));
|
||||
}
|
||||
|
||||
|
@ -486,8 +513,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 *pmap, *map_end;
|
||||
DATA8 *pamap = NULL;
|
||||
DATA32 *map, *pmap, *map_end;
|
||||
DATA8 *amap = NULL, *pamap = NULL;
|
||||
int i, dii;
|
||||
int h, s, v;
|
||||
int next_h, next_s, next_v;
|
||||
|
@ -495,16 +522,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;
|
||||
|
||||
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;
|
||||
map = alloca(gr->stops.len * sizeof(DATA32));
|
||||
if (!map) return;
|
||||
pmap = map; map_end = pmap + gr->stops.len;
|
||||
|
||||
if (gr->has_alpha)
|
||||
{
|
||||
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;
|
||||
amap = alloca(gr->stops.len * sizeof(DATA8));
|
||||
if (!amap)
|
||||
return;
|
||||
pamap = amap;
|
||||
}
|
||||
|
||||
gc = (RGBA_Gradient2_Color_Np_Stop *)gr->stops.stops;
|
||||
|
@ -552,23 +579,28 @@ _evas_common_gradient2_map_ahsv(RGBA_Draw_Context *dc, RGBA_Gradient2 *gr, int l
|
|||
if (pamap) *pamap++ = gc->a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gr->stops.cdata && gr->stops.adata)
|
||||
if (map && amap)
|
||||
{
|
||||
evas_common_scale_hsva_a8_span(gr->stops.cdata, gr->stops.adata, gr->stops.len,
|
||||
evas_common_scale_hsva_a8_span(map, amap, gr->stops.len,
|
||||
dc->mul.col, gr->map.data, gr->map.len, 1);
|
||||
return;
|
||||
}
|
||||
evas_common_scale_hsva_span(gr->stops.cdata, NULL, gr->stops.len,
|
||||
evas_common_scale_hsva_span(map, 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, RGBA_Gradient2 *gr, int len)
|
||||
evas_common_gradient2_map(RGBA_Draw_Context *dc, void *pgr, int len)
|
||||
{
|
||||
if (!gr || !dc) return;
|
||||
Evas_Object_Gradient2 *ogr = pgr;
|
||||
RGBA_Gradient2 *gr;
|
||||
|
||||
if (!ogr || !dc) return;
|
||||
gr = ogr->engine_data;
|
||||
if (!gr) return;
|
||||
if (dc->interpolation.color_space == _EVAS_COLOR_SPACE_AHSV)
|
||||
{
|
||||
_evas_common_gradient2_map_ahsv(dc, gr, len);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_private.h"
|
||||
#include "evas_object_gradient2.h"
|
||||
#include <math.h>
|
||||
|
||||
#define RADIAL_EPSILON 0.000030517578125
|
||||
|
@ -23,31 +24,24 @@ static void
|
|||
radial_shutdown(void);
|
||||
|
||||
static void
|
||||
radial_init_geom(RGBA_Gradient2 *gr);
|
||||
|
||||
static void
|
||||
radial_update_geom(RGBA_Gradient2 *gr);
|
||||
radial_update_geom(void *pgr);
|
||||
|
||||
static void
|
||||
radial_free_geom(void *gdata);
|
||||
|
||||
static int
|
||||
radial_has_alpha(RGBA_Gradient2 *gr, int op);
|
||||
radial_has_alpha(void *pgr, int op);
|
||||
|
||||
static int
|
||||
radial_has_mask(RGBA_Gradient2 *gr, int op);
|
||||
|
||||
static int
|
||||
radial_get_map_len(RGBA_Gradient2 *gr);
|
||||
radial_has_mask(void *pgr, int op);
|
||||
|
||||
static Gfx_Func_Gradient2_Fill
|
||||
radial_get_fill_func(RGBA_Gradient2 *gr, int op);
|
||||
radial_get_fill_func(void *pgr, int op);
|
||||
|
||||
static RGBA_Gradient2_Type radial = {"radial", radial_init, radial_shutdown,
|
||||
radial_init_geom,
|
||||
radial_update_geom, radial_free_geom,
|
||||
radial_free_geom,
|
||||
radial_has_alpha, radial_has_mask,
|
||||
radial_get_map_len, radial_get_fill_func};
|
||||
radial_get_fill_func};
|
||||
|
||||
|
||||
EAPI RGBA_Gradient2_Type *
|
||||
|
@ -57,32 +51,60 @@ evas_common_gradient2_type_radial_get(void)
|
|||
}
|
||||
|
||||
EAPI RGBA_Gradient2 *
|
||||
evas_common_gradient2_radial_new(void)
|
||||
evas_common_rgba_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_init_geom(gr);
|
||||
|
||||
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;
|
||||
|
||||
return gr;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_gradient2_radial_fill_set(RGBA_Gradient2 *gr, float cx, float cy, float rx, float ry)
|
||||
evas_common_gradient2_radial_render_pre(RGBA_Draw_Context *dc, void *pgr)
|
||||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,39 +144,23 @@ radial_shutdown(void)
|
|||
static void
|
||||
radial_free_geom(void *gdata)
|
||||
{
|
||||
Radial_Data *data = (Radial_Data *)gdata;
|
||||
if (data) free(data);
|
||||
Radial_Data *radial_data = (Radial_Data *)gdata;
|
||||
if (radial_data) free(radial_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(RGBA_Gradient2 *gr)
|
||||
radial_update_geom(void *pgr)
|
||||
{
|
||||
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;
|
||||
|
@ -163,86 +169,81 @@ radial_update_geom(RGBA_Gradient2 *gr)
|
|||
if ((radial_data->rx < RADIAL_EPSILON) || (radial_data->ry < RADIAL_EPSILON)) return;
|
||||
|
||||
radial_data->len = 0;
|
||||
f = (gr->fill.transform.mxx * (double)gr->fill.transform.myy) - (gr->fill.transform.mxy * (double)gr->fill.transform.myx);
|
||||
f = (ogr->cur.fill.transform.mxx * (double)ogr->cur.fill.transform.myy) - (ogr->cur.fill.transform.mxy * (double)ogr->cur.fill.transform.myx);
|
||||
if (fabs(f) < RADIAL_EPSILON) return;
|
||||
|
||||
f = 1.0 / f;
|
||||
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;
|
||||
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;
|
||||
|
||||
fx1 = (gr->fill.transform.myy * (double)radial_data->rx) * f;
|
||||
fy1 = (gr->fill.transform.myx * (double)radial_data->rx) * f;
|
||||
fx1 = (ogr->cur.fill.transform.myy * (double)radial_data->rx) * f;
|
||||
fy1 = (ogr->cur.fill.transform.myx * (double)radial_data->rx) * f;
|
||||
|
||||
flen = hypot(fx1, fy1);
|
||||
|
||||
fx1 = (gr->fill.transform.mxy * (double)radial_data->ry) * f;
|
||||
fy1 = (gr->fill.transform.mxx * (double)radial_data->ry) * f;
|
||||
fx1 = (ogr->cur.fill.transform.mxy * (double)radial_data->ry) * f;
|
||||
fy1 = (ogr->cur.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)gr->fill.transform.mxx * 65536) * flen) / radial_data->rx;
|
||||
radial_data->axy = (((double)gr->fill.transform.mxy * 65536) * flen) / radial_data->rx;
|
||||
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->ayx = (((double)gr->fill.transform.myx * 65536) * flen) / radial_data->ry;
|
||||
radial_data->ayy = (((double)gr->fill.transform.myy * 65536) * flen) / radial_data->ry;
|
||||
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;
|
||||
}
|
||||
|
||||
static int
|
||||
radial_has_alpha(RGBA_Gradient2 *gr, int op)
|
||||
radial_has_alpha(void *pgr, int op)
|
||||
{
|
||||
Radial_Data *radial_data;
|
||||
Evas_Object_Gradient2 *ogr = pgr;
|
||||
RGBA_Gradient2 *gr;
|
||||
|
||||
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;
|
||||
radial_data = (Radial_Data *)gr->type.gdata;
|
||||
if (!radial_data) return 0;
|
||||
if (gr->fill.spread == _EVAS_TEXTURE_RESTRICT)
|
||||
if (ogr->cur.fill.spread == _EVAS_TEXTURE_RESTRICT)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
radial_has_mask(RGBA_Gradient2 *gr, int op)
|
||||
radial_has_mask(void *pgr, int op)
|
||||
{
|
||||
Radial_Data *radial_data;
|
||||
Evas_Object_Gradient2 *ogr= pgr;
|
||||
RGBA_Gradient2 *gr;
|
||||
|
||||
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) )
|
||||
{
|
||||
radial_data = (Radial_Data *)gr->type.gdata;
|
||||
if (!radial_data) return 0;
|
||||
if (gr->fill.spread == _EVAS_TEXTURE_RESTRICT)
|
||||
if (ogr->cur.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(RGBA_Gradient2 *gr, int op)
|
||||
radial_get_fill_func(void *pgr, 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;
|
||||
|
@ -251,7 +252,7 @@ radial_get_fill_func(RGBA_Gradient2 *gr, int op)
|
|||
(op == _EVAS_RENDER_MASK) || (op == _EVAS_RENDER_MUL) )
|
||||
masked_op = 1;
|
||||
|
||||
switch (gr->fill.spread)
|
||||
switch (ogr->cur.fill.spread)
|
||||
{
|
||||
case _EVAS_TEXTURE_REPEAT:
|
||||
sfunc = radial_repeat_aa;
|
||||
|
|
|
@ -28,5 +28,9 @@ 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 */
|
||||
|
|
|
@ -0,0 +1,241 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_blend_private.h"
|
||||
#include "evas_private.h"
|
||||
#include "evas_object_image.h"
|
||||
#include "./evas_image_private.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/* 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();
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_private.h"
|
||||
#include "evas_object_image.h"
|
||||
#include "./evas_image_private.h"
|
||||
#include <math.h>
|
||||
|
||||
static Gfx_Func_Image_Fill image_repeat_affine_get(void *pim, int render_op);
|
||||
static Gfx_Func_Image_Fill image_reflect_affine_get(void *pim, int render_op);
|
||||
static Gfx_Func_Image_Fill image_restrict_affine_get(void *pim, int render_op);
|
||||
static Gfx_Func_Image_Fill image_restrict_masked_affine_get(void *pim, int render_op);
|
||||
static Gfx_Func_Image_Fill image_pad_affine_get(void *pim, int render_op);
|
||||
|
||||
int
|
||||
evas_common_image_draw_data_setup(void *pim, Image_Draw_Data *idata)
|
||||
{
|
||||
Evas_Object_Image *oim = pim;
|
||||
int fw, fh, sw, sh;
|
||||
int l, r, t, b;
|
||||
int smooth_scale;
|
||||
|
||||
if (!oim || !idata) return 0;
|
||||
sw = oim->cur.image.w; sh = oim->cur.image.h;
|
||||
if ((sw < 1) || (sh < 1)) return 0;
|
||||
|
||||
fw = oim->cur.fill.w; fh = oim->cur.fill.h;
|
||||
if ((fw < 1) || (fh < 1)) return 0;
|
||||
|
||||
evas_common_cpu_end_opt();
|
||||
|
||||
if (fabs( (oim->cur.fill.transform.mxx * (double)oim->cur.fill.transform.myy) -
|
||||
(oim->cur.fill.transform.mxy * (double)oim->cur.fill.transform.myx) ) < 0.000030517578125)
|
||||
return 0;
|
||||
|
||||
idata->has_alpha = oim->cur.has_alpha;
|
||||
idata->border_center_fill = oim->cur.border.center_fill;
|
||||
idata->fw = fw; idata->fh = fh;
|
||||
|
||||
idata->axx = oim->cur.fill.transform.mxx * 65536;
|
||||
idata->axy = oim->cur.fill.transform.mxy * 65536;
|
||||
idata->axz = (oim->cur.fill.transform.mxz - oim->cur.fill.x) * 65536;
|
||||
idata->ayx = oim->cur.fill.transform.myx * 65536;
|
||||
idata->ayy = oim->cur.fill.transform.myy * 65536;
|
||||
idata->ayz = (oim->cur.fill.transform.myz - oim->cur.fill.y) * 65536;
|
||||
|
||||
l = oim->cur.border.l; r = oim->cur.border.r;
|
||||
t = oim->cur.border.t; b = oim->cur.border.b;
|
||||
if (l < 0) l = 0; if (r < 0) r = 0;
|
||||
if (t < 0) t = 0; if (b < 0) b = 0;
|
||||
|
||||
if (((sw == fw) && (sh == fh)) && idata->border_center_fill)
|
||||
l = r = t = b = 0;
|
||||
|
||||
if ((l > 0) || (r > 0) || (t > 0) || (b > 0))
|
||||
{
|
||||
int bw = MIN(sw, fw);
|
||||
int bh = MIN(sh, fh);
|
||||
|
||||
if ((l + r) > bw)
|
||||
{
|
||||
l = (l + (bw - r) + 1) / 2;
|
||||
r = bw - l;
|
||||
}
|
||||
if ((t + b) > bh)
|
||||
{
|
||||
t = (t + (bh - b) + 1) / 2;
|
||||
b = bh - t;
|
||||
}
|
||||
}
|
||||
idata->l = l; idata->r = r;
|
||||
idata->t = t; idata->b = b;
|
||||
|
||||
idata->iaxx = idata->iayy = idata->ibxx = idata->ibyy = 65536;
|
||||
idata->dax = idata->day = 256;
|
||||
|
||||
if ((sw == fw) && (sh == fh)) // no fill scaling
|
||||
return 1;
|
||||
|
||||
if (!oim->cur.smooth_scale || ((sw <= fw) && (sh <= fh))) // up-x, up-y
|
||||
{
|
||||
if (((sw - (l + r)) > 1) & ((fw - (l + r)) > 1))
|
||||
idata->iaxx = (((sw - (l + r)) - 1) << 16) / ((fw - (l + r)) - 1);
|
||||
else if (((sw - (l + r)) > 0) & ((fw - (l + r)) > 0))
|
||||
idata->iaxx = ((sw - (l + r)) << 16) / (fw - (l + r));
|
||||
else
|
||||
idata->iaxx = 0;
|
||||
if (((sh - (t + b)) > 1) & ((fh - (t + b)) > 1))
|
||||
idata->iayy = (((sh - (t + b)) - 1) << 16) / ((fh - (t + b)) - 1);
|
||||
else if (((sh - (t + b)) > 0) & ((fh - (t + b)) > 0))
|
||||
idata->iayy = ((sh - (t + b)) << 16) / (fh - (t + b));
|
||||
else
|
||||
idata->iayy = 0;
|
||||
return 1;
|
||||
}
|
||||
if ((sw > fw) && (sh <= fh)) // down-x, up-y
|
||||
{
|
||||
if (((sw - (l + r)) > 0) & ((fw - (l + r)) > 0))
|
||||
{
|
||||
idata->iaxx = ((sw - (l + r) + 0.5) * 65536) / (fw - (l + r) + 0.5);
|
||||
idata->ibxx = ((fw - (l + r) + 0.5) * 65536) / (sw - (l + r) + 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
idata->iaxx = 0;
|
||||
idata->ibxx = 0;
|
||||
}
|
||||
idata->dax = idata->ibxx >> 8;
|
||||
if (((sh - (t + b)) > 1) & ((fh - (t + b)) > 1))
|
||||
idata->iayy = (((sh - (t + b)) - 1) << 16) / ((fh - (t + b)) - 1);
|
||||
else if (((sh - (t + b)) > 0) & ((fh - (t + b)) > 0))
|
||||
idata->iayy = ((sh - (t + b)) << 16) / (fh - (t + b));
|
||||
else
|
||||
idata->iayy = 0;
|
||||
return 1;
|
||||
}
|
||||
if ((sw <= fw) && (sh > fh)) // up-x, down-y
|
||||
{
|
||||
if (((sw - (l + r)) > 1) & ((fw - (l + r)) > 1))
|
||||
idata->iaxx = (((sw - (l + r)) - 1) << 16) / ((fw - (l + r)) - 1);
|
||||
else if (((sw - (l + r)) > 0) & ((fw - (l + r)) > 0))
|
||||
idata->iaxx = ((sw - (l + r)) << 16) / (fw - (l + r));
|
||||
else
|
||||
idata->iaxx = 0;
|
||||
if (((sh - (t + b)) > 0) & ((fh - (t + b)) > 0))
|
||||
{
|
||||
idata->iayy = ((sh - (t + b) + 0.5) * 65536) / (fh - (t + b) + 0.5);
|
||||
idata->ibyy = ((fh - (t + b) + 0.5) * 65536) / (sh - (t + b) + 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
idata->iayy = 0;
|
||||
idata->ibyy = 0;
|
||||
}
|
||||
idata->day = idata->ibyy >> 8;
|
||||
return 1;
|
||||
}
|
||||
if ((sw > fw) && (sh > fh)) // down-x, down-y
|
||||
{
|
||||
if (((sw - (l + r)) > 0) & ((fw - (l + r)) > 0))
|
||||
{
|
||||
idata->iaxx = ((sw - (l + r) + 0.5) * 65536) / (fw - (l + r) + 0.5);
|
||||
idata->ibxx = ((fw - (l + r) + 0.5) *65536) / (sw - (l + r) + 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
idata->iaxx = 0;
|
||||
idata->ibxx = 0;
|
||||
}
|
||||
idata->dax = idata->ibxx >> 8;
|
||||
if (((sh - (t + b)) > 0) & ((fh - (t + b)) > 0))
|
||||
{
|
||||
idata->iayy = ((sh - (t + b) + 0.5) * 65536) / (fh - (t + b) + 0.5);
|
||||
idata->ibyy = ((fh - (t + b) + 0.5) * 65536) / (sh - (t + b) + 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
idata->iayy = 0;
|
||||
idata->ibyy = 0;
|
||||
}
|
||||
idata->day = idata->ibyy >> 8;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
case _EVAS_TEXTURE_PAD:
|
||||
sfunc = image_pad_affine_get(oim, render_op);
|
||||
break;
|
||||
default:
|
||||
sfunc = image_repeat_affine_get(oim, render_op);
|
||||
break;
|
||||
}
|
||||
return sfunc;
|
||||
}
|
||||
|
||||
|
||||
/* FIXME: optimize identity transform case for all modes */
|
||||
/* FIXME: have direct support for 'no-center-fill' for all modes */
|
||||
|
||||
#include "./evas_image_fill_restrict.c"
|
||||
#include "./evas_image_fill_repeat.c"
|
||||
#include "./evas_image_fill_reflect.c"
|
||||
#include "./evas_image_fill_pad.c"
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
|
||||
/* pad funcs */
|
||||
|
||||
/* FIXME: implement pad */
|
||||
|
||||
static Gfx_Func_Image_Fill image_pad_affine_get(void *pim, int render_op)
|
||||
{
|
||||
return NULL;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,22 @@
|
|||
#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);
|
||||
|
||||
|
@ -9,5 +25,6 @@ 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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -439,10 +439,13 @@ 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_common_gradient2_free(op->op.grad2.grad);
|
||||
Evas_Object_Gradient2 *ogr = op->op.grad2.grad;
|
||||
if (ogr)
|
||||
evas_common_rgba_gradient2_free(ogr->engine_data);
|
||||
evas_common_pipe_op_free(op);
|
||||
}
|
||||
|
||||
|
@ -459,24 +462,26 @@ 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),
|
||||
evas_common_gradient2_draw(dst, &(context), op->op.grad2.grad,
|
||||
op->op.grad2.x, op->op.grad2.y,
|
||||
op->op.grad2.w, op->op.grad2.h,
|
||||
op->op.grad2.grad);
|
||||
op->op.grad2.w, op->op.grad2.h);
|
||||
}
|
||||
else
|
||||
evas_common_gradient2_draw(dst, &(op->context),
|
||||
evas_common_gradient2_draw(dst, &(op->context), op->op.grad2.grad,
|
||||
op->op.grad2.x, op->op.grad2.y,
|
||||
op->op.grad2.w, op->op.grad2.h,
|
||||
op->op.grad2.grad);
|
||||
op->op.grad2.w, op->op.grad2.h);
|
||||
}
|
||||
|
||||
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)
|
||||
evas_common_pipe_grad2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pgr,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
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;
|
||||
|
@ -485,7 +490,7 @@ evas_common_pipe_grad2_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
|
|||
op->op.grad2.w = w;
|
||||
op->op.grad2.h = h;
|
||||
gr->references++;
|
||||
op->op.grad2.grad = gr;
|
||||
op->op.grad2.grad = ogr;
|
||||
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);
|
||||
|
@ -543,12 +548,18 @@ 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)
|
||||
{
|
||||
op->op.image.src->ref--;
|
||||
if (op->op.image.src->ref == 0)
|
||||
evas_cache_image_drop(&op->op.image.src->cache_entry);
|
||||
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);
|
||||
evas_common_pipe_op_free(op);
|
||||
}
|
||||
|
||||
|
@ -565,81 +576,35 @@ 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
|
||||
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);
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
evas_common_pipe_image_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, void *pim,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
RGBA_Pipe_Op *op;
|
||||
Evas_Object_Image *oim = pim;
|
||||
RGBA_Image *im;
|
||||
|
||||
if (!src) return;
|
||||
// evas_common_pipe_flush(src);
|
||||
if (!oim || !dst) return;
|
||||
im = oim->engine_data;
|
||||
if (!im) return;
|
||||
dst->pipe = evas_common_pipe_add(dst->pipe, &op);
|
||||
if (!dst->pipe) return;
|
||||
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.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_func = evas_common_pipe_image_draw_do;
|
||||
op->free_func = evas_common_pipe_op_image_free;
|
||||
evas_common_pipe_draw_context_copy(dc, op);
|
||||
|
|
|
@ -13,9 +13,11 @@ 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_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);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
#endif /* _EVAS_PIPE_H */
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
#include "evas_common.h"
|
||||
#include "evas_private.h"
|
||||
#include <math.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)
|
||||
{
|
||||
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...
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#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 */
|
|
@ -191,6 +191,10 @@ 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"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -350,6 +354,8 @@ 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
|
||||
|
@ -405,7 +411,7 @@ struct _RGBA_Pipe_Op
|
|||
int x, y, w, h;
|
||||
} grad;
|
||||
struct {
|
||||
RGBA_Gradient2 *grad;
|
||||
void *grad;
|
||||
int x, y, w, h;
|
||||
} grad2;
|
||||
struct {
|
||||
|
@ -414,10 +420,8 @@ struct _RGBA_Pipe_Op
|
|||
char *text;
|
||||
} text;
|
||||
struct {
|
||||
RGBA_Image *src;
|
||||
int sx, sy, sw, sh, dx, dy, dw, dh;
|
||||
int smooth;
|
||||
char *text;
|
||||
void *im;
|
||||
int x, y, w, h;
|
||||
} image;
|
||||
} op;
|
||||
};
|
||||
|
@ -565,16 +569,9 @@ 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;
|
||||
|
@ -592,13 +589,10 @@ 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)(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);
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -883,6 +877,7 @@ 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);
|
||||
|
|
|
@ -578,12 +578,9 @@ 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);
|
||||
|
@ -592,7 +589,6 @@ 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);
|
||||
|
@ -633,9 +629,10 @@ 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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
|
|
@ -385,17 +385,6 @@ 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)
|
||||
{
|
||||
|
@ -407,11 +396,6 @@ 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)
|
||||
{
|
||||
|
@ -450,11 +434,6 @@ 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)
|
||||
{
|
||||
|
@ -673,23 +652,6 @@ 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)
|
||||
{
|
||||
|
@ -990,6 +952,23 @@ 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)
|
||||
{
|
||||
|
@ -1004,6 +983,12 @@ 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)
|
||||
|
@ -1092,6 +1077,7 @@ 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);
|
||||
|
@ -1100,11 +1086,8 @@ 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);
|
||||
|
@ -1112,7 +1095,6 @@ 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);
|
||||
|
@ -1138,6 +1120,7 @@ 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);
|
||||
|
@ -1151,8 +1134,9 @@ module_open(Evas_Module *em)
|
|||
ORD(image_data_preload_cancel);
|
||||
ORD(image_alpha_set);
|
||||
ORD(image_alpha_get);
|
||||
ORD(image_border_set);
|
||||
ORD(image_border_get);
|
||||
ORD(image_is_opaque);
|
||||
ORD(image_render_pre);
|
||||
ORD(image_render_post);
|
||||
ORD(image_draw);
|
||||
ORD(image_comment_get);
|
||||
ORD(image_format_get);
|
||||
|
@ -1160,6 +1144,7 @@ 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);
|
||||
|
|
|
@ -193,6 +193,7 @@ 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)
|
||||
{
|
||||
|
@ -205,46 +206,22 @@ 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_gradient2_linear_new();
|
||||
return evas_common_rgba_gradient2_linear_new();
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_linear_free(void *data, void *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);
|
||||
evas_common_rgba_gradient2_free(linear_gradient);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gradient2_linear_is_opaque(void *data, void *context, void *linear_gradient, int x, int y, int w, int 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));
|
||||
return evas_common_gradient2_opaque(context, linear_gradient, x, y, w, h);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -259,14 +236,8 @@ 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)
|
||||
{
|
||||
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);
|
||||
if (!context || !linear_gradient) return;
|
||||
evas_common_gradient2_linear_render_pre(context, linear_gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -279,39 +250,28 @@ 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, x, y, w, h, linear_gradient);
|
||||
evas_common_pipe_grad2_draw(surface, context, linear_gradient, x, y, w, h);
|
||||
else
|
||||
#endif
|
||||
evas_common_gradient2_draw(surface, context, x, y, w, h, linear_gradient);
|
||||
evas_common_gradient2_draw(surface, context, linear_gradient, x, y, w, h);
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_gradient2_radial_new(void *data)
|
||||
{
|
||||
return evas_common_gradient2_radial_new();
|
||||
return evas_common_rgba_gradient2_radial_new();
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_radial_free(void *data, void *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);
|
||||
evas_common_rgba_gradient2_free(radial_gradient);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gradient2_radial_is_opaque(void *data, void *context, void *radial_gradient, int x, int y, int w, int 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));
|
||||
return evas_common_gradient2_opaque(context, radial_gradient, x, y, w, h);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -326,14 +286,8 @@ 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)
|
||||
{
|
||||
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);
|
||||
if (!context || !radial_gradient) return;
|
||||
evas_common_gradient2_radial_render_pre(context, radial_gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -346,12 +300,13 @@ 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, x, y, w, h, radial_gradient);
|
||||
evas_common_pipe_grad2_draw(surface, context, radial_gradient, x, y, w, h);
|
||||
else
|
||||
#endif
|
||||
evas_common_gradient2_draw(surface, context, x, y, w, h, radial_gradient);
|
||||
evas_common_gradient2_draw(surface, context, radial_gradient, x, y, w, h);
|
||||
}
|
||||
|
||||
/* old gradient engine funcs */
|
||||
static void *
|
||||
eng_gradient_new(void *data)
|
||||
{
|
||||
|
@ -488,106 +443,7 @@ eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* image engine funcs */
|
||||
static void *
|
||||
eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
|
||||
{
|
||||
|
@ -671,6 +527,9 @@ 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)
|
||||
{
|
||||
|
@ -731,34 +590,116 @@ eng_image_data_preload_cancel(void *data, void *image)
|
|||
evas_cache_image_preload_cancel(&im->cache_entry);
|
||||
}
|
||||
|
||||
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)
|
||||
static void *
|
||||
eng_image_alpha_set(void *data, void *image, int has_alpha)
|
||||
{
|
||||
RGBA_Image *im;
|
||||
|
||||
if (!image) return;
|
||||
if (!image) return NULL;
|
||||
im = image;
|
||||
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
|
||||
evas_cache_image_load_data(&im->cache_entry);
|
||||
evas_common_image_colorspace_normalize(im);
|
||||
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;
|
||||
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)
|
||||
{
|
||||
#ifdef BUILD_PTHREAD
|
||||
if (cpunum > 1)
|
||||
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);
|
||||
evas_common_pipe_image_draw(surface, context, image, x, y, w, h);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
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();
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -975,15 +916,13 @@ static Evas_Func func =
|
|||
eng_polygon_point_add,
|
||||
eng_polygon_points_clear,
|
||||
eng_polygon_draw,
|
||||
/* gradient draw funcs */
|
||||
|
||||
/* gradient2 engine 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,
|
||||
|
@ -992,13 +931,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,
|
||||
|
@ -1018,7 +957,8 @@ static Evas_Func func =
|
|||
eng_gradient_render_pre,
|
||||
eng_gradient_render_post,
|
||||
eng_gradient_draw,
|
||||
/* image draw funcs */
|
||||
|
||||
/* image emgine funcs */
|
||||
eng_image_load,
|
||||
eng_image_new_from_data,
|
||||
eng_image_new_from_copied_data,
|
||||
|
@ -1033,8 +973,9 @@ static Evas_Func func =
|
|||
eng_image_data_preload_cancel,
|
||||
eng_image_alpha_set,
|
||||
eng_image_alpha_get,
|
||||
eng_image_border_set,
|
||||
eng_image_border_get,
|
||||
eng_image_is_opaque,
|
||||
eng_image_render_pre,
|
||||
eng_image_render_post,
|
||||
eng_image_draw,
|
||||
eng_image_comment_get,
|
||||
eng_image_format_get,
|
||||
|
@ -1046,7 +987,8 @@ static Evas_Func func =
|
|||
eng_image_cache_flush,
|
||||
eng_image_cache_set,
|
||||
eng_image_cache_get,
|
||||
/* font draw functions */
|
||||
|
||||
/* font engine functions */
|
||||
eng_font_load,
|
||||
eng_font_memory_load,
|
||||
eng_font_add,
|
||||
|
|
|
@ -339,7 +339,6 @@ 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)
|
||||
{
|
||||
|
@ -350,17 +349,6 @@ 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)
|
||||
{
|
||||
|
@ -372,11 +360,6 @@ 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)
|
||||
{
|
||||
|
@ -415,11 +398,6 @@ 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)
|
||||
{
|
||||
|
@ -622,21 +600,6 @@ 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)
|
||||
{
|
||||
|
@ -923,6 +886,23 @@ 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)
|
||||
{
|
||||
|
@ -936,6 +916,12 @@ 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)
|
||||
|
@ -1022,11 +1008,8 @@ 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);
|
||||
|
@ -1034,7 +1017,6 @@ 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);
|
||||
|
@ -1060,6 +1042,7 @@ 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);
|
||||
|
@ -1073,8 +1056,9 @@ module_open(Evas_Module *em)
|
|||
ORD(image_data_preload_cancel);
|
||||
ORD(image_alpha_set);
|
||||
ORD(image_alpha_get);
|
||||
ORD(image_border_set);
|
||||
ORD(image_border_get);
|
||||
ORD(image_is_opaque);
|
||||
ORD(image_render_pre);
|
||||
ORD(image_render_post);
|
||||
ORD(image_draw);
|
||||
ORD(image_comment_get);
|
||||
ORD(image_format_get);
|
||||
|
@ -1085,6 +1069,7 @@ 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);
|
||||
|
|
Loading…
Reference in New Issue