[cairo] patch for using XCopyArea when possible

Jason Dorje Short jdorje at users.sf.net
Fri Jul 15 20:20:46 PDT 2005


Owen Taylor wrote:
> Patch looks good to me.
> 
> On Fri, 2005-07-15 at 13:12 -0700, Vladimir Vukicevic wrote:
> 
>>   Add a workaround for Render's overlapping source/dest bug
>>-       Use XCopyArea when possible (integer translation)
>>+?      Use XCopyArea when possible (integer translation)
>>        Otherwise make a copy of the source
> 
> 
> I think you can add a [done] here rather than the ?

What about the case of a 1-bit mask?  I have code like

  struct sprite {
    Pixmap pixmap, mask;
    bool has_mask;
  };

  if (sprite->has_mask) {
    XSetClipOrigin(display, gc, canvas_x, canvas_y);
    XSetClipMask(display, gc, sprite->mask);
  }

  XCopyArea(display, sprite->pixmap, pixmap,
	    gc,
	    0, 0, sprite->width, sprite->height,
	    canvas_x, canvas_y);

  if (sprite->has_mask) {
    XSetClipMask(display, gc, None);
  }

last I checked on my xserver this was MUCH slower to do through cairo
because it uses render; this basically means I can't use cairo here.
Surely this optimization should be done inside render too, but if I have
to wait for that it will be years before I can rely on the user having
an optimized xrender.

-jason



More information about the cairo mailing list