cpu: smoothness

This commit is contained in:
Alastair Poole 2020-06-25 00:36:11 +01:00
parent 7a0e476fda
commit d798bce95b
2 changed files with 13 additions and 38 deletions

View File

@ -1202,7 +1202,7 @@ static Evas_Object *
_ui_tabs_add(Evas_Object *parent, Ui *ui) _ui_tabs_add(Evas_Object *parent, Ui *ui)
{ {
Evas_Object *table, *box, *entry, *hbox, *frame, *btn; Evas_Object *table, *box, *entry, *hbox, *frame, *btn;
Evas_Object *border, *tb; Evas_Object *border;
ui->content = table = elm_table_add(parent); ui->content = table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EXPAND, EXPAND); evas_object_size_hint_weight_set(table, EXPAND, EXPAND);
@ -1328,14 +1328,6 @@ _ui_tabs_add(Evas_Object *parent, Ui *ui)
elm_entry_editable_set(entry, EINA_TRUE); elm_entry_editable_set(entry, EINA_TRUE);
evas_object_show(entry); evas_object_show(entry);
tb = elm_entry_textblock_get(entry);
if (tb)
{
int font_size = evisum_ui_textblock_font_size_get(tb);
if (font_size)
evisum_ui_textblock_font_size_set(tb, font_size + 2);
}
elm_object_content_set(border, entry); elm_object_content_set(border, entry);
elm_box_pack_end(box, border); elm_box_pack_end(box, border);

View File

@ -12,6 +12,7 @@ typedef struct {
Eina_Bool enabled; Eina_Bool enabled;
int pos; int pos;
int cpu_id; int cpu_id;
int counter;
double value; double value;
double step; double step;
} Animation; } Animation;
@ -24,32 +25,7 @@ typedef struct {
static void static void
anim_reset(Animation *anim) anim_reset(Animation *anim)
{ {
uint32_t *pixels; anim->counter = anim->pos = anim->step = 0;
Evas_Object *o;
Evas_Coord x, y, w, h;
if (!anim) return;
anim->pos = anim->step = 0;
if (!anim->enabled) return;
evas_object_geometry_get(anim->bg, NULL, NULL, &w, &h);
if (w <= 0 || h <= 0) return;
o = anim->obj;
pixels = evas_object_image_data_get(o, EINA_TRUE);
if (!pixels) return;
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
{
*(pixels++) = COLOR_BG;
}
}
evas_object_image_data_update_add(o, 0, 0, w, h);
} }
static Eina_Bool static Eina_Bool
@ -67,6 +43,7 @@ animator(void *data)
bg = anim->bg; line = anim->line; obj = anim->obj; bg = anim->bg; line = anim->line; obj = anim->obj;
evas_object_geometry_get(bg, &x, &y, &w, &h); evas_object_geometry_get(bg, &x, &y, &w, &h);
evas_object_color_set(bg, 255, 255, 255, 255);
evas_object_move(line, x + w - anim->pos, y); evas_object_move(line, x + w - anim->pos, y);
evas_object_resize(line, 1, h); evas_object_resize(line, 1, h);
if (anim->enabled) if (anim->enabled)
@ -86,6 +63,12 @@ animator(void *data)
{ {
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
{ {
if (!anim->counter)
{
*(pixels++) = COLOR_BG;
continue;
}
if ((x == (w - anim->pos)) && (y >= fill_y)) if ((x == (w - anim->pos)) && (y >= fill_y))
{ {
if (y % 2) if (y % 2)
@ -93,16 +76,16 @@ animator(void *data)
else else
*(pixels) = COLOR_BG; *(pixels) = COLOR_BG;
} }
else if (x <= (w - anim->pos)) else if (x == (w - anim->pos))
*(pixels) = COLOR_BG; *(pixels) = COLOR_BG;
pixels++; pixels++;
} }
} }
// XXX FPS anim->step += (double) (w * ecore_animator_frametime_get()) / 60.0;
anim->step += (double) w / (60 * 60);
anim->pos = anim->step; anim->pos = anim->step;
anim->counter++;
if (anim->pos >= w) if (anim->pos >= w)
{ {