bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAffineTransform setFrameOrigin broken


From: Alexander Malmberg
Subject: NSAffineTransform setFrameOrigin broken
Date: Thu, 06 Jun 2002 17:46:00 +0200

While trying to test scaling views, I noticed that [NSAffineTransform
-setFrameOrigin:] is broken if the matrix isn't the identity matrix.
This causes the _boundsMatrix to become incorrect, and that messes up
the calculations of _visibleRect and areas to draw.

Assuming setFrameOrigin: is meant to change the translation so that the
passed in point is translated to origin, I've attached a patch that
fixes it. It would be nice if someone else could verify that this is how
it's supposed to work.

- Alexander Malmberg
Index: NSAffineTransform.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSAffineTransform.m,v
retrieving revision 1.16
diff -u -r1.16 NSAffineTransform.m
--- NSAffineTransform.m 28 Mar 2002 03:53:18 -0000      1.16
+++ NSAffineTransform.m 6 Jun 2002 15:37:39 -0000
@@ -408,8 +408,9 @@
 
 - (void) setFrameOrigin: (NSPoint)point
 {
-  float dx = point.x - TX;
-  float dy = point.y - TY;
+  float det = B * C - A * D;
+  float dx = point.x + (D*TX-C*TY)/det;
+  float dy = point.y - (B*TX-A*TY)/det;
   [self translateToPoint: NSMakePoint(dx, dy)];
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]