[gs-devel] Understanding clamp_pattern_bbox()
Leonardo
leonardo at artifex.com
Tue May 1 08:36:50 PDT 2007
Kevin,
> /*
> * 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?
It looks as a superposition of 2 operations :
1. Intersect xdev + pbbox and [0:width][0:height].
2. Shift coords to [-xdev, -ydev].
Leo.
----- Original Message -----
From: "Kevin Shanahan" <kmshanah at disenchant.net>
To: <gs-devel at ghostscript.com>
Sent: Monday, April 30, 2007 7:20 AM
Subject: [gs-devel] Understanding clamp_pattern_bbox()
> 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.
> _______________________________________________
> gs-devel mailing list
> gs-devel at ghostscript.com
> http://www.ghostscript.com/mailman/listinfo/gs-devel
More information about the gs-devel
mailing list