Closed
Bug 83517
Opened 23 years ago
Closed 23 years ago
nsTransform2D's translation part can't be set in transformed coords
Categories
(Core Graveyard :: GFX, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla1.0.1
People
(Reporter: alex, Assigned: dcone)
References
Details
Attachments
(1 file)
833 bytes,
patch
|
jst
:
superreview+
|
Details | Diff | Splinter Review |
There's an asymmetry in nsTransform2D's GetTranslation() and AddTranslation() functions, which makes it a pain to construct a transformation matrix that is equal to another matrix sans the translation part. (This is needed for the SVG, where we need to offset the rendering context's transformation to correctly map out a temporary offscreen surface.) The problem is that nsTransform2D::GetTranslation() returns the translation part of the matrix in _already transformed_ units, i.e. it just returns the m20 and m21 matrix elements. nsTransform2D::AddTranslation()'s arguments, on the other hand, will be scaled/rotated by the matrix before they are added to m20/m21. This means that, to get rid of the matrix translation offset while keeping the rest, you can't just do "AddTranslation( - GetTranslation() )". It would help immensely if we could add a "SetTranslation()"-function that is the direct counterpart to GetTranslation() : Index: nsTransform2D.h =================================================================== RCS file: /cvsroot/mozilla/gfx/public/nsTransform2D.h,v retrieving revision 1.2 diff -u -r1.2 nsTransform2D.h --- nsTransform2D.h 1999/11/06 03:20:49 1.2 +++ nsTransform2D.h 2001/05/31 19:25:11 @@ -105,6 +105,17 @@ void GetTranslationCoord(nscoord *ptX, nscoord *ptY) { *ptX = NSToCoordRound (m20); *ptY = NSToCoordRound(m21); } /** + * set the translation portion of this transform + * + * @param tx, x translation + * @param ty, y translation + * @exception + **/ + + void SetTranslation(float tX, float tY) { m20 = tX; m21 = tY; type |= MG_2DTRANSLATION; } + + + /** * get the X translation portion of this transform * * @param
Updated•23 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.0
Comment 1•23 years ago
|
||
Reassigning to dcone.
Assignee: kmcclusk → dcone
Status: ASSIGNED → NEW
Target Milestone: mozilla1.0 → mozilla1.0.1
Comment 2•23 years ago
|
||
OK, this has been here for 5.5 months. I'm attaching a patch with the inlining fixed.
Comment 3•23 years ago
|
||
pav: can you review this?
Comment 4•23 years ago
|
||
Comment on attachment 57429 [details] [diff] [review] patch with correct indenting r=pavlov
Attachment #57429 -
Flags: review+
Comment 5•23 years ago
|
||
Comment on attachment 57429 [details] [diff] [review] patch with correct indenting sr=jst with the style cleanup I talked to bbaetz about online.
Attachment #57429 -
Flags: review+ → superreview+
Comment 6•23 years ago
|
||
Checked in for alex, with a sensible style (ie not what the rest of the file does)
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•