gdiplusCanvas->GetGraphics(), gradCBPath, mStroke);
gdiplusCanvas->GetGraphics(), mSource, gradCBPath, this);
nsSVGGDIPlusGlyphGeometry::Render(nsISVGRendererCanvas *canvas){  // make sure that we have constructed our render objects  if (!mCoveredRegion) {    nsCOMPtr<nsISVGRendererRegion> region;    Update(nsISVGGeometrySource::UPDATEMASK_ALL, getter_AddRefs(region));  }  nsCOMPtr<nsISVGGDIPlusCanvas> gdiplusCanvas = do_QueryInterface(canvas);  NS_ASSERTION(gdiplusCanvas, "wrong svg canvas for geometry!");  if (!gdiplusCanvas) return NS_ERROR_FAILURE;  PRUint16 canvasRenderMode;  canvas->GetRenderMode(&canvasRenderMode);  if (canvasRenderMode == nsISVGRendererCanvas::SVG_RENDER_MODE_CLIP) {    nsCOMPtr<nsISVGGDIPlusGlyphMetrics> metrics;    {      nsCOMPtr<nsISVGRendererGlyphMetrics> xpmetrics;      mSource->GetMetrics(getter_AddRefs(xpmetrics));      metrics = do_QueryInterface(xpmetrics);      NS_ASSERTION(metrics, "wrong metrics object!");      if (!metrics)        return NS_ERROR_FAILURE;    }      FontFamily fontFamily;    metrics->GetFont()->GetFamily(&fontFamily);      nsAutoString text;    mSource->GetCharacterData(text);    float x,y;    mSource->GetX(&x);    mSource->GetY(&y);      GraphicsPath path;    path.AddString(PromiseFlatString(text).get(), -1,                   &fontFamily, metrics->GetFont()->GetStyle(),                   metrics->GetFont()->GetSize(),                   PointF(x,y), StringFormat::GenericTypographic());    PRUint16 rule;    mSource->GetClipRule(&rule);    if (rule == nsISVGGeometrySource::FILL_RULE_EVENODD)      path.SetFillMode(FillModeAlternate);    else      path.SetFillMode(FillModeWinding);    Region *region = gdiplusCanvas->GetClipRegion();    if (region)      region->Union(&path);    return NS_OK;  }  PRBool hasFill = PR_FALSE, hasStroke = PR_FALSE;  PRUint16 filltype, stroketype;  mSource->GetFillPaintType(&filltype);  if (filltype != nsISVGGeometrySource::PAINT_TYPE_NONE)    hasFill = PR_TRUE;  mSource->GetStrokePaintType(&stroketype);  if (stroketype != nsISVGGeometrySource::PAINT_TYPE_NONE && mStroke)    hasStroke = PR_TRUE;  if (!hasFill && !hasStroke) return NS_OK; // nothing to paint    SectionIterator sections(mSource);  if (sections.IsEnd()) return NS_OK; // nothing to paint  gdiplusCanvas->GetGraphics()->SetSmoothingMode(SmoothingModeAntiAlias);  //gdiplusCanvas->GetGraphics()->SetPixelOffsetMode(PixelOffsetModeHalf);    nsAutoString text;  mSource->GetCharacterData(text);  float x,y;  mSource->GetX(&x);  mSource->GetY(&y);    // iterate over all sections  while (!sections.IsEnd()) {        if (sections.IsHighlighted()) {      nscolor bg = sections.GetHighlightBackground();      SolidBrush brush(Color(NS_GET_R(bg), NS_GET_G(bg), NS_GET_B(bg)));      GraphicsState state = gdiplusCanvas->GetGraphics()->Save();      Matrix m;      GetGlobalTransform(&m);      gdiplusCanvas->GetGraphics()->MultiplyTransform(&m);            gdiplusCanvas->GetGraphics()->FillRectangle(&brush, sections.GetBounds().X+x,                                                  sections.GetBounds().Y+y,                                                  sections.GetBounds().Width,                                                  sections.GetBounds().Height);      gdiplusCanvas->GetGraphics()->Restore(state);    }    if (hasFill) {      nscolor color;      if (!sections.IsHighlighted())        mSource->GetFillPaint(&color);      else        color = sections.GetHighlightForeground();            float opacity;      mSource->GetFillOpacity(&opacity);      SolidBrush brush(Color((BYTE)(opacity*255),NS_GET_R(color),NS_GET_G(color),NS_GET_B(color)));      nsCOMPtr<nsISVGGradient> aGrad;      if (filltype != nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR)        mSource->GetFillGradient(getter_AddRefs(aGrad));      DrawFill(gdiplusCanvas->GetGraphics(), brush, aGrad,               sections.GetSectionPtr(), sections.GetLength(), sections.GetAdvance()+x, y);    }    if (hasStroke) {      nscolor color;      if (!sections.IsHighlighted())        mSource->GetStrokePaint(&color);      else        color = sections.GetHighlightForeground();            float opacity;      mSource->GetStrokeOpacity(&opacity);      nsCOMPtr<nsISVGGradient> aGrad;      if (stroketype != nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR)        mSource->GetStrokeGradient(getter_AddRefs(aGrad));      SolidBrush brush(Color((BYTE)(opacity*255), NS_GET_R(color), NS_GET_G(color), NS_GET_B(color)));      if (sections.IsOnlySection() && !sections.IsHighlighted()) {        // this is the 'normal' case        if (stroketype == nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR) {          gdiplusCanvas->GetGraphics()->FillPath(&brush, mStroke);        } else {          nsCOMPtr<nsISVGRendererRegion> region;          GetCoveredRegion(getter_AddRefs(region));          nsCOMPtr<nsISVGGDIPlusRegion> aRegion = do_QueryInterface(region);          nsCOMPtr<nsIDOMSVGMatrix> ctm;          mSource->GetCanvasTM(getter_AddRefs(ctm));                    GDIPlusGradient(aRegion, aGrad, ctm,                          gdiplusCanvas->GetGraphics(),                          gradCBPath, mStroke);        }      }      else {        // There is more than one section, so we need to clip our cached mStroke        // XXX For now we just paint the stroke as in the unhighlighted case...        gdiplusCanvas->GetGraphics()->FillPath(&brush, mStroke);        // ... and paint a fill on top if the section is highlighted:        if (sections.IsHighlighted())          DrawFill(gdiplusCanvas->GetGraphics(), brush, aGrad,                   sections.GetSectionPtr(), sections.GetLength(), sections.GetAdvance()+x, y);      }          }              sections.Next();        }    return NS_OK;}