[Pixman] Speed up pixman_region_contains_{rectangle,point}

Søren Sandmann sandmann at cs.au.dk
Wed Aug 3 19:21:16 PDT 2011

This patch series contains a speed-up for the two functions
pixman_region_contains_rectangle() and pixman_region_contains_point().

The main usecase is when you select some text in Firefox and drag it,
a shaped window with a complicated shape will be created, and the X
server will call pixman_region_contains_rectangle() a bunch of times
on each mouse movement.

The speed up is to use a binary search to look for the first rectangle
in the region that could possible intersect the searched-for rectangle.

There is also a regression test to verify that nothing broke, and a
bug fix for lcg_rand_u32() which only generated 30 random bits, not


More information about the Pixman mailing list