/* Compute the largest value strictly less than y which is on a grid row.  */
PIXMAN_EXPORT pixman_fixed_t pixman_sample_floor_y(pixman_fixed_t y, int n)
/* Compute the largest value strictly less than y which is on a grid row.  */
PIXMAN_EXPORT pixman_fixed_t pixman_sample_floor_y(pixman_fixed_t y, int n)
{
    pixman_fixed_t f = pixman_fixed_frac (y);
    pixman_fixed_t i = pixman_fixed_floor (y);
    f = DIV (f - pixman_fixed_e - Y_FRAC_FIRST (n), STEP_Y_SMALL (n)) * STEP_Y_SMALL (n) +
	Y_FRAC_FIRST (n);
    if (f < Y_FRAC_FIRST (n))
    {
	if (pixman_fixed_to_int (i) == 0x8000)
	{
	    f = 0;
	}
	else
	{
	    f = Y_FRAC_LAST (n);
	    i -= pixman_fixed_1;
	}
    }
    return (i | f);
}