Closed Bug 261800 Opened 20 years ago Closed 20 years ago

svg getBBox implementation

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tor, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

 
Attached patch getBBox implementation (obsolete) — Splinter Review
Does anyone have an idea for a more elegant way of implementing
getBBox?  It's needed for filters, which by default are bounded
in object space coordinates.
Attached patch update to tip (obsolete) — Splinter Review
Attachment #160235 - Attachment is obsolete: true
Attachment #167586 - Flags: review?(scootermorris)
Depends on: 272899
Attachment #167586 - Flags: review?(scootermorris)
Attachment #167586 - Attachment is obsolete: true
Attachment #168057 - Flags: review?(scootermorris)
Comment on attachment 168057 [details] [diff] [review]
slightly cleaner version

Tim,
   scooter review+ provided that the two fprintf's to stderr get removed.


>+NS_IMETHODIMP
>+nsSVGGFrame::GetBBox(nsIDOMSVGRect **_retval)
>+{

......

This shouldn't be here anymore....

>+        fprintf(stderr, "subframe %f %f %f %f\n", bminx, bminy, bmaxx, bmaxy);
>+
>
>+void
>+nsSVGGlyphFrame::TransformPoint(float& x, float& y)
>+{
>+  nsCOMPtr<nsIDOMSVGMatrix> ctm;
>+  GetCanvasTM(getter_AddRefs(ctm));
>+  if (!ctm)
>+    return;

Any reason not to do this?

>+
>+  // XXX this is absurd! we need to add another method (interface
>+  // even?) to nsIDOMSVGMatrix to make this easier. (something like
>+  // nsIDOMSVGMatrix::TransformPoint(float*x,float*y))
>+  
>+  nsCOMPtr<nsIDOMSVGPoint> point;
>+  NS_NewSVGPoint(getter_AddRefs(point), x, y);
>+  if (!point)
>+    return;
>+

>+NS_IMETHODIMP
> nsSVGInnerSVGFrame::GetBBox(nsIDOMSVGRect **_retval)
> {
 ... 
This needs to get deleted also...

>+
>+        fprintf(stderr, "subframe %f %f %f %f\n", bminx, bminy, bmaxx, bmaxy);
>+
>+        if (!unionRect)
>+          unionRect = box;
>+        minx = PR_MIN(minx, bminx);
>+        miny = PR_MIN(miny, bminy);
>+        maxx = PR_MAX(maxx, bmaxx);
>+        maxy = PR_MAX(maxy, bmaxy);
>+      }
>+    }
Attachment #168057 - Flags: review?(scootermorris) → review+
> Any reason not to do this?
> >+  // XXX this is absurd! we need to add another method (interface
> >+  // even?) to nsIDOMSVGMatrix to make this easier. (something like
> >+  // nsIDOMSVGMatrix::TransformPoint(float*x,float*y))

This is a comment copied from nsSVGForeignObjectFrame - that method used
to be a lot uglier when we needed to search for the outer svg frame.
There's also that lingering question of if we should be adding
implementation helpers to the DOM.

Checked in - thanks.
Status: NEW → RESOLVED
Closed: 20 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: