I developed a market geometry drawing tool which draws many lines on the screen.. These lines could extend into the future and the end points of these
lines could have coordinates which where outside the chart resolution. Doing so however seems to crash ninja without any log/exception/..... but not always and not on all computers.
Perhaps its related to video card or driver since i could not get it to crash on some pcs.. but it did crashed constantly on others
Anyway i had to implement a cohen sutherland algorithm to make sure all my lines where clipped to the chart to fix the crashes
IMO ninja should not crash randomly when drawing stuff outside the screen, so this may be something to mention to the developers
My solution:
void DrawLine(ChartControl chartControl, ChartScale chartScale, Vector2 p1, Vector2 p2, Brush brush, float strokeWidth, StrokeStyle strokeStyle) { chartPanel = chartControl.ChartPanels[chartScale.PanelIndex]; viewport = new RectangleF(chartPanel.X, chartPanel.Y, chartPanel.W, chartPanel.H); points = ClipToviewPort(viewport, p1, p2); if (points != null) { RenderTarget.DrawLine(points.Item1, points.Item2, brush, strokeWidth, strokeStyle); } }
Comment