Remove nsISVGRendererSurface usage from nsSVGPatternFrame

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
12 years ago
12 years ago

People

(Reporter: tor, Assigned: tor)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

12 years ago
 
(Assignee)

Comment 1

12 years ago
Created attachment 240031 [details] [diff] [review]
use cairo_surface_t directly
Attachment #240031 - Flags: review?(scootermorris)
Comment on attachment 240031 [details] [diff] [review]
use cairo_surface_t directly

>+cairo_surface_t *
>+nsSVGPatternFrame::CreateSurface(nsIDOMSVGRect *bbox)
> {
>-  *aSurface = nsnull;
>-
>-  nsSVGOuterSVGFrame* outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
>-  if (!outerSVGFrame) {
>-    return NS_ERROR_FAILURE;
>-  }
>-
>   float width, height;
>   bbox->GetWidth(&width);
>   bbox->GetHeight(&height);
> 
>-  nsCOMPtr<nsISVGRenderer> renderer;
>-  outerSVGFrame->GetRenderer(getter_AddRefs(renderer));
> #ifdef DEBUG_scooter
>   printf("Creating %dX%d surface\n",(int)(width),(int)(height));
> #endif
>-  renderer->CreateSurface((int)(width), (int)(height), aSurface);
>+  return cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
>+                                    (int)(width), (int)(height));
>   return NS_OK;

Remove this return.

> }

> nsresult
> nsSVGPatternFrame::SetupPaintServer(nsISVGRendererCanvas *aCanvas,
>                                     cairo_t *aCtx,
>                                     nsSVGGeometryFrame *aSource,
>                                     float aOpacity,
>                                     void **aClosure)
> {
>   *aClosure = nsnull;
> 
>   nsCOMPtr<nsISVGCairoCanvas> cairoCanvas = do_QueryInterface(aCanvas);
> 
>   cairo_matrix_t matrix;
>   cairo_get_matrix(aCtx, &matrix);
> 
>   // Paint it!
>-  nsCOMPtr<nsISVGRendererSurface> surface;
>+  cairo_surface_t *surface;
>   nsCOMPtr<nsIDOMSVGMatrix> pMatrix;
>   cairo_identity_matrix(aCtx);
>-  nsresult rv = PaintPattern(aCanvas, getter_AddRefs(surface),
>+  nsresult rv = PaintPattern(aCanvas, &surface,
>                              getter_AddRefs(pMatrix), aSource);
>   cairo_set_matrix(aCtx, &matrix);
>   NS_ENSURE_SUCCESS(rv, rv);

Leaking surface.

>-  // Get the cairo surface
>-  nsCOMPtr<nsISVGCairoSurface> cairoSurface = do_QueryInterface(surface);
>-  if (!cairoSurface)
>-    return NS_ERROR_FAILURE;
>-
>-  cairo_surface_t *pattern_surface = cairoSurface->GetSurface();
>-  if (!pattern_surface)
>-    return NS_ERROR_FAILURE;
>-
>   // Translate the pattern frame
>   cairo_matrix_t pmatrix = nsSVGUtils::ConvertSVGMatrixToCairo(pMatrix);
>   cairoCanvas->AdjustMatrixForInitialTransform(&pmatrix);
>   if (cairo_matrix_invert(&pmatrix))
>     return NS_ERROR_FAILURE;

Leaking surface.

>   cairo_pattern_t *surface_pattern =
>-    cairo_pattern_create_for_surface(pattern_surface);
>+    cairo_pattern_create_for_surface(surface);
>   if (!surface_pattern)
>     return NS_ERROR_FAILURE;

Leaking surface.
(Assignee)

Comment 3

12 years ago
Created attachment 240058 [details] [diff] [review]
plumbing fixed
Attachment #240031 - Attachment is obsolete: true
Attachment #240058 - Flags: review?(jwatt)
Attachment #240031 - Flags: review?(scootermorris)
Comment on attachment 240058 [details] [diff] [review]
plumbing fixed

r=jwatt
Attachment #240058 - Flags: review?(jwatt) → review+
(Assignee)

Updated

12 years ago
Attachment #240058 - Flags: superreview?(roc)
Attachment #240058 - Flags: superreview?(roc) → superreview+
(Assignee)

Comment 5

12 years ago
Checked in.
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.