2

I'm drawing some vector data, slightly under 9000 polygon objects, using FrameworkElement:DrawingVisual which in turn is a child of a Canvas object. My tree of objects would look something like this:

WPF Window
-Canvas
--FrameworkElement
---DrawingVisual -> DrawingContext.DrawGeometry

So far so good. I'm timing all the rendering methods and it is pretty much as expected, 0.32 seconds for the DrawingContext to do its stuff and 0.5 seconds total. With EdgeMode set to default (anti-aliased) the completed drawing appears on my canvas barely half a second later.

However, because I need all lines to be aliased I use RenderingOptions.SetEdgeMode to EdgeMode.Aliased on the canvas object.

After doing this there is no discernible difference in rendering time, 0.5 seconds total time. But - the completed drawing now takes over 4 seconds before it appears in my window. This compared to under 0.5 seconds for the anti-aliased version. The only difference is this single line of code:

 RenderOptions.SetEdgeMode(myCanvas, EdgeMode.Aliased);

If I resize the window same thing happens, it takes much longer for the aliased version to resize compared to the anti-aliased one. Obviously, in this case my drawing code isn't even invoked so the problem must lie elsewhere.

It seems that something external to my code is slowing things down drastically when in aliased rendering mode, quite opposite of what I would have expected. So what am I missing here?

rinzler
  • 21
  • 2
  • Ok, here's an additional kicker: Changing to software only rendering mode (RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly) improved drawing times dramatically. Now I'm totally confused. – rinzler Apr 10 '12 at 12:37
  • Sounds to me like a WPF or graphics driver related problem. If the result is reproducible between AMD/nVidia machines then it's a WPF bug and needs to be reported to Microsoft (connect.microsoft.com) - although don't expect a fix anytime soon... (you have roughly a <5% chance of getting a fix 'in the next version') – Marko Aug 29 '12 at 20:57
  • I'm observing the same behaviour using i5-2520M CPU @ 2.50GHz + Intel HD Graphics, Windows 7, .NET 4.5.1. High processor load the standard way; total breakdown with "RenderOptions.SetEdgeMode(MyCanvas, EdgeMode.Aliased)"; and then much lower load with "RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;" – Frank im Wald Jul 24 '14 at 13:51

0 Answers0