/* Return value: TRUE if @matrix can be represented as a pixman translation, FALSE otherwise.  */
cairo_bool_t _cairo_matrix_is_pixman_translation(const cairo_matrix_t *matrix, cairo_filter_t filter, int *x_offset, int *y_offset)
/* Return value: TRUE if @matrix can be represented as a pixman translation, FALSE otherwise.  */
cairo_bool_t _cairo_matrix_is_pixman_translation(const cairo_matrix_t *matrix, cairo_filter_t filter, int *x_offset, int *y_offset)
{
    double tx, ty;
    if (!_cairo_matrix_is_translation (matrix))
	return FALSE;
    if (matrix->x0 == 0. && matrix->y0 == 0.)
	return TRUE;
    tx = matrix->x0 + *x_offset;
    ty = matrix->y0 + *y_offset;
    if (filter == CAIRO_FILTER_FAST || filter == CAIRO_FILTER_NEAREST) {
	tx = _pixman_nearest_sample (tx);
	ty = _pixman_nearest_sample (ty);
    } else if (tx != floor (tx) || ty != floor (ty)) {
	return FALSE;
    }
    if (fabs (tx) > PIXMAN_MAX_INT || fabs (ty) > PIXMAN_MAX_INT)
	return FALSE;
    *x_offset = _cairo_lround (tx);
    *y_offset = _cairo_lround (ty);
    return TRUE;
}