We are building a CAD app that runs in a browser.
- C.A.D stands for Computer Aided Design.
- Illustrator, CorelDraw, AutoCAD etc are some examples of CAD apps.
It's based on Paper.js, a very neat Canvas library that allows you to manipulate vectors programmatically.
The problem
The major issue I am having at the moment is redraw cycle performance.
The redraw algorithm is 'dumb' (in terms of clever hacks to improve performance) and thus inefficient and slow - Rendering the Scene Graph items is dependent on a progressively slower redraw-cycle.
As points-to-draw accumulate, each redraw cycle becomes slower and slower.
The redraw scheme is as simple as it gets:
- clear the whole area
- take all Items from the Scene Graph
- redraw all Items.
The question
Are there any classroom examples of rendering optimizations in such cases - assuming I'd like to stop short of implementing a dirty-rectangles algorithm (drawing only areas that have changed)
Edit: I've experimented with manual on-the-spot rasterisation which works pretty good, I've posted an answer below.