From e903011c4457c24c0095f270ca5e78c40729434f Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Tue, 15 May 2007 02:13:11 +0200 Subject: Use tables and css to create the diffstat graph, fix scaling There was no need to use image-files for the graphs, so lets drop them. At the same time, fix scaling of the graphs so that the full width is used only if atleast 100 LOC are changed in one of the files. Signed-off-by: Lars Hjemli --- ui-commit.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index b6a106f..8011dfc 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -29,7 +29,6 @@ void print_fileinfo(struct fileinfo *info) { char *query, *query2; char *class; - double width; switch (info->status) { case DIFF_STATUS_ADDED: @@ -96,18 +95,15 @@ void print_fileinfo(struct fileinfo *info) } html(""); htmlf("%d", info->added + info->removed); - html(""); - width = (info->added + info->removed) * 100.0 / max_changes; - if (width < 0.1) - width = 0.1; - html_link_open(cgit_pageurl(cgit_query_repo, "diff", query), - NULL, NULL); - htmlf("", - info->added * width / (info->added + info->removed)); - htmlf("", - info->removed * width / (info->added + info->removed)); - html("\n"); + htmlf("", (max_changes > 100 ? 100 : max_changes)); + htmlf("
", + info->added * 100.0 / max_changes); + htmlf("", + info->removed * 100.0 / max_changes); + htmlf("", + (max_changes - info->removed - info->added) * 100.0 / max_changes); + html("
\n"); } void cgit_count_diff_lines(char *line, int len) -- cgit v1.2.3-59-g8ed1b