This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit 55522a8ad8f0293040d5748a65e4b607c67e40c4
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Thu Nov 7 14:37:46 2024 +0000
efm graph - make graphs more efficient on changes
if colorspec same - ignore it.
if count of values same then dont fre and realloc values and dont
delete and re-create bar objects
if colorspace didnt change then dont send colorspace messages if just
values changed for bars
---
src/efm/efm_graph.c | 28 ++++++++++++++++++++--------
src/efm/efm_graph.h | 6 ++++++
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/src/efm/efm_graph.c b/src/efm/efm_graph.c
index 9afc2d2..0efdf78 100644
--- a/src/efm/efm_graph.c
+++ b/src/efm/efm_graph.c
@@ -18,6 +18,7 @@ struct _Smart_Data
Evas_Object **o_vals;
Eina_Bool reset_vals : 1;
+ Eina_Bool reset_colors : 1;
};
static Evas_Smart *_smart = NULL;
@@ -159,14 +160,14 @@ _smart_calculate(Evas_Object *obj)
}
}
}
- if ((sd->o_vals) && (sd->reset_vals))
+ if ((sd->o_vals) && ((sd->reset_vals) || (sd->reset_colors)))
{
range = sd->max - sd->min;
if (range <= 1.0) range = 1.0;
for (i = 0; i < sd->num; i++)
{
v = 1.0 - ((double)(sd->vals[i] - sd->min) / range);
- if (sd->colorspec)
+ if ((sd->colorspec) && (sd->reset_colors))
{
msg.str = (char *)sd->colorspec;
edje_object_message_send(sd->o_vals[i], EDJE_MESSAGE_STRING, 1,
@@ -178,6 +179,7 @@ _smart_calculate(Evas_Object *obj)
}
}
sd->reset_vals = EINA_FALSE;
+ sd->reset_colors = EINA_FALSE;
}
Evas_Object *
@@ -204,14 +206,21 @@ efm_graph_values_set(Evas_Object *obj, int num, int *vals, int min, int max)
{ // set set of values
ENTRY;
- _clear(sd);
- sd->vals = malloc(num * sizeof(int));
- if (!sd->vals) return;
- sd->num = num;
+ if (sd->num != num)
+ {
+ _clear(sd);
+ sd->reset_colors = EINA_TRUE;
+ sd->num = num;
+ if (sd->num > 0)
+ {
+ sd->vals = malloc(num * sizeof(int));
+ if (!sd->vals) return;
+ }
+ }
+ sd->reset_vals = EINA_TRUE;
sd->min = min;
sd->max = max;
- sd->reset_vals = EINA_TRUE;
- memcpy(sd->vals, vals, num * sizeof(int));
+ if (sd->num > 0) memcpy(sd->vals, vals, num * sizeof(int));
evas_object_smart_changed(sd->o_smart);
}
@@ -220,6 +229,9 @@ efm_graph_colorspec_set(Evas_Object *obj, const char *cc)
{
ENTRY;
+ if ((!cc) && (!sd->colorspec)) return;
+ if ((cc) && (sd->colorspec) && (!strcmp(cc, sd->colorspec))) return;
eina_stringshare_replace(&sd->colorspec, cc);
_clear(sd);
+ sd->reset_colors = EINA_TRUE;
}
diff --git a/src/efm/efm_graph.h b/src/efm/efm_graph.h
index 7d47b9c..03fae37 100644
--- a/src/efm/efm_graph.h
+++ b/src/efm/efm_graph.h
@@ -6,6 +6,12 @@
Evas_Object *efm_graph_add(Evas_Object *parent);
void efm_graph_values_set(Evas_Object *obj, int num, int *vals, int min,
int max);
+// cc:
+// cc:name_of_color_class - use this named colorclass
+// #f80 - 12bit rgb val
+// #f804 - 16bit rgba val
+// #ff8800 - 24bit rgb val
+// #ff880044 - 32bit rgba val
void efm_graph_colorspec_set(Evas_Object *obj, const char *cc);
#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.