[Pixman] pixman_region_init_from_bitmap patched

Alexander Larsson alexl at redhat.com
Wed Feb 17 00:50:11 PST 2010

On Tue, 2010-02-16 at 20:56 +0100, Soeren Sandmann wrote:
> Hi,
> > Attached are the patches for pixman_region_init_from_bitmap, do
> these
> > look ok to you?
> I think it makes sense to have these functions. The patches are also
> available as a branch here:
>     http://cgit.freedesktop.org/~sandmann/pixman/log/?h=bfr
> Some comments:
> - Can the BM_ADDRECT macro become an inline function instead? The goto
>   can be dealt with by having it return a boolean. Something like
>         if (!add_rect())
>                 goto error;

Sure, I was just doing minimal code changes from the mi code.

> - We need to add Keith to the copyright statement


> - I think the API should take a pixman_image_t instead of pointers. I
>   know I said otherwise on IRC, but we need the information in the
>   image struct so that we can deal with accessors. If we add subimages
>   in the future, we will probably need this function to work on those
>   as well.

Hmmm, in the usecase i needed this for (spice) i need to be able to
create a region of a sub-rectangle of an bitmask. I guess i could do
this by creating a new temporary pixman_image_t using the same data and
stride but different offset and w/h.

>   The function should then return_if_fail() if the image format is not
>   a1, and the name should likely be _from_image() so that we can relax
>   it to take say a8 images at some point.


> - A test program would be useful.


> - One style comment: if one branch of an if statement has braces, the
>   other should as well.

Do you have a set of indent argument for pixman style? That would be
convenient when converting X code.

 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a bookish moralistic inventor who dotes on his loving old ma. She's a 
disco-crazy tempestuous nun with the power to bend men's minds. They fight 

More information about the Pixman mailing list