} else if (serverType == nsISVGGeometrySource::PAINT_TYPE_PATTERN) { nsCOMPtr<nsISVGPattern> aPat; mSource->GetStrokePattern(getter_AddRefs(aPat)); TextureBrush *pattern = GDIPlusPattern(canvas, aPat, mSource);    mSource->GetStrokePaint(&color); mSource->GetStrokeOpacity(&opacity);  RenderPath(GetStroke(), color, opacity, gdiplusCanvas, pattern); delete pattern;
nsSVGGDIPlusPathGeometry::Render(nsISVGRendererCanvas *canvas){  nsCOMPtr<nsISVGGDIPlusCanvas> gdiplusCanvas = do_QueryInterface(canvas);  NS_ASSERTION(gdiplusCanvas, "wrong svg render context for geometry!");  if (!gdiplusCanvas) return NS_ERROR_FAILURE;  PRUint16 canvasRenderMode;  canvas->GetRenderMode(&canvasRenderMode);  if (canvasRenderMode == nsISVGRendererCanvas::SVG_RENDER_MODE_CLIP) {    Region *region = gdiplusCanvas->GetClipRegion();    GraphicsPath *path = GetFill();    PRUint16 rule;    mSource->GetClipRule(&rule);    if (rule == nsISVGGeometrySource::FILL_RULE_EVENODD)      path->SetFillMode(FillModeAlternate);    else      path->SetFillMode(FillModeWinding);    region->Union(path);    return NS_OK;  }  PRUint16 renderingMode;  mSource->GetShapeRendering(&renderingMode);  switch (renderingMode) {    case nsISVGPathGeometrySource::SHAPE_RENDERING_OPTIMIZESPEED:    case nsISVGPathGeometrySource::SHAPE_RENDERING_CRISPEDGES:      gdiplusCanvas->GetGraphics()->SetSmoothingMode(SmoothingModeNone);      break;    default:      gdiplusCanvas->GetGraphics()->SetSmoothingMode(SmoothingModeAntiAlias);      break;  }    gdiplusCanvas->GetGraphics()->SetCompositingQuality(CompositingQualityHighSpeed);//  gdiplusCanvas->GetGraphics()->SetPixelOffsetMode(PixelOffsetModeHalf);  nscolor color;  float opacity;  PRUint16 type, serverType = 0;    // paint fill:  mSource->GetFillPaintType(&type);  if (type == nsISVGGeometrySource::PAINT_TYPE_SERVER) {      if(NS_FAILED(mSource->GetFillPaintServerType(&serverType)))        type = nsISVGGeometrySource::PAINT_TYPE_NONE;  }  if (type != nsISVGGeometrySource::PAINT_TYPE_NONE && GetFill()) {    if (type == nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR) {      mSource->GetFillPaint(&color);      mSource->GetFillOpacity(&opacity);      RenderPath(GetFill(), color, opacity, gdiplusCanvas);    } else {      if (serverType == nsISVGGeometrySource::PAINT_TYPE_GRADIENT) {        nsCOMPtr<nsISVGGradient> aGrad;        mSource->GetFillGradient(getter_AddRefs(aGrad));        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(),                        mSource, gradCBFill, this);      }    }  }  // paint stroke:  mSource->GetStrokePaintType(&type);  if (type == nsISVGGeometrySource::PAINT_TYPE_SERVER) {      if(NS_FAILED(mSource->GetStrokePaintServerType(&serverType)))        type = nsISVGGeometrySource::PAINT_TYPE_NONE;  }  if (type != nsISVGGeometrySource::PAINT_TYPE_NONE && GetStroke()) {    if (type == nsISVGGeometrySource::PAINT_TYPE_SOLID_COLOR) {      mSource->GetStrokePaint(&color);      mSource->GetStrokeOpacity(&opacity);      RenderPath(GetStroke(), color, opacity, gdiplusCanvas);    } else {      if (serverType == nsISVGGeometrySource::PAINT_TYPE_GRADIENT) {        nsCOMPtr<nsISVGGradient> aGrad;        mSource->GetStrokeGradient(getter_AddRefs(aGrad));        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(),                        mSource, gradCBStroke, this);      }    }  }    return NS_OK;}