[PATCH 1/2] matrix: track transform type

Kristian Høgsberg hoegsberg at gmail.com
Mon Jan 28 17:44:38 PST 2013


On Mon, Jan 28, 2013 at 03:41:09PM -0800, Bill Spitzak wrote:
> This is very very useful, however the proposed set is not really correct:
> 
> >>+enum weston_matrix_transform_type {
> >>+	WESTON_MATRIX_TRANSFORM_TRANSLATE	= (1 << 0),
> >>+	WESTON_MATRIX_TRANSFORM_SCALE		= (1 << 1),
> >>+	WESTON_MATRIX_TRANSFORM_ROTATE		= (1 << 2),
> >>+	WESTON_MATRIX_TRANSFORM_OTHER		= (1 << 3),
> >>+};
> 
> These either have misleading names or are not really useful
> (translate will probably be true in all cases, things that can do
> rotate can usually do skew, does scale include reflections, etc).

This makes no sense, the flags describe exactly what kind of
transformation the matrix represents to the level of detail that we
need to know.  If you want to understand how the flags are used, I
suggest you read the patch.

> Useful things to know about the current transform (a,b,c,d,x,y are
> the 2x3 affine matrix):
> 
>  - Are x and y integers?
> 
>  - If it is a 90 degree rotation or reflection (meaning either b and
> c are zero, or a and d are zero).
> 
>  - No scaling: abs(ad-bc) == 1.
> 
>  - No perspective (third column of 3x3 matrix is 0, 0, 1).

They are only "useful things" if we actaully rely on that property.
As it is, we don't have a use for this information so there's no point
in tracking it.

Kristian


More information about the wayland-devel mailing list