[gs-devel] Understanding clamp_pattern_bbox()
Kevin Shanahan
kmshanah at disenchant.net
Tue May 1 17:14:03 PDT 2007
On Tue, May 01, 2007 at 07:36:50PM +0400, Leonardo wrote:
> > /*
> > * 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].
Ah, thanks - I can see it now. However, I still think there might be a
bug lurking here somewhere. Am I right to understand that when the
function exists the following should be true:
pbbox->q.x - pbbox->p.x <= width
&& pbbox->q.y - pbbox->p.y <= height
In this instance I have:
(gdb) print width
$2 = 2479
(gdb) print height
$3 = 3508
And, at function exit:
(gdb) print *pbbox
$5 = {p = {x = 155.63597106933594, y = -6677.2569427490234}, q = {x = 117745.96476745605, y = 380.97372436523438}}
Regards,
Kevin.
More information about the gs-devel
mailing list