summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <mail@alastairpoole.com>2021-11-03 17:43:39 +0000
committerAlastair Poole <mail@alastairpoole.com>2021-11-03 17:43:39 +0000
commit6f773784b2b80b565e0c780a18cf67a5b99c4a71 (patch)
treec468487ea526e43f275946979c009d2ace0e13e6
parent10abee7ae0ee0cbcf596e40ad3330a2e6b9bb85a (diff)
cpu_basic: best cube
-rw-r--r--src/bin/ui/visuals/cpu_basic.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bin/ui/visuals/cpu_basic.c b/src/bin/ui/visuals/cpu_basic.c
index 9a31de5..ce1b510 100644
--- a/src/bin/ui/visuals/cpu_basic.c
+++ b/src/bin/ui/visuals/cpu_basic.c
@@ -70,6 +70,15 @@ _cb_free(void *data)
70 free(ext); 70 free(ext);
71} 71}
72 72
73static int
74_row_fit(int n)
75{
76 double i, f, value = sqrt(n);
77 f = modf(value, &i);
78 if (EINA_DBL_EQ(f, 0.0)) return value;
79 return value + 1;
80}
81
73Ui_Cpu_Data * 82Ui_Cpu_Data *
74cpu_visual_basic(Evas_Object *parent_bx) 83cpu_visual_basic(Evas_Object *parent_bx)
75{ 84{
@@ -95,8 +104,8 @@ cpu_visual_basic(Evas_Object *parent_bx)
95 evas_object_size_hint_align_set(tb, 0.5, 0.5); 104 evas_object_size_hint_align_set(tb, 0.5, 0.5);
96 evas_object_show(tb); 105 evas_object_show(tb);
97 106
98 int row = 0, col = 0; 107 int row = 0, col = 0, w = _row_fit(ext->cpu_count);
99 int w = sqrt(ext->cpu_count); 108
100 for (int i = 0; i < ext->cpu_count; i++) 109 for (int i = 0; i < ext->cpu_count; i++)
101 { 110 {
102 if (!(i % w)) 111 if (!(i % w))