I see drawing times of around 60ms for "KCF new FIPG .. .dxf" on my
machine. I could reduce the time a little by calling `(get-dc)` just
once and passing it through all the drawing functions, but it looks
like a lot of the remaining time is spent crossing into and out of the
drawing layer at `draw-line`, draw-arc`, etc., besides actually
plotting the pixels.

You might be able to get more significant improvement by accumulating
drawing commands into a `dc-path%`, and then using `draw-path`. That
strategy only works for parts to be drawn with the same pen, though.

Another common strategy is to render the drawing into a bitmap and copy
the bitmap the screen for panning but that may not be so easy to
implement with zooming.

At Mon, 22 Feb 2016 18:17:10 -0800 (PST), copycat wrote:
> My program shows slow rendering when i am dealing with hundreds of lines/arcs 
> to draw. Panning even when the canvas is zoomed in a particular point seems 
> to 
> be laggy. Using (time ..) to snoop around, it looks like draw-objects in 
> "canvas.rkt" is to blame. Is there a way i can fix this?
> 
> https://github.com/xtrntr/DXF-Converter
> 
> You run the program from "main-window.rkt", then drag dxf files in the DXF 
> folder into the fram and interact with the 2d drawing as follows:
> 
> ctrl drag to select elements
> esc to unselect elements
> click and drag to pan about
> scroll up and down to zoom in/out
> 
> "KCF new FIPG .. .dxf" in the folder DXF has ~1200 elements
> "1. DFX .. .dxf" in the same folder has ~500 elements
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to