title: Windows Store App - SwapChainPanel DrawLine Performance
body: <p>I am developing a Windows Store App using XAML / C#. The app also has a Windows Runtime Component, which is used for showing a Chart ouput using DirectX. </p>
  
  <p>I am using SwapChainPanel approach for drawing the lines (x-axis, y-axis and waveform).</p>
  
  <p>I chose this approach from the below MSDN sample (refer scenario 3 - D2DPanel)
  <a href="http://code.msdn.microsoft.com/windowsapps/XAML-SwapChainPanel-00cb688b" rel="nofollow">http://code.msdn.microsoft.com/windowsapps/XAML-SwapChainPanel-00cb688b</a></p>
  
  <p>Here is my question,
  My waveform contains a huge number of data (ranging from 1,000 to 20,000 set of points). I am calling DrawLine continuously for all these points during each <strong>Render</strong> function call.</p>
  
  <p>The control also provides panning and zooming but keeps the StrokeWidth constant irrespective of zoom level, hence the visible area (render target) might be much less than the lines I am drawing.</p>
  
  <p><strong>Does calling DrawLine for the area which are going to be off-screen cause performance issues?</strong></p>
  
  <p>I tried PathGeometry &amp; GeometryRealization but I am not able to control the StrokeWidth at various zoom level.</p>
  
  <p>My Render method typically resembles the below snippet. The lineThickness is controlled to be same irrespective of zoom level.</p>
  
  <pre><code>m_d2dContext-&gt;SetTransform(m_worldMatrix);
  
  float lineThickness = 2.0f / m_zoom;
  
  for (unsigned int i = 0; i &lt; points-&gt;Size; i += 2)
  {
      double wavex1 = points-&gt;GetAt(i);
      double wavey1 = points-&gt;GetAt(i + 1);
  
      if (i != 0)
      {
          m_d2dContext-&gt;DrawLine(Point2F(prevX, prevY), Point2F(wavex1, wavey1), brush, lineThickness);
      }
  
      prevX = wavex1;
      prevY = wavey1;
  }
  </code></pre>
  
  <p>I'm kind of new to DirectX, but not to C++. Any thoughts?</p>