Exemplo n.º 1
0
/* Used for the best precision of the current point,
   see comment in clamp_point_aux. */
int
gs_point_transform2fixed_rounding(const gs_matrix_fixed * pmat,
                         floatp x, floatp y, gs_fixed_point * ppt)
{
    gs_point fpt;

    gs_point_transform(x, y, (const gs_matrix *)pmat, &fpt);
    if (!(f_fits_in_fixed(fpt.x) && f_fits_in_fixed(fpt.y)))
        return_error(gs_error_limitcheck);
    ppt->x = float2fixed_rounded(fpt.x);
    ppt->y = float2fixed_rounded(fpt.y);
    return 0;
}
Exemplo n.º 2
0
static inline int
clamp_point_aux(bool clamp_coordinates, gs_fixed_point *ppt, floatp x, floatp y)
{
    if (!f_fits_in_bits(x, fixed_int_bits) || !f_fits_in_bits(y, fixed_int_bits)) {
	if (!clamp_coordinates)
	    return_error(gs_error_limitcheck);
	clamp_point(ppt, x, y);
    } else {
	/* 181-01.ps" fails with no rounding in 
	   "Verify as last element of a userpath and effect on setbbox." */
	ppt->x = float2fixed_rounded(x);
	ppt->y = float2fixed_rounded(y);
    }
    return 0;
}