cairo_pattern_t *gradient = CairoGradient(ctx, aGrad);
cairo_pattern_t *gradient = CairoGradient(ctx, aGrad, mSource);
nsSVGCairoPathGeometry::Render(nsISVGRendererCanvas *canvas){  nsCOMPtr<nsISVGCairoCanvas> cairoCanvas = do_QueryInterface(canvas);  NS_ASSERTION(cairoCanvas, "wrong svg render context for geometry!");  if (!cairoCanvas) return NS_ERROR_FAILURE;  cairo_t *ctx = cairoCanvas->GetContext();  PRUint16 renderMode;  canvas->GetRenderMode(&renderMode);  cairo_matrix_t *matrix;  if (renderMode == nsISVGRendererCanvas::SVG_RENDER_MODE_NORMAL) {    cairo_new_path(ctx);    /* save/pop the state so we don't screw up the xform */    cairo_save(ctx);  } else {    matrix = cairo_matrix_create();    cairo_current_matrix(ctx, matrix);  }  GeneratePath(ctx);  if (renderMode != nsISVGRendererCanvas::SVG_RENDER_MODE_NORMAL) {    PRUint16 rule;    mSource->GetClipRule(&rule);    if (rule == nsISVGGeometrySource::FILL_RULE_EVENODD)      cairo_set_fill_rule(ctx, CAIRO_FILL_RULE_EVEN_ODD);    else      cairo_set_fill_rule(ctx, CAIRO_FILL_RULE_WINDING);    cairo_set_matrix(ctx, matrix);    cairo_matrix_destroy(matrix);    return NS_OK;  }  PRUint16 strokeType, fillType;  PRBool bStroking = PR_FALSE;  mSource->GetStrokePaintType(&strokeType);  if (strokeType != nsISVGGeometrySource::PAINT_TYPE_NONE)    bStroking = PR_TRUE;  mSource->GetFillPaintType(&fillType);  if (fillType != nsISVGGeometrySource::PAINT_TYPE_NONE) {    if (bStroking)      cairo_save(ctx);    nscolor rgb;    mSource->GetFillPaint(&rgb);    float opacity;    mSource->GetFillOpacity(&opacity);    cairo_set_rgb_color(ctx,                        NS_GET_R(rgb)/255.0,                        NS_GET_G(rgb)/255.0,                        NS_GET_B(rgb)/255.0);    cairo_set_alpha(ctx, double(opacity));    if (fillType == nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR) {      cairo_fill(ctx);    } else {      nsCOMPtr<nsISVGGradient> aGrad;      mSource->GetFillGradient(getter_AddRefs(aGrad));      cairo_pattern_t *gradient = CairoGradient(ctx, aGrad);      cairo_set_pattern(ctx, gradient);      cairo_fill(ctx);      cairo_pattern_destroy(gradient);    }    if (bStroking)      cairo_restore(ctx);  }  if (bStroking) {    nscolor rgb;    mSource->GetStrokePaint(&rgb);    float opacity;    mSource->GetStrokeOpacity(&opacity);    cairo_set_rgb_color(ctx,                        NS_GET_R(rgb)/255.0,                        NS_GET_G(rgb)/255.0,                        NS_GET_B(rgb)/255.0);    cairo_set_alpha(ctx, double(opacity));    if (strokeType == nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR) {      cairo_stroke(ctx);    } else {      nsCOMPtr<nsISVGGradient> aGrad;      mSource->GetStrokeGradient(getter_AddRefs(aGrad));      cairo_pattern_t *gradient = CairoGradient(ctx, aGrad);      cairo_set_pattern(ctx, gradient);      cairo_stroke(ctx);      cairo_pattern_destroy(gradient);    }  }  cairo_restore(ctx);  return NS_OK;}