[cairo] Scatter plot optimization?

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 4 09:29:04 PST 2010


On Thu, 4 Mar 2010 08:41:14 -0800, Andrej Prsa <andrej.prsa at guest.arnes.si> wrote:
> I have a gtk drawing area to which I am drawing with cairo. The plot
> consists of axes, axis labels, and scattered data -- 10,000+ data
> points. Since I didn't find a good way how to do scatter plots with
> different symbols, I am drawing symbols with cairo primitives, i.e.

As you will have a small set of symbols, each repeated many times,
pre-render each symbol and blit as required. For better performance, aim
to make the blits pixel-aligned and make as few state changes as possible,
i.e. try to do all the red-crosses in one pass, then the green-circles,
etc...

If you do want sub-pixel precision, then pre-render each symbol in a small
number of sub-pixel poses and pick the most nearest from the cache for
each point.
-ickle

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list