Closed Bug 341292 Opened 18 years ago Closed 18 years ago

Remove nsISVGPathFlatten interface

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tor, Assigned: tor)

Details

Attachments

(1 file, 2 obsolete files)

Remove interface plus the cairo path -> generic storage conversion.
Attached patch interface removal (obsolete) — Splinter Review
Attachment #225317 - Flags: review?(longsonr)
Comment on attachment 225317 [details] [diff] [review]
interface removal

I think that nsSVGPathElement::GetTotalLength need to flush the layout before it calls GetFlattenedPath as GetFlattenedPath no longer flushes itself. Either that or flush it in GetFlattenedPath.

+  float midpoint = aXOffset + aAdvance/2;
+      float normalization = 1.0/sqrt(dx*dx+dy*dy);

nits: Additional spaces here?

+class nsSVGFlattenedPath
+{
+private:
+  cairo_path_t *mPath;
+
+public:
+  nsSVGFlattenedPath(cairo_path_t *aPath) : mPath(aPath) {}
+  ~nsSVGFlattenedPath() { if (mPath) cairo_path_destroy(mPath); }
+
+  float Length();
+  void FindPoint(float aAdvance, float aXOffset, float aYOffset,
+                 float *aX, float *aY, float *aAngle);
+};
+

Wouldn't Length make more sense as GetLength?
(In reply to comment #2)
> (From update of attachment 225317 [details] [diff] [review] [edit])
> I think that nsSVGPathElement::GetTotalLength need to flush the layout before
> it calls GetFlattenedPath as GetFlattenedPath no longer flushes itself. Either
> that or flush it in GetFlattenedPath.

With this patch, there isn't any dependency on layout for flattening, so we don't need to flush anymore.
Comment on attachment 225317 [details] [diff] [review]
interface removal

OK. My other points are pretty cosmetic. I'm sure you can fix them up on checkin. r=rl.
Attachment #225317 - Flags: review?(longsonr) → review+
I guess that should have been r=longsonr
Attached patch address review comments (obsolete) — Splinter Review
In the future we'll probably want to cache the flattened path as a content property.
Attachment #225317 - Attachment is obsolete: true
Attachment #225431 - Flags: superreview?(roc)
+  nsSVGFlattenedPath *flat = GetFlattenedPath();

Use nsAutoPtr to hold this, it will delete for you.

+  return new nsSVGFlattenedPath(path);

If the 'new' fails, this leaks path.

+    /* should never happen with a flattened path */

Put an NS_WARNING in here

+  }
+  }

Can you indent somewhere in here so you don't need two } at the same level?
I need to get around to configuring emacs to automatically indent switch statements properly one of these days...
Attachment #225431 - Attachment is obsolete: true
Attachment #225583 - Flags: superreview?(roc)
Attachment #225431 - Flags: superreview?(roc)
Attachment #225583 - Flags: superreview?(roc) → superreview+
Checked in.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: