Closed Bug 337145 Opened 20 years ago Closed 20 years ago

One copy of nsIDOMSVGMatrix -> cairo_matrix_t code

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tor, Assigned: tor)

Details

Attachments

(2 files)

Attachment #221316 - Flags: superreview?(roc)
Attachment #221316 - Flags: review?(jwatt)
Comment on attachment 221316 [details] [diff] [review] single version of conversion, in nsSVGMatrix >+cairo_matrix_t >+ConvertSVGMatrixToCairo(nsIDOMSVGMatrix *aMatrix) >+{ >+ float A, B, C, D, E, F; >+ aMatrix->GetA(&A); >+ aMatrix->GetB(&B); >+ aMatrix->GetC(&C); >+ aMatrix->GetD(&D); >+ aMatrix->GetE(&E); >+ aMatrix->GetF(&F); >+ cairo_matrix_t m = { A, B, C, D, E, F }; >+ return m; >+} Does that really work? Isn't that a stack allocated object you're returning there?
No, structure returns are allowed. It does indicate a copy needs to be done, unless the compiler's optimizer is smart enough to see what's happening.
In this case no copy will be done.
Shouldn't this function be in nsSVGUtils? Or perhaps we need nsSVGContentUtils.
(In reply to comment #5) > Shouldn't this function be in nsSVGUtils? Or perhaps we need nsSVGContentUtils. From the patch: +/* + * Helper to convert a nsIDOMSVGMatrix to a cairo_matrix_t. Defined + * here instead of in nsSVGUtils.h because that file is needed in + * several places where it would be inappropriate to include cairo.h. + */
Comment on attachment 221316 [details] [diff] [review] single version of conversion, in nsSVGMatrix r=jwatt (In reply to comment #3) > No, structure returns are allowed. It does indicate a copy needs to be done, > unless the compiler's optimizer is smart enough to see what's happening. Doh! Right. (In reply to comment #4) > In this case no copy will be done. How can you say?
Attachment #221316 - Flags: review?(jwatt) → review+
Comment on attachment 221316 [details] [diff] [review] single version of conversion, in nsSVGMatrix sr+ with the NS_ change
Attachment #221316 - Flags: superreview?(roc) → superreview+
Checked in.
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: