[gs-devel] Understanding clamp_pattern_bbox()
Leonardo
leonardo at artifex.com
Wed May 2 00:14:49 PDT 2007
Kevin,
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.
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.
Leo.
----- 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