From 04080048df55a91b0ce247539172c05ec5fc74a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 8 May 2009 20:20:21 +0000 Subject: [PATCH] Use a BShape do draw the chart lines: -> Significant speed up, since there is much less app_server communication. -> Much improved looks, since the line is now drawn as one connected line. The StrokeLine(BPoint to) version cannot do this. Hope I am not interfering, Ingo! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30676 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../debuganalyzer/gui/chart/LineChartRenderer.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp b/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp index ae49a81d41..2ad12a182b 100644 --- a/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp +++ b/src/apps/debuganalyzer/gui/chart/LineChartRenderer.cpp @@ -7,6 +7,7 @@ #include +#include #include #include "chart/ChartDataSource.h" @@ -189,19 +190,23 @@ LineChartRenderer::Render(BView* view, BRect updateRect) double scale = (double)fFrame.IntegerHeight() / sampleRange; // draw + view->SetLineMode(B_ROUND_CAP, B_ROUND_JOIN); for (int32 i = 0; DataSourceInfo* info = fDataSources.ItemAt(i); i++) { printf("LineChartRenderer::Render(): %p\n", info); - view->SetHighColor(info->config.Color()); float bottom = fFrame.bottom; - view->MovePenTo(left + first, - bottom - ((info->samples[first] - minRange) * scale)); + BShape shape; + shape.MoveTo(BPoint(left + first, + bottom - ((info->samples[first] - minRange) * scale))); for (int32 i = first; i <= last; i++) { - view->StrokeLine(BPoint(float(left + i), + shape.LineTo(BPoint(float(left + i), float(bottom - ((info->samples[i] - minRange) * scale)))); //printf(" %f: %f (%f)\n", info->samples[i] - minRange, float(bottom - ((info->samples[i] - minRange) * scale)), bottom); } + view->SetHighColor(info->config.Color()); + view->MovePenTo(B_ORIGIN); + view->StrokeShape(&shape); } }