[gs-devel] Understanding clamp_pattern_bbox()

Kevin Shanahan kmshanah at disenchant.net
Wed May 2 13:49:55 PDT 2007


On Wed, May 02, 2007 at 11:14:49AM +0400, Leonardo wrote:
> >when the
> >function exists the following should be true:
> >
> >    pbbox->q.x - pbbox->p.x <= width
> > && pbbox->q.y - pbbox->p.y <= height
> 
> No, it should not.
> It computes an union of *all* possible intersections while tiling.
> For example, if a tile size is page size + w,
> and if all 4 tile corners appear at the center of the page,
> the result covers entire tile size+w.

Ah, I see now. Yes, looks like the function is behaving as intended
after all. Thanks for the pointers. :-)

> I agree that in this case the performance may be improved
> with representing the tile as 4 bitmaps, so that
> the summary bitmap area is same as page size rather than
> size+w. However it needs a non-trivial architectural change,
> because now it's a single bitmap.
> 
> I recommend you to look at the bug 688396 Comment #10
> and its referents before taking further actions.

Right, makes sense. I'll try a build from current svn and post the
results to my bug report #688991. It certainly does sound like mine is
a duplicate.

Cheers,
Kevin.

> ----- Original Message ----- 
> From: "Kevin Shanahan" <kmshanah at disenchant.net>
> To: "Leonardo" <leonardo at artifex.com>; <gs-devel at ghostscript.com>
> Sent: Wednesday, May 02, 2007 4:14 AM
> Subject: Re: [gs-devel] Understanding clamp_pattern_bbox()
> 
> 
> >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