static int check_alt_settings(const struct libusb_interface_descriptor *alt, int num) { int ret; int i; for (i = 0; i < num; i++) { ret = check_endpoints(alt->endpoint, alt->bNumEndpoints); if (ret < 0) return ret; } return 0; };
int main (int argc, char *argv[]) { schro_init(); check_output (SCHRO_WAVELET_DAUBECHIES_9_7, 1); check_output (SCHRO_WAVELET_DAUBECHIES_9_7, 0); check_output (SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7, 1); check_output (SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7, 0); check_output (SCHRO_WAVELET_LE_GALL_5_3, 1); check_output (SCHRO_WAVELET_LE_GALL_5_3, 0); check_output (SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7, 1); check_output (SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7, 0); check_endpoints (SCHRO_WAVELET_DAUBECHIES_9_7, 1); check_endpoints (SCHRO_WAVELET_DAUBECHIES_9_7, 0); check_endpoints (SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7, 1); check_endpoints (SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7, 0); check_endpoints (SCHRO_WAVELET_LE_GALL_5_3, 1); check_endpoints (SCHRO_WAVELET_LE_GALL_5_3, 0); check_endpoints (SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7, 1); check_endpoints (SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7, 0); check_constant (SCHRO_WAVELET_DAUBECHIES_9_7); check_constant (SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7); check_constant (SCHRO_WAVELET_LE_GALL_5_3); check_constant (SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7); check_random (SCHRO_WAVELET_DAUBECHIES_9_7); check_random (SCHRO_WAVELET_DESLAURIERS_DUBUC_9_7); check_random (SCHRO_WAVELET_LE_GALL_5_3); check_random (SCHRO_WAVELET_DESLAURIERS_DUBUC_13_7); return 0; }
void arc_init(struct arc *arc, VGPathSegment type, VGfloat x1, VGfloat y1, VGfloat x2, VGfloat y2, VGfloat rh, VGfloat rv, VGfloat rot) { assert(type == VG_SCCWARC_TO || type == VG_SCWARC_TO || type == VG_LCCWARC_TO || type == VG_LCWARC_TO); arc->type = type; arc->x1 = x1; arc->y1 = y1; arc->x2 = x2; arc->y2 = y2; arc->a = rh; arc->b = rv; arc->theta = rot; arc->cos_theta = cos(arc->theta); arc->sin_theta = sin(arc->theta); { double cx0, cy0, cx1, cy1; double cx, cy; arc->is_valid = find_ellipses(rh, rv, rot, x1, y1, x2, y2, &cx0, &cy0, &cx1, &cy1); if (!arc->is_valid && try_to_fix_radii(arc)) { rh = arc->a; rv = arc->b; arc->is_valid = find_ellipses(rh, rv, rot, x1, y1, x2, y2, &cx0, &cy0, &cx1, &cy1); } if (type == VG_SCWARC_TO || type == VG_LCCWARC_TO) { cx = cx1; cy = cy1; } else { cx = cx0; cy = cy0; } #if DEBUG_ARCS debug_printf("Centers are : (%f, %f) , (%f, %f). Real (%f, %f)\n", cx0, cy0, cx1, cy1, cx, cy); #endif arc->cx = cx; arc->cy = cy; if (arc->is_valid) { arc->is_valid = find_angles(arc); #if DEBUG_ARCS check_endpoints(arc); #endif /* remap a few points. find_angles requires * rot in angles, the rest of the code * will need them in radians. and find_angles * modifies the center to match an identity * circle so lets reset it */ arc->theta = DEGREES_TO_RADIANS(rot); arc->cos_theta = cos(arc->theta); arc->sin_theta = sin(arc->theta); arc->cx = cx; arc->cy = cy; } } }