[cairo] recursive quad-tree, or bounding box of changed area during drawing?

Federico Mena Quintero federico at ximian.com
Thu Jun 1 12:51:25 PDT 2006


On Thu, 2006-06-01 at 21:35 +0200, Leon Woestenberg wrote:
> It is very interesting to read about canvas (retained mode) 
> optimizations, but I am using cairo (direct mode) where I have no notion 
> of paint objects. I start painting, stop painting, and want to know if I 
> can get a cheap bounded box (or a recursive variant thereof) of the 
> region being dirtied in the paint process.

Oh, I always assumed you were writing something like a canvas.

So do you want something like this?

  surf = cairo_image_surface_new (big_enough_for_the_screen);
  paint_everything (surf);
  bbox = bounding_box_for_pixels_that_were_painted (surf);
  bit_blt (surf, bbox, screen); <- you want to minimize this

Blitting is not going to be your main performance problem, unless your
blitter is absolutely horrible.  You need to do profiling on the whole
pipeline.

  Federico



More information about the cairo mailing list