Closed Bug 380757 Opened 17 years ago Closed 17 years ago

Switch SVG filters to thebes

Categories

(Core :: SVG, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tor, Unassigned)

References

Details

Attachments

(3 files)

      No description provided.
Attachment #264888 - Flags: review?(jwatt)
Blocks: 375846
Comment on attachment 264888 [details] [diff] [review]
remove direct cairo usage from filters

>+  gfxContext ctx(targetSurface);
>+  ctx.SetColor(gfxRGBA(NS_GET_R(floodColor) / 255.0,
>+                       NS_GET_G(floodColor) / 255.0,
>+                       NS_GET_B(floodColor) / 255.0,
>+                       NS_GET_A(floodColor) / 255.0 * floodOpacity));
>+  ctx.Rectangle(gfxRect(rect.x, rect.y, rect.width, rect.height));

Would be nice if there was a gfxRect ctor that took an nsRect as it's argument, but, oh well.

>+already_AddRefed<gfxImageSurface>
> nsSVGFilterInstance::GetImage()
> {
>-  cairo_surface_t *surface =
>-    cairo_image_surface_create(CAIRO_FORMAT_ARGB32, mFilterResX, mFilterResY);
>-
>-  if (surface && cairo_surface_status(surface)) {
>-    cairo_surface_destroy(surface);
>+  nsRefPtr<gfxImageSurface> surface =
>+    new gfxImageSurface(gfxIntSize(mFilterResX, mFilterResY),
>+                        gfxASurface::ImageFormatARGB32);
>+
>+  if (surface && surface->Data()) {
>+    gfxContext ctx(surface);
>+    ctx.SetOperator(gfxContext::OPERATOR_CLEAR);
>+    ctx.Paint();
>+  } else {
>     surface = nsnull;
>   }
> 
>-  return surface;
>+  NS_IF_ADDREF(surface);
>+  return surface.get();

I think it would be easier to read as:

  if (!(surface && surface->Data())) {
    return nsnull;
  }
Attachment #264888 - Flags: review?(jwatt) → review+
Attachment #265544 - Flags: superreview?(roc)
Comment on attachment 265544 [details] [diff] [review]
adjust GetImage per comment

+    NS_ADDREF(surface);
     *aSurface = surface;

Use
  *aSurface = nsnull;
  surface.swap(*aSurface);

+  NS_ADDREF(surface);
+  return surface.get();

Similarly,
  gfxImageSurface* surf = nsnull;
  surface.swap(surf);
  return surf;
Attachment #265544 - Flags: superreview?(roc) → superreview+
Checked in.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: