cairo_pattern_t *surface_pattern = cairo_pattern_create_for_surface(pattern_surface); cairo_pattern_set_matrix (surface_pattern, &pmatrix); cairo_pattern_set_extend (surface_pattern, CAIRO_EXTEND_REPEAT);
cairo_pattern_t *surface_pattern = cairo_pattern_create_for_surface(pattern_surface); if (surface_pattern) { cairo_pattern_set_matrix (surface_pattern, &pmatrix); cairo_pattern_set_extend (surface_pattern, CAIRO_EXTEND_REPEAT); }
CairoPattern(nsISVGRendererCanvas *canvas, nsISVGPattern *aPat,             nsISVGGeometrySource *aSource){  NS_ASSERTION(aPat, "Called CairoPattern without a pattern!");  if (!aPat)    return NULL;  nsCOMPtr<nsISVGCairoCanvas> cairoCanvas = do_QueryInterface(canvas);  NS_ASSERTION(cairoCanvas, "wrong svg render context for geometry!");  if (!cairoCanvas) return NULL;  cairo_t *ctx = cairoCanvas->GetContext();  cairo_identity_matrix(ctx);  // Paint it!  nsCOMPtr<nsISVGRendererSurface> aSurface;  nsCOMPtr<nsIDOMSVGMatrix> pMatrix;  if (NS_FAILED(aPat->PaintPattern(canvas, getter_AddRefs(aSurface), getter_AddRefs(pMatrix), aSource)))    return nsnull;  // Get the cairo surface  nsCOMPtr<nsISVGCairoSurface> cairoSurface = do_QueryInterface(aSurface);  if (!cairoSurface)    return nsnull;  cairo_surface_t *pattern_surface = cairoSurface->GetSurface();  if (!pattern_surface)    return nsnull;#ifdef DEBUG_scooter  // dumpPattern(cairoSurface);#endif  // Translate the pattern frame  cairo_matrix_t pmatrix = SVGToMatrix(pMatrix);  cairo_matrix_invert(&pmatrix);  cairo_pattern_t *surface_pattern = cairo_pattern_create_for_surface(pattern_surface);  cairo_pattern_set_matrix (surface_pattern, &pmatrix);  cairo_pattern_set_extend (surface_pattern, CAIRO_EXTEND_REPEAT);  return surface_pattern;}