[Pixman] [PATCH 3/4] Speed up pixman_region{, 32}_contains_rectangle()

Soeren Sandmann sandmann at cs.au.dk
Fri Aug 5 19:24:33 PDT 2011


Andrea Canciani <ranma42 at gmail.com> writes:

>> @@ -2137,12 +2170,13 @@ PIXMAN_EXPORT PREFIX (_contains_rectangle) (region_type_t *  region,
>>     x = prect->x1;
>>     y = prect->y1;
>>
>> +    pbox = PIXREGION_BOXPTR (region);
>> +    pbox_end = pbox + numRects;
>> +
>> +    pbox = find_box_for_y (pbox, pbox_end, y);
>>     /* can stop when both part_out and part_in are TRUE, or we reach prect->y2 */
>> -    for (pbox = PIXREGION_BOXPTR (region), pbox_end = pbox + numRects;
>> -         pbox != pbox_end;
>> -         pbox++)
>> +    for (; pbox != pbox_end; pbox++)
>>     {
>> -
>>         if (pbox->y2 <= y)
>>            continue;   /* getting up to speed or skipping remainder of band */
>
> If this test is not needed anymore, I think it should be deleted,
> otherwise the documentation of find_box_for_y should be modified.
>
> The same objection applies to patch 4/4.

*Some* kind of test is needed because y is not constant. However, we may
as well use the binary search here too, for some additional speed-up
when skipping the remainder of bands with many boxes.

I'll send an updated series that takes care of your other comments.


Thanks for the review,
Soren


More information about the Pixman mailing list