op->stops = pattern->stops; op->n_stops = pattern->n_stops - 1; op->min_offset = pattern->stops[0].offset; op->max_offset = pattern->stops[op->n_stops].offset; op->extend = pattern->extend;  switch (pattern->filter) {
int i;  op->stops = malloc (pattern->n_stops * sizeof (cairo_shader_color_stop_t)); if (!op->stops) return CAIRO_STATUS_NO_MEMORY;  for (i = 0; i < pattern->n_stops; i++) { op->stops[i].color_char[0] = pattern->stops[i].color.red * 0xff; op->stops[i].color_char[1] = pattern->stops[i].color.green * 0xff; op->stops[i].color_char[2] = pattern->stops[i].color.blue * 0xff; op->stops[i].color_char[3] = pattern->stops[i].color.alpha * pattern->base.alpha * 0xff; op->stops[i].offset = pattern->stops[i].offset; op->stops[i].id = i; }   qsort (op->stops, pattern->n_stops, sizeof (cairo_shader_color_stop_t), _cairo_shader_color_stop_compare);  for (i = 0; i < pattern->n_stops - 1; i++) { op->stops[i + 1].scale = op->stops[i + 1].offset - op->stops[i].offset; if (op->stops[i + 1].scale == 65536) op->stops[i + 1].scale = 0; }  op->n_stops = pattern->n_stops; op->extend = pattern->base.extend;   switch (pattern->base.filter) {
_cairo_pattern_shader_init (cairo_pattern_t *pattern,			    cairo_shader_op_t *op){    op->stops = pattern->stops;    op->n_stops = pattern->n_stops - 1;    op->min_offset = pattern->stops[0].offset;    op->max_offset = pattern->stops[op->n_stops].offset;    op->extend = pattern->extend;        switch (pattern->filter) {    case CAIRO_FILTER_FAST:    case CAIRO_FILTER_NEAREST:	op->shader_function = _cairo_pattern_shader_nearest;	break;    case CAIRO_FILTER_GAUSSIAN:	op->shader_function = _cairo_pattern_shader_gaussian;	break;    case CAIRO_FILTER_GOOD:    case CAIRO_FILTER_BEST:    case CAIRO_FILTER_BILINEAR:	op->shader_function = _cairo_pattern_shader_linear;	break;    }}