[PATCH weston v2 08/20] compositor: add weston_matrix_transform_rect() and use it where appropriate

Bill Spitzak spitzak at gmail.com
Mon Jan 19 15:41:58 PST 2015



On 01/09/2015 01:42 PM, Giulio Camuffo wrote:
> Just a nitpick below:

>> +WL_EXPORT pixman_box32_t
>> +weston_matrix_transform_rect(struct weston_matrix *matrix,
>> +                            pixman_box32_t rect)
>
> The function name doesn't imply it returns an axis aligned bounding
> box. Maybe something like "weston_matrix_rect_to_transformed_aabb"
> would be better?

I think that is implied pretty well by the return type, since that 
return type cannot possibly contain anything other than an axis-aligned box.

But it may be useful to indicate this is returning a bounding box and 
not some other rectangle. Another useful transform is an area-preserving 
one (the resulting rectangle has the same area and center as transformed 
quadrilateral).

That said, it has been very common for people to transform to a bounding 
box first and name this function "transform rectangle". When they 
realize they need the other function it is then often called "transform 
area". So this naming fits what many other libraries do.


More information about the wayland-devel mailing list