[cairo] patch for using XCopyArea when possible

Vladimir Vukicevic vladimirv at gmail.com
Fri Jul 15 21:16:06 PDT 2005

On 7/15/05, Jason Dorje Short <jdorje at users.sf.net> wrote:
> 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.

We're in the same boat with mozilla -- most of mozilla is just drawing
images, from all the UI elements down to the contents of pages itself.
 A lot of these use 1-bit alpha throughout for performance (or no
alpha at all), and so we're working on figuring out where and what we
can optimize while still having available the full general cairo
rendering model where we need it.

I'm not sure what the solution is for 1-bit images; I'm reading code
as we speak to come up with an option :)

    - Vlad

More information about the cairo mailing list