move spectrum redraw to an idler so it gets called at most once per render.

no more performance issue there... :)


SVN revision: 24671
This commit is contained in:
rephorm 2006-08-14 05:21:16 +00:00 committed by rephorm
parent d7792a9270
commit 4d0d5bb122
1 changed files with 19 additions and 5 deletions

View File

@ -14,8 +14,11 @@ struct _E_Spectrum
E_Color_Component mode;
E_Color *cv;
int draw_queued;
};
static int _e_spectrum_redraw(void *d);
static void
_e_spectrum_smart_add(Evas_Object *o)
{
@ -33,6 +36,8 @@ _e_spectrum_smart_add(Evas_Object *o)
evas_object_image_size_set(sp->o_spectrum, sp->iw, sp->ih);
evas_object_image_alpha_set(sp->o_spectrum, 1);
ecore_idler_add(_e_spectrum_redraw, sp);
evas_object_smart_member_add(sp->o_spectrum, o);
}
@ -243,16 +248,16 @@ _e_spectrum_2d_color_at(E_Spectrum *sp, int x, int y, int *r, int *g, int *b)
if (b) *b = bb;
}
void
_e_spectrum_update(E_Spectrum *sp)
static int
_e_spectrum_redraw(void *d)
{
E_Spectrum *sp = d;
int *data;
int i, j;
int r, g, b;
int *data;
float vx, vy, vz;
if (!sp || !sp->cv) return;
//printf("UPDATE SPECTRUM\n");
if (!sp->draw_queued) return 1;
data = evas_object_image_data_get(sp->o_spectrum, 1);
if (!data) return;
@ -292,8 +297,17 @@ _e_spectrum_update(E_Spectrum *sp)
evas_object_image_data_set(sp->o_spectrum, data);
evas_object_image_data_update_add(sp->o_spectrum, 0, 0, sp->iw, sp->ih);
sp->draw_queued = 0;
return 1;
}
static void
_e_spectrum_update(E_Spectrum *sp)
{
if (!sp || !sp->cv) return;
sp->draw_queued = 1;
}
Evas_Object *
e_spectrum_add(Evas *e)