_cairo_restrict_value (&red, 0.0, 1.0); _cairo_restrict_value (&green, 0.0, 1.0); _cairo_restrict_value (&blue, 0.0, 1.0);
_cairo_restrict_value (&red,    0.0, 1.0); _cairo_restrict_value (&green,  0.0, 1.0); _cairo_restrict_value (&blue,   0.0, 1.0); _cairo_restrict_value (&alpha,  0.0, 1.0);
cairo_pattern_add_color_stop (cairo_pattern_t *pattern,			      double offset,			      double red, double green, double blue,			      double alpha){    cairo_color_stop_t *stop;    int i;    _cairo_restrict_value (&offset, 0.0, 1.0);    _cairo_restrict_value (&red, 0.0, 1.0);    _cairo_restrict_value (&green, 0.0, 1.0);    _cairo_restrict_value (&blue, 0.0, 1.0);    pattern->n_stops++;    pattern->stops = realloc (pattern->stops,			      sizeof (cairo_color_stop_t) * pattern->n_stops);    if (pattern->stops == NULL) {	pattern->n_stops = 0;    	return CAIRO_STATUS_NO_MEMORY;    }    stop = &pattern->stops[pattern->n_stops - 1];    stop->offset = _cairo_fixed_from_double (offset);    stop->id = pattern->n_stops;    stop->color_char[0] = red * 0xff;    stop->color_char[1] = green * 0xff;    stop->color_char[2] = blue * 0xff;    stop->color_char[3] = alpha * 0xff;    /* sort stops in ascending order */    qsort (pattern->stops, pattern->n_stops, sizeof (cairo_color_stop_t),	   _cairo_pattern_stop_compare);    for (i = 0; i < pattern->n_stops - 1; i++) {	pattern->stops[i + 1].scale =	    pattern->stops[i + 1].offset - pattern->stops[i].offset;	if (pattern->stops[i + 1].scale == 65536)	    pattern->stops[i + 1].scale = 0;    }    return CAIRO_STATUS_SUCCESS;}