forked from enlightenment/efl
ector software: catch up losing tasks among the threads.
This is a subsequent change after 8465904c19
.
The major change is almost same but just for gradient stuff.
This commit is contained in:
parent
e2887ec2aa
commit
11a1fc9f2b
|
@ -8,19 +8,19 @@
|
|||
|
||||
#include "ector_private.h"
|
||||
#include "ector_software_private.h"
|
||||
#include "ector_software_gradient.h"
|
||||
|
||||
static Eina_Bool
|
||||
_ector_renderer_software_gradient_linear_ector_renderer_prepare(Eo *obj,
|
||||
Ector_Renderer_Software_Gradient_Data *pd)
|
||||
{
|
||||
pd->ctable_status = CTABLE_NOT_READY;
|
||||
|
||||
if (!pd->surface)
|
||||
{
|
||||
Ector_Renderer_Data *base;
|
||||
|
||||
base = efl_data_scope_get(obj, ECTOR_RENDERER_CLASS);
|
||||
Ector_Renderer_Data *base = efl_data_scope_get(obj, ECTOR_RENDERER_CLASS);
|
||||
pd->surface = efl_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
|
||||
}
|
||||
|
||||
ector_software_gradient_color_update(pd);
|
||||
|
||||
pd->linear.x1 = pd->gld->start.x;
|
||||
|
@ -55,23 +55,24 @@ _ector_renderer_software_gradient_linear_ector_renderer_draw(Eo *obj EINA_UNUSED
|
|||
|
||||
static Eina_Bool
|
||||
_ector_renderer_software_gradient_linear_ector_renderer_software_op_fill(Eo *obj EINA_UNUSED,
|
||||
Ector_Renderer_Software_Gradient_Data *pd)
|
||||
Ector_Renderer_Software_Gradient_Data *pd)
|
||||
{
|
||||
ector_software_rasterizer_linear_gradient_set(pd->surface->rasterizer, pd);
|
||||
ector_software_gradient_color_update(pd);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eo *
|
||||
_ector_renderer_software_gradient_linear_efl_object_constructor(Eo *obj,
|
||||
Ector_Renderer_Software_Gradient_Data *pd)
|
||||
Ector_Renderer_Software_Gradient_Data *pd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS));
|
||||
if (!obj) return NULL;
|
||||
|
||||
pd->gd = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_MIXIN, obj);
|
||||
pd->gld = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_LINEAR_MIXIN, obj);
|
||||
pd->done = EINA_TRUE;
|
||||
pd->ctable_status = CTABLE_NOT_READY;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
@ -94,11 +95,10 @@ _ector_renderer_software_gradient_linear_efl_object_destructor(Eo *obj,
|
|||
}
|
||||
|
||||
void
|
||||
_ector_renderer_software_gradient_linear_efl_gfx_gradient_stop_set(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd, const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
|
||||
_ector_renderer_software_gradient_linear_efl_gfx_gradient_stop_set(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED,
|
||||
const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
|
||||
{
|
||||
efl_gfx_gradient_stop_set(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS), colors, length);
|
||||
|
||||
destroy_color_table(pd);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
|
|
|
@ -8,15 +8,16 @@
|
|||
|
||||
#include "ector_private.h"
|
||||
#include "ector_software_private.h"
|
||||
#include "ector_software_gradient.h"
|
||||
|
||||
static Eina_Bool
|
||||
_ector_renderer_software_gradient_radial_ector_renderer_prepare(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd)
|
||||
{
|
||||
pd->ctable_status = CTABLE_NOT_READY;
|
||||
|
||||
if (!pd->surface)
|
||||
{
|
||||
Ector_Renderer_Data *base;
|
||||
|
||||
base = efl_data_scope_get(obj, ECTOR_RENDERER_CLASS);
|
||||
Ector_Renderer_Data *base = efl_data_scope_get(obj, ECTOR_RENDERER_CLASS);
|
||||
pd->surface = efl_data_xref(base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
|
||||
}
|
||||
|
||||
|
@ -70,17 +71,18 @@ _ector_renderer_software_gradient_radial_ector_renderer_software_op_fill(Eo *obj
|
|||
{
|
||||
ector_software_rasterizer_radial_gradient_set(pd->surface->rasterizer, pd);
|
||||
ector_software_gradient_color_update(pd);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
Eo *
|
||||
_ector_renderer_software_gradient_radial_efl_object_constructor(Eo *obj,
|
||||
Ector_Renderer_Software_Gradient_Data *pd)
|
||||
Ector_Renderer_Software_Gradient_Data *pd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS));
|
||||
pd->gd = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_MIXIN, obj);
|
||||
pd->gld = efl_data_xref(obj, ECTOR_RENDERER_GRADIENT_RADIAL_MIXIN, obj);
|
||||
pd->done = EINA_TRUE;
|
||||
pd->ctable_status = CTABLE_NOT_READY;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
@ -103,11 +105,10 @@ _ector_renderer_software_gradient_radial_efl_object_destructor(Eo *obj,
|
|||
}
|
||||
|
||||
void
|
||||
_ector_renderer_software_gradient_radial_efl_gfx_gradient_stop_set(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd, const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
|
||||
_ector_renderer_software_gradient_radial_efl_gfx_gradient_stop_set(Eo *obj, Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED,
|
||||
const Efl_Gfx_Gradient_Stop *colors, unsigned int length)
|
||||
{
|
||||
efl_gfx_gradient_stop_set(efl_super(obj, ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS), colors, length);
|
||||
|
||||
destroy_color_table(pd);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
|
|
|
@ -11,7 +11,6 @@ void _linear_helper_sse3(uint32_t *buffer, int length, Ector_Renderer_Software_G
|
|||
|
||||
typedef void (*Ector_Radial_Helper_Func)(uint32_t *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data,
|
||||
float det, float delta_det, float delta_delta_det, float b, float delta_b);
|
||||
|
||||
typedef void (*Ector_Linear_Helper_Func)(uint32_t *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data,
|
||||
int t_fixed, int inc_fixed);
|
||||
|
||||
|
@ -22,8 +21,6 @@ static void
|
|||
_update_color_table(void *data, Ector_Software_Thread *t EINA_UNUSED)
|
||||
{
|
||||
Ector_Renderer_Software_Gradient_Data *gdata = data;
|
||||
|
||||
gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4);
|
||||
gdata->alpha = efl_draw_generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count,
|
||||
gdata->color_table, GRADIENT_STOPTABLE_SIZE);
|
||||
}
|
||||
|
@ -32,24 +29,27 @@ static void
|
|||
_done_color_table(void *data)
|
||||
{
|
||||
Ector_Renderer_Software_Gradient_Data *gdata = data;
|
||||
|
||||
gdata->done = EINA_TRUE;
|
||||
gdata->ctable_status = CTABLE_READY_DONE;
|
||||
}
|
||||
|
||||
void
|
||||
ector_software_gradient_color_update(Ector_Renderer_Software_Gradient_Data *gdata)
|
||||
{
|
||||
if (!gdata->done)
|
||||
{
|
||||
ector_software_wait(_update_color_table, _done_color_table, gdata);
|
||||
return ;
|
||||
}
|
||||
if (gdata->ctable_status == CTABLE_READY_DONE) return;
|
||||
|
||||
//OPTIMIZE: This color can be updated only when gradient properties are changed.
|
||||
|
||||
//Alloc only one time.
|
||||
if (!gdata->color_table)
|
||||
gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4);
|
||||
|
||||
if (gdata->ctable_status == CTABLE_NOT_READY)
|
||||
{
|
||||
gdata->done = EINA_FALSE;
|
||||
gdata->ctable_status = CTABLE_PROCESSING;
|
||||
ector_software_schedule(_update_color_table, _done_color_table, gdata);
|
||||
}
|
||||
else if (gdata->ctable_status == CTABLE_PROCESSING)
|
||||
ector_software_wait(_update_color_table, _done_color_table, gdata);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
#define FIXPT_BITS 8
|
||||
#define FIXPT_SIZE (1<<FIXPT_BITS)
|
||||
|
||||
#define CTABLE_NOT_READY 0
|
||||
#define CTABLE_PROCESSING 1
|
||||
#define CTABLE_READY_DONE 2
|
||||
|
||||
static inline int
|
||||
_gradient_clamp(const Ector_Renderer_Software_Gradient_Data *data, int ipos)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef struct _Ector_Renderer_Software_Gradient_Data
|
|||
uint32_t* color_table;
|
||||
|
||||
Eina_Bool alpha;
|
||||
Eina_Bool done;
|
||||
int ctable_status; //Ready for color table?
|
||||
} Ector_Renderer_Software_Gradient_Data;
|
||||
|
||||
typedef struct _Shape_Rle_Data
|
||||
|
|
Loading…
Reference in New Issue