diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2024-10-19 16:29:46 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2024-10-19 16:29:46 -0700 |
commit | b3370e89a98e39dbf2928839c75fb20a108a5817 (patch) | |
tree | 17587a5d92faf5c1f675223df2e8c42b5ed650c8 | |
parent | 556368154db41283f9a26b1a5197916a6cc4fadb (diff) |
vcr: pass vwm_charts_t.marker_distance ref to vcr_new()
Since vcr_t implements rendering of borders and backgrounds, to
such an extent that when serializing mem->png for headless mode
it produces the background and border on the fly on a per-row
basis, let's just give it the ability to access the marker
distance in vwm_charts_t and draw the markers as needed.
It feels hacky to be passing pointers to these values but I
really despise repeating setters across abstractions to plumb
things through, so I'm doing the stupid simple thing here.
-rw-r--r-- | src/charts.c | 2 | ||||
-rw-r--r-- | src/vcr.c | 4 | ||||
-rw-r--r-- | src/vcr.h | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/charts.c b/src/charts.c index 9d31603..29547f7 100644 --- a/src/charts.c +++ b/src/charts.c @@ -1171,7 +1171,7 @@ vwm_chart_t * vwm_chart_create(vwm_charts_t *charts, int pid, int width, int hei chart->hierarchy_end = CHART_NUM_FIXED_HEADER_ROWS + count_rows(chart->proc); chart->gen_last_composed = -1; - chart->vcr = vcr_new(charts->vcr_backend, &chart->hierarchy_end, &chart->snowflakes_cnt); + chart->vcr = vcr_new(charts->vcr_backend, &chart->hierarchy_end, &chart->snowflakes_cnt, &charts->marker_distance); if (!vwm_chart_set_visible_size(charts, chart, width, height)) { VWM_ERROR("Unable to set initial chart size"); @@ -131,6 +131,7 @@ typedef struct vcr_t { */ int *hierarchy_end_ptr; /* pointer to row where the process hierarchy currently ends */ int *snowflakes_cnt_ptr; /* pointer to count of snowflaked rows (reset to zero to truncate snowflakes display) */ + const unsigned *marker_distance_ptr; /* pointer to marker distance to use (0 disables markers, this is kind of silly but I don't want to add setters everywhere so sharing the instance in vwm_charts_t) */ union { #ifdef USE_XLIB @@ -697,7 +698,7 @@ vcr_dest_t * vcr_dest_free(vcr_dest_t *dest) * uses where the priority is more lower frequency (1HZ) and more history (larger dimensions) with periodic * PNG presents on the order of minutes/hours for cloud uploading to facilitate investigations. */ -vcr_t * vcr_new(vcr_backend_t *vbe, int *hierarchy_end_ptr, int *snowflakes_cnt_ptr) +vcr_t * vcr_new(vcr_backend_t *vbe, int *hierarchy_end_ptr, int *snowflakes_cnt_ptr, const unsigned *marker_distance_ptr) { vcr_t *vcr; @@ -712,6 +713,7 @@ vcr_t * vcr_new(vcr_backend_t *vbe, int *hierarchy_end_ptr, int *snowflakes_cnt_ vcr->backend = vbe; vcr->hierarchy_end_ptr = hierarchy_end_ptr; vcr->snowflakes_cnt_ptr = snowflakes_cnt_ptr; + vcr->marker_distance_ptr = marker_distance_ptr; return vcr; } @@ -63,7 +63,7 @@ vcr_dest_t * vcr_dest_png_new(vcr_backend_t *vbe, FILE *output); #endif /* USE_PNG */ vcr_dest_t * vcr_dest_free(vcr_dest_t *dest); -vcr_t * vcr_new(vcr_backend_t *vbe, int *hierarchy_end_ptr, int *snowflakes_cnt_ptr); +vcr_t * vcr_new(vcr_backend_t *vbe, int *hierarchy_end_ptr, int *snowflakes_cnt_ptr, const unsigned *marker_distance_ptr); vcr_t * vcr_free(vcr_t *vcr); int vcr_resize_visible(vcr_t *vcr, int width, int height); void vcr_draw_text(vcr_t *vcr, vcr_layer_t layer, int x, int row, const vcr_str_t *strs, int n_strs, int *res_width); |