p0.X = x + trisize ;
p0.Y = (float)(ChartPanel.H) - trisize ;
p1.X = x - trisize;
p1.Y = (float)(ChartPanel.H) - trisize ;
p2.X = x;
p2.Y = (float)(ChartPanel.H);
vectors[0] = p1.ToVector2();
vectors[1] = p2.ToVector2();
SharpDX.Direct2D1.PathGeometry geo1 = new SharpDX.Direct2D1.PathGeometry(Core.Globals.D2DFac tory);
SharpDX.Direct2D1.GeometrySink sink1 = geo1.Open();
sink1.BeginFigure(p0.ToVector2(), SharpDX.Direct2D1.FigureBegin.Filled); // move to p0
sink1.AddLines(vectors); // line to p1,p2,p3
sink1.EndFigure(SharpDX.Direct2D1.FigureEnd.Closed ); // close polygon
sink1.Close();
RenderTarget.DrawGeometry(geo1, Brushes.Lime.ToDxBrush(RenderTarget));
RenderTarget.FillGeometry(geo1, Brushes.Lime.ToDxBrush(RenderTarget));
geo1.Dispose();
sink1.Dispose();
my question is do I need to dispose as listed, or is there a way I can safely create the geo and sink 1 time before the loop, re-assign some way in the loop, and then dispose only 1 time after the loop?
It just seems highly inefficient to create and dispose so much.
The basic idea of this indi is to draw a triangle on the bottom of the chart directly under each bar. There is more logic to my code that changes color and direction. I left it out to keep my example easy to read.
My code is working just fine, but this just seems like it could bog down the CPU during busy times given my indi processes each tick.

Comment