[RFC weston 13/16] compositor: Add a function to test if images transformed by a matrix should be bilinearly filtered

Bill Spitzak spitzak at gmail.com
Fri Sep 26 15:48:46 PDT 2014


90 degree rotation about x or y will require filtering.

You test y scale twice, must be a typo. I think you intended to test z, 
but in fact z scale is not relevant so you should not test it at all.

Translation by non-integer will also require filtering.

I recommend instead of checking the rotation to instead look for zeros 
in the correct locations in the matrix. Matrix must be of the form:

  |sx 0  0 tx|
  |0  sy 0 ty|
  |?  ?  ?  ?|
  |0  0  0  1|

or

  |0  sx 0 tx|
  |sy 0  0 ty|
  |?  ?  ?  ?|
  |0  0  0  1|

sx and sy must be ±1, and tx and ty must be integers. The ? can be any 
value.

Also pixman is already doing equivalent tests and short-circuiting to 
nearest filter, so you might not need to check this anyway.

On 09/26/2014 02:10 PM, Derek Foreman wrote:

> +WL_EXPORT int
> +weston_matrix_needs_filtering(struct weston_matrix *matrix)
> +{
> +	if (!rot_is_90(weston_matrix_get_rotation_x(matrix))
> +	 || !rot_is_90(weston_matrix_get_rotation_y(matrix))
> +	 || !rot_is_90(weston_matrix_get_rotation_z(matrix))
> +	 || (fabs(weston_matrix_get_scale_x(matrix) - 1.0) > 0.0001)
> +	 || (fabs(weston_matrix_get_scale_y(matrix) - 1.0) > 0.0001)
> +	 || (fabs(weston_matrix_get_scale_y(matrix) - 1.0) > 0.0001))
> +		return 1;
> +
> +	return 0;
> +}



More information about the wayland-devel mailing list