[Mesa-dev] [PATCH 2/5] gallium/hud: allow more data sources per pane
Marek Olšák
maraeo at gmail.com
Sun Jan 1 00:06:00 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/hud/hud_context.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 4c65af3..9e17d9b 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -806,37 +806,39 @@ strip_hyphens(char *s)
*/
void
hud_pane_add_graph(struct hud_pane *pane, struct hud_graph *gr)
{
static const float colors[][3] = {
{0, 1, 0},
{1, 0, 0},
{0, 1, 1},
{1, 0, 1},
{1, 1, 0},
- {0.5, 0.5, 1},
- {0.5, 0.5, 0.5},
+ {0.5, 1, 0.5},
+ {1, 0.5, 0.5},
+ {0.5, 1, 1},
+ {1, 0.5, 1},
+ {1, 1, 0.5},
+ {0, 0.5, 0},
+ {0.5, 0, 0},
+ {0, 0.5, 0.5},
+ {0.5, 0, 0.5},
+ {0.5, 0.5, 0},
};
- char *name = gr->name;
+ unsigned color = pane->num_graphs % ARRAY_SIZE(colors);
- /* replace '-' with a space */
- while (*name) {
- if (*name == '-')
- *name = ' ';
- name++;
- }
+ strip_hyphens(gr->name);
- assert(pane->num_graphs < ARRAY_SIZE(colors));
gr->vertices = MALLOC(pane->max_num_vertices * sizeof(float) * 2);
- gr->color[0] = colors[pane->num_graphs][0];
- gr->color[1] = colors[pane->num_graphs][1];
- gr->color[2] = colors[pane->num_graphs][2];
+ gr->color[0] = colors[color][0];
+ gr->color[1] = colors[color][1];
+ gr->color[2] = colors[color][2];
gr->pane = pane;
LIST_ADDTAIL(&gr->head, &pane->graph_list);
pane->num_graphs++;
}
void
hud_graph_add_value(struct hud_graph *gr, uint64_t value)
{
gr->current_value = value;
value = value > gr->pane->ceiling ? gr->pane->ceiling : value;
--
2.7.4
More information about the mesa-dev
mailing list