Behdad Esfahbod behdad at behdad.org
Thu Feb 22 15:37:46 PST 2007

On Wed, 2007-02-21 at 17:10 -0800, Carl Worth wrote:
> On Wed, 21 Feb 2007 18:42:58 -0500, Behdad Esfahbod wrote:
> > I did a hack to support CAIRO_EXTEND_REFLECT for surface patterns.  It's
> > in my tree under the extend-reflect branch.  It's a hack, i.e., I didn't
> > fix pixman.  Instead, I do the reflection in cairo-pattern.c.
> It looks good to me. A real workaround like, (which is, making a 4
> copied-surface for anyone following along at home), is much better
> than our "throw an error" stance for 1.2, (what were we thinking?!).
> And sometime we'll actually fix pixman itself here...

Thanks Carl.  In fact this got me thinking: for PS/PDF/SVG this
workaround seems like the only way we can get reflect working without
falling back to fallback images.  So, I'm thinking about restructuring
bits around and properly fix it with this approach, instead of digging
into pixman.

I did some more work and pushed it in my extend-reflect3 branch.  new
stuff includes marking EXTEND_REFLECT supported in PS/PDF, so they don't
use fallback images.  This revealed a serious bug in PS that transformed
surface patterns were generating very wrong patterns.  Fixed that.  But
can't pass the test suite still (see commit logs).

While doing all this, I got some ideas to improve our PS/PDF/SVG output.
The problem is that we have little to no control over patterns there.
All we've got is repeating patterns, with not much filtering control
(not in PS at least).  So, for example, if we want to support the smooth
scaling up of images in PS, we can scale the image in cairo and embed
the scaled image.

Another idea is, if you check the current gs output for the
surface-pattern test you see that the PS rendering of the rotated
pattern has seams.  This is because PS allows rounding of xstep/ystep by
viewers.  It actually has 3 modes about how to round.  (and I think we
are using the wrong one).  So the idea is, embed images that have an
extra row+column on the side, to cover for the seams.  This can be done
for both repeat and reflect.

As for implementing EXTEND_PAD, it's not easy without falling back to
image, but not impossible.  For example, it can be implemented using a
non-repeat pattern plus 8 repeat ones of the edges and corners...  Not
sure if we want to go that route.

Anyway, my extend-reflect3 branch is pretty much what I want to push.  I
think I need to copy the xstep/ystep code from PDF to PS, but when I
did, it didn't work right, so I'll look into that later.  And I've got
to find a fix for the failing test.  Don't want to make it XFAIL.

> > Anyway, review please.  I'll be committing to master soon to have it
> > fixed for 1.4.
> I've reviewed the series, (review by reading---I haven't run it at
> all), and it looks good to me. The only (very minor) comment I had is
> that in cairo-svg-surface.c:emit_composite_image_pattern:
> 	-    cairo_image_surface_t *image;
> 	+    cairo_surface_t *image;
> It would seem cleaner to name that "surface" not "image", but it's
> really not any big deal.

Oops.  Forgot to fix it.  I'll try to do some git magic to amend it,
otherwise will do a new commit.

> Thanks, Behdad, for this fix (and several recent other fixes).

You're totally welcome.  Lets see if people pester you enough to get
1.4.0 out while at FODEM.

> The 1.4.0 release is really close now...

Yep.  Lets push this, and Vlad's user-data patch.  Remains:

  - Dave's and David's gradient patches that you should push.

  - Workaround the X server performance bug of allocating a mask to fit
    the entire bounds of trapezoids, (rather than respecting the
    bounds/clip of the destination surface).  How is this looking?
    What is the exact problem, any pointers?

  - Fix the unhinted glyph advance widths that Damon recently brought
    up.  I'll look into that tomorrow.

Wow, getting *really* there.

> -Carl


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list