mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 07:38:22 +02:00
perf: Avoid vertically stretching the histogram
If we have more rows than the max_count in any column, we end up stretching the histogram vertically, which makes it harder to read. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
b9f0ef4496
commit
2c097e6e6b
1 changed files with 6 additions and 3 deletions
|
|
@ -156,10 +156,13 @@ void
|
|||
_cairo_histogram_printf (cairo_histogram_t *h,
|
||||
FILE *file)
|
||||
{
|
||||
int x, y;
|
||||
int x, y, num_rows;
|
||||
|
||||
for (y = 0; y < h->num_rows; y++) {
|
||||
int min_count = (h->num_rows - y - 1) * h->max_count / h->num_rows;
|
||||
num_rows = h->num_rows;
|
||||
if (h->max_count < num_rows)
|
||||
num_rows = h->max_count;
|
||||
for (y = 0; y < num_rows; y++) {
|
||||
int min_count = ((num_rows - y - 1) * h->max_count) / num_rows + h->max_count / (2*num_rows);
|
||||
fprintf (file, "|");
|
||||
for (x = 0; x < h->num_columns; x++)
|
||||
fprintf (file, "%c", h->columns[x] > min_count ? 'x' : ' ');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue