[gs-devel] Understanding clamp_pattern_bbox()

Kevin Shanahan kmshanah at disenchant.net
Sun Apr 29 20:20:25 PDT 2007


Hi,

I'm trying to solve the issue described in bug#688991 and I beleive
I'm getting close to the source, but I'm having a bit of difficulty
understanding the code.

So far I've tracked down that a _huge_ buffer (>2GB) is required to
render a particular "pattern" in this document. I also found that this
kind of issue has come up before and that clamp_pattern_bbox was
supposed to work around this.

Now, I can *kind of* understand what this function is trying to do,
but I don't understand the way it is going about it - this may be due
to my lack of understanding of postscript in general. The part that is
causing me confusion is this set of lines:

	    /*
	     * Check if the pattern bounding box intersects the page.
	     */
	    xlower = (xdev + pbbox->p.x > 0) ? pbbox->p.x : -xdev;
	    xupper = (xdev + pbbox->q.x < width) ? pbbox->q.x : -xdev + width;
	    ylower = (ydev + pbbox->p.y > 0) ? pbbox->p.y : -ydev;
	    yupper = (ydev + pbbox->q.y < height) ? pbbox->q.y : -ydev + height;

I wonder if someone could spell out for me the logic behind these
calculations? I keep getting confused about what pbbox is supposed to
represent.

  xdev       :: x offset from pattern origin in device space
  pbbox->p.x :: "lower left" of pattern bbox

I don't understand how these two figures are related, and therefore
what the meaning of xdev + pbbox->p.x is...

Regards,
Kevin.



More information about the gs-devel mailing list