nsSVGGDIPlusGlyphGeometry::DrawFill(Graphics* g, Brush& b, nsISVGGradient *aGrad,
nsSVGGDIPlusGlyphGeometry::DrawFill(Graphics* g, Brush* b, nsISVGGradient *aGrad,
nsSVGGDIPlusGlyphGeometry::DrawFill(Graphics* g, Brush& b, nsISVGGradient *aGrad,                                    const WCHAR* start, INT length,                                    float x, float y){  nsCOMPtr<nsISVGGDIPlusGlyphMetrics> metrics;  {    nsCOMPtr<nsISVGRendererGlyphMetrics> xpmetrics;    mSource->GetMetrics(getter_AddRefs(xpmetrics));    metrics = do_QueryInterface(xpmetrics);    NS_ASSERTION(metrics, "wrong metrics object!");    if (!metrics) return;  }  GraphicsState state = g->Save();    Matrix m;  GetGlobalTransform(&m);  g->MultiplyTransform(&m);  g->SetTextRenderingHint(metrics->GetTextRenderingHint());  StringFormat stringFormat(StringFormat::GenericTypographic());  stringFormat.SetFormatFlags(stringFormat.GetFormatFlags() |                              StringFormatFlagsMeasureTrailingSpaces);  stringFormat.SetLineAlignment(StringAlignmentNear);  nsSVGCharacterPosition *cp;  if (NS_FAILED(mSource->GetCharacterPosition(&cp)))    return;    if (aGrad) {    nsCOMPtr<nsISVGRendererRegion> region;    GetCoveredRegion(getter_AddRefs(region));    nsCOMPtr<nsISVGGDIPlusRegion> aRegion = do_QueryInterface(region);    nsCOMPtr<nsIDOMSVGMatrix> ctm;    mSource->GetCanvasTM(getter_AddRefs(ctm));        gradCallbackStruct cb;    cb.start = start;    cb.length = length;    cb.metrics = metrics;    cb.x = x;  cb.y = y;    cb.stringformat = &stringFormat;    cb.cp = cp;    GDIPlusGradient(aRegion, aGrad, ctm, g, mSource, gradCBString, &cb);  }  else {    if (!cp) {      g->DrawString(start, length, metrics->GetFont(), PointF(x,y),                    &stringFormat, &b);    } else {      for (PRUint32 i=0; i<length; i++) {        if (cp[i].draw == PR_FALSE)          continue;        GraphicsState state = g->Save();        g->TranslateTransform(cp[i].x, cp[i].y);        g->RotateTransform(cp[i].angle * 180.0 / M_PI);        g->DrawString(start + i, 1, metrics->GetFont(), PointF(0, 0),                      &stringFormat, &b);        g->Restore(state);      }    }  }    delete [] cp;    g->Restore(state);}