diff --git a/ChangeLog b/ChangeLog index f69d65378..708e35919 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Mar 1 20:06:00 1999 Richard Frith-Macdonald + + * Headers/AppKit/NSAffineTransform.h: New file based on PSMatrix.h + * Source/NSAffineTransform.m: New file based on PSMatrix.m + * Source/NSView.m: Modified to use NSAffineTransformAffineTransform + * Source/GNUmakefile: Added NSAffineTransform + * Source/NSCell.m: Don't include PSMatrix.h + * Source/NSScroller.m: Don't include PSMatrix.h + * Source/NSView.m: Use NSAffineTransform + * Source/NSWindow.m: Don't include PSMatrix.h + Mon Mar 1 17:12:00 1999 Richard Frith-Macdonald * Headers/AppKit/NSCell.h: Added MacOS-X cell state constants. diff --git a/Headers/gnustep/gui/NSAffineTransform.h b/Headers/gnustep/gui/NSAffineTransform.h new file mode 100644 index 000000000..f450a2008 --- /dev/null +++ b/Headers/gnustep/gui/NSAffineTransform.h @@ -0,0 +1,106 @@ +/* + NSAffineTransform.h + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Ovidiu Predescu + Date: August 1997 + Rewrite for macOS-X compatibility: Richard Frith-Macdonald, 1999 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _GNUstep_H_NSAffineTransform +#define _GNUstep_H_NSAffineTransform + +#include +#include + +@class NSBezierPath; + +typedef struct { + float m11; + float m12; + float m21; + float m22; + float tx; + float ty; +} NSAffineTransformStruct; + +@interface NSAffineTransform : NSObject +{ +@public + NSAffineTransformStruct matrix; + float rotationAngle; +} + ++ (NSAffineTransform*) transform; +- (void) appendTransform: (NSAffineTransform*)aTransform; +- (void) concat; +- (id) initWithTransform: (NSAffineTransform*)aTransform; +- (void) invert; +- (void) prependTransform: (NSAffineTransform*)aTransform; +- (void) rotateByDegrees: (float)angle; +- (void) rotateByRadians: (float)angle; +- (void) scaleBy: (float)scale; +- (void) scaleXBy: (float)scaleX yBy: (float)scaleY; +- (void) set; +- (void) setTransformStruct: (NSAffineTransformStruct)val; +- (NSBezierPath*) transformBezierPath: (NSBezierPath*)aPath; +- (NSPoint) transformPoint: (NSPoint)aPoint; +- (NSSize) transformSize: (NSSize)aSize; +- (NSAffineTransformStruct) transformStruct; +- (void) translateXBy: (float)tranX yBy: (float)tranY; + +#ifndef NO_GNUSTEP ++ (NSAffineTransform*) matrixFrom: (const float[6])matrix; +- (void) translateToPoint: (NSPoint)point; +- (void) rotateByAngle: (float)angle; +- (void) scaleBy: (float)sx : (float)sy; +- (void) scaleTo: (float)sx : (float)sy; +- (void) makeIdentityMatrix; +- (float) rotationAngle; +- (void) setFrameOrigin: (NSPoint)point; +- (void) setFrameRotation: (float)angle; +- (void) inverse; + +- (BOOL) isRotated; + +- (void) boundingRectFor: (NSRect)rect result: (NSRect*)result; + +/* Returns anotherMatrix * self */ +- (void) concatenateWith: (NSAffineTransform*)anotherMatrix; + +- (NSPoint) pointInMatrixSpace: (NSPoint)point; +- (NSSize) sizeInMatrixSpace: (NSSize)size; +- (NSRect) rectInMatrixSpace: (NSRect)rect; + +- (void) setMatrix: (const float[6])replace; +- (void) getMatrix: (float[6])replace; + +/* Private definitions */ +#define A matrix.m11 +#define B matrix.m12 +#define C matrix.m21 +#define D matrix.m22 +#define TX matrix.tx +#define TY matrix.ty + +#endif +@end + +#endif /* _GNUstep_H_NSAffineTransform */ diff --git a/Headers/gnustep/gui/NSView.h b/Headers/gnustep/gui/NSView.h index 0a1966d64..5f021cac9 100644 --- a/Headers/gnustep/gui/NSView.h +++ b/Headers/gnustep/gui/NSView.h @@ -351,7 +351,7 @@ enum { @end -@class PSMatrix; +@class NSAffineTransform; // // GNUstep extensions @@ -375,8 +375,8 @@ enum { - (void) _invalidateCoordinates; - (void) _rebuildCoordinates; -- (PSMatrix*)_matrixToWindow; -- (PSMatrix*)_matrixFromWindow; +- (NSAffineTransform*)_matrixToWindow; +- (NSAffineTransform*)_matrixFromWindow; @end #endif diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 1eba35ffb..96c411a60 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -38,6 +38,7 @@ LIBRARY_NAME=libgnustep-gui # The Objective-C source files to be compiled libgnustep-gui_OBJC_FILES = Functions.m \ NSActionCell.m \ +NSAffineTransform.m \ NSApplication.m \ NSBitmapImageRep.m \ NSBox.m \ @@ -121,6 +122,7 @@ libgnustep-gui_HEADER_FILES_INSTALL_DIR = /gnustep/gui libgnustep-gui_HEADER_FILES = \ AppKit/AppKit.h \ AppKit/NSActionCell.h \ +AppKit/NSAffineTransform.h \ AppKit/NSApplication.h \ AppKit/NSBitmapImageRep.h \ AppKit/NSBox.h \ diff --git a/Source/NSAffineTransform.m b/Source/NSAffineTransform.m new file mode 100644 index 000000000..1a6bfa91c --- /dev/null +++ b/Source/NSAffineTransform.m @@ -0,0 +1,539 @@ +/* + NSAffineTransform.m + + Copyright (C) 1996,1999 Free Software Foundation, Inc. + + Author: Ovidiu Predescu + Date: August 1997 + Author: Richard Frith-Macdonald + Date: Mark 1999 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +#include +#include + +#include +#include +#include + +/* A Postscript matrix look like this: + + / a b 0 \ + | c d 0 | + \ tx ty 1 / + + */ + +static const float pi = 3.1415926535897932384626433; + +@implementation NSAffineTransform + +static NSAffineTransformStruct identityTransform = { + 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 +}; + ++ (NSAffineTransform*) transform +{ + NSAffineTransform *t; + + t = (NSAffineTransform*)NSAllocateObject(self, 0, NSDefaultMallocZone()); + t->matrix = identityTransform; + t->rotationAngle = 0.0; + return [t autorelease]; +} + ++ (id) new +{ + NSAffineTransform *t; + + t = (NSAffineTransform*)NSAllocateObject(self, 0, NSDefaultMallocZone()); + t->matrix = identityTransform; + t->rotationAngle = 0.0; + return t; +} + +- (void) appendTransform: (NSAffineTransform*)other +{ + float newA, newB, newC, newD, newTX, newTY; + + newA = other->A * A + other->B * C; + newB = other->A * B + other->B * D; + newC = other->C * A + other->D * C; + newD = other->C * B + other->D * D; + newTX = other->TX * A + other->TY * C + TX; + newTY = other->TX * B + other->TY * D + TY; + + A = newA; B = newB; + C = newC; D = newD; + TX = newTX; TY = newTY; + + if (rotationAngle >= 0 && other->rotationAngle >= 0) + { + rotationAngle += other->rotationAngle; + if (rotationAngle < 0) + rotationAngle -= ((int)(rotationAngle/360)-1)*360; + else if (rotationAngle >= 360) + rotationAngle -= ((int)(rotationAngle/360))*360; + } + else + rotationAngle = -1; +} + +- (void) concat +{ +// PSconcat(self); +[self subclassResponsibility: _cmd]; +} + +- (id) init +{ + matrix = identityTransform; + rotationAngle = 0.0; + return self; +} + +- (id) initWithTransform: (NSAffineTransform*)aTransform +{ + matrix = aTransform->matrix; + rotationAngle = aTransform->rotationAngle; + return self; +} + +- (void) invert +{ + float newA, newB, newC, newD, newTX, newTY; + float det; + + det = A * D - B * C; + if (!det) + { + NSLog (@"error: determinant of matrix is 0!"); + return; + } + + newA = D / det; + newB = -B / det; + newC = -C / det; + newD = A / det; + newTX = (-D * TX + C * TY) / det; + newTY = (B * TX - A * TY) / det; + + NSDebugLog (@"inverse of matrix ((%f, %f) (%f, %f) (%f, %f))\n" + @"is ((%f, %f) (%f, %f) (%f, %f))", + A, B, C, D, TX, TY, + newA, newB, newC, newD, newTX, newTY); + + A = newA; B = newB; + C = newC; D = newD; + TX = newTX; TY = newTY; +} + +- (void) prependTransform: (NSAffineTransform*)other +{ + float newA, newB, newC, newD, newTX, newTY; + + newA = A * other->A + B * other->C; + newB = A * other->B + B * other->D; + newC = C * other->A + D * other->C; + newD = C * other->B + D * other->D; + newTX = TX * other->A + TY * other->C + other->TX; + newTY = TX * other->B + TY * other->D + other->TY; + + A = newA; B = newB; + C = newC; D = newD; + TX = newTX; TY = newTY; + + if (rotationAngle >= 0 && other->rotationAngle >= 0) + { + rotationAngle += other->rotationAngle; + if (rotationAngle < 0) + rotationAngle -= ((int)(rotationAngle/360)-1)*360; + else if (rotationAngle >= 360) + rotationAngle -= ((int)(rotationAngle/360))*360; + } + else + rotationAngle = -1; +} + +- (void) rotateByDegrees: (float)angle +{ + float newA, newB, newC, newD; + float angleRad = pi * angle / 180; + float sine = sin (angleRad); + float cosine = cos (angleRad); + + newA = A * cosine + C * sine; newB = B * cosine + D * sine; + newC = -A * sine + C * cosine; newD = -B * sine + D * cosine; + + A = newA; B = newB; + C = newC; D = newD; + + if (rotationAngle >= 0) + { + rotationAngle += angle; + if (rotationAngle < 0) + rotationAngle -= ((int)(rotationAngle/360)-1)*360; + else if (rotationAngle >= 360) + rotationAngle -= ((int)(rotationAngle/360))*360; + } + else + rotationAngle = -1; +} + +- (void) rotateByRadians: (float)angleRad +{ + float newA, newB, newC, newD; + float angle = angleRad * 180 / pi; + float sine = sin (angleRad); + float cosine = cos (angleRad); + + newA = A * cosine + C * sine; newB = B * cosine + D * sine; + newC = -A * sine + C * cosine; newD = -B * sine + D * cosine; + + A = newA; B = newB; + C = newC; D = newD; + + if (rotationAngle >= 0) + { + rotationAngle += angle; + if (rotationAngle < 0) + rotationAngle -= ((int)(rotationAngle/360)-1)*360; + else if (rotationAngle >= 360) + rotationAngle -= ((int)(rotationAngle/360))*360; + } + else + rotationAngle = -1; +} + +- (void) scaleBy: (float)scale +{ + A *= scale; B *= scale; + C *= scale; D *= scale; +} + +- (void) scaleXBy: (float)scaleX yBy: (float)scaleY +{ + A *= scaleX; B *= scaleX; + C *= scaleY; D *= scaleY; +} + +- (void) set +{ +// PSsetmatrix(self); +[self subclassResponsibility: _cmd]; +} + +- (void) setTransformStruct: (NSAffineTransformStruct)val +{ + matrix = val; + rotationAngle = -1; // Needs recalculating +} + +- (NSBezierPath*) transformBezierPath: (NSBezierPath*)aPath +{ + [self notImplemented: _cmd]; + return nil; +} + +- (NSPoint) transformPoint: (NSPoint)point +{ + NSPoint new; + + new.x = A * point.x + C * point.y + TX; + new.y = B * point.x + D * point.y + TY; + + return new; +} + +- (NSSize) transformSize: (NSSize)size +{ + NSSize new; + + new.width = A * size.width + C * size.height; + if (new.width < 0) + new.width = - new.width; + new.height = B * size.width + D * size.height; + if (new.height < 0) + new.height = - new.height; + + return new; +} + +- (NSAffineTransformStruct) transformStruct +{ + return matrix; +} + +- (void) translateXBy: (float)tranX yBy: (float)tranY +{ + TX += tranX; + TY += tranY; +} + + ++ matrixFrom: (const float[6])_matrix +{ + NSAffineTransform *m = [[self alloc] autorelease]; + + [m setMatrix: _matrix]; + + return m; +} + +- (id) copyWithZone: (NSZone*)zone +{ + NSAffineTransform *new; + + new = (NSAffineTransform*)NSAllocateObject(isa, 0, zone); + new->matrix = matrix; + new->rotationAngle = rotationAngle; + return new; +} + +- (BOOL) isEqual: (id)anObject +{ + if ([anObject class] == isa) + { + NSAffineTransform *o = anObject; + + if (A == o->A && B == o->B && C == o->C + && D == o->D && TX == o->TX && TY == o->TY) + return YES; + } + return NO; +} + +- (void) scaleBy: (float)sx :(float)sy +{ + A *= sx; B *= sx; + C *= sy; D *= sy; +} + +- (void) scaleTo: (float)sx : (float)sy +{ + float angle = rotationAngle < 0 ? [self rotationAngle] : rotationAngle; + + A = sx; B = 0; + C = 0; D = sy; + if (rotationAngle) + { + [self rotateByDegrees: angle]; + rotationAngle = angle; + } +} + +- (void) translateToPoint: (NSPoint)point +{ + float newTX, newTY; + + newTX = point.x * A + point.y * C + TX; + newTY = point.x * B + point.y * D + TY; + TX = newTX; + TY = newTY; +} + +- (void) rotateByAngle: (float)angle +{ + [self rotateByDegrees: angle]; +} + +- (void) makeIdentityMatrix +{ + matrix = identityTransform; + rotationAngle = 0; +} + +- (void) setFrameOrigin: (NSPoint)point +{ + float dx = point.x - TX; + float dy = point.y - TY; + [self translateToPoint: NSMakePoint(dx, dy)]; +} + +- (void) setFrameRotation: (float)angle +{ + float newAngle; + + if (rotationAngle < 0) + [self rotationAngle]; + newAngle = angle - rotationAngle; + [self rotateByAngle: newAngle]; +} + +- (float) rotationAngle +{ + if (rotationAngle < 0) + { + rotationAngle = atan2(matrix.m21, matrix.m11); + rotationAngle *= 180.0 / M_PI; + } + return rotationAngle; +} + +- (void) concatenateWith: (NSAffineTransform*)other +{ + [self appendTransform: other]; +} + +- (void)inverse +{ + [self invert]; +} + +- (BOOL) isRotated +{ + if (rotationAngle == 0) + return NO; + if (rotationAngle < 0 && [self rotationAngle] == 0) + return NO; + return YES; +} + +- (void) boundingRectFor: (NSRect)rect result: (NSRect*)new +{ + float angle = (rotationAngle < 0) ? [self rotationAngle] : rotationAngle; + float angleRad = pi * angle / 180; + float angle90Rad = pi * (angle + 90) / 180; + float cosWidth, cosHeight, sinWidth, sinHeight; + /* Shortcuts of the usual rect values */ + float x = rect.origin.x; + float y = rect.origin.y; + float width = rect.size.width; + float height = rect.size.height; + + if (rotationAngle == 0) + { + *new = NSZeroRect; + return; + } + + cosWidth = cos(angleRad); + cosHeight = cos(angle90Rad); + sinWidth = sin(angleRad); + sinHeight = sin(angle90Rad); + + if (angle <= 90) + { + new->origin.x = x + height * cosHeight; + new->origin.y = y; + new->size.width = width * cosWidth - height * cosHeight; + new->size.height = width * sinWidth + height * sinHeight; + } + else if (angle <= 180) + { + new->origin.x = x + width * cosWidth + height * cosHeight; + new->origin.y = y + height * sinHeight; + new->size.width = -width * cosWidth - height * cosHeight; + new->size.height = width * sinWidth - height * sinHeight; + } + else if (angle <= 270) + { + new->origin.x = x + width * cosWidth; + new->origin.y = y + width * sinWidth + height * sinHeight; + new->size.width = -width * cosWidth + height * cosHeight; + new->size.height = -width * sinWidth - height * sinHeight; + } + else + { + new->origin.x = x; + new->origin.y = y; + new->size.width = width * cosWidth + height * cosHeight; + new->size.height = width * sinWidth + height * sinHeight; + } +} + +- (NSPoint) pointInMatrixSpace: (NSPoint)point +{ + NSPoint new; + + new.x = A * point.x + C * point.y + TX; + new.y = B * point.x + D * point.y + TY; + + return new; +} + +- (NSSize) sizeInMatrixSpace: (NSSize)size +{ + NSSize new; + + new.width = A * size.width + C * size.height; + if (new.width < 0) + new.width = - new.width; + new.height = B * size.width + D * size.height; + if (new.height < 0) + new.height = - new.height; + + return new; +} + +- (NSRect) rectInMatrixSpace: (NSRect)rect +{ + NSRect new; + + new.origin.x = A * rect.origin.x + C * rect.origin.y + TX; + new.size.width = A * rect.size.width + C * rect.size.height; + if (new.size.width < 0) + { + new.origin.x += new.size.width; + new.size.width *= -1; + } + + new.origin.y = B * rect.origin.x + D * rect.origin.y + TY; + new.size.height = B * rect.size.width + D * rect.size.height; + if (new.size.height < 0) + { + new.origin.y += new.size.height; + new.size.height *= -1; + } + + return new; +} + +- (NSString*) description +{ + return [NSString stringWithFormat: + @"NSAffineTransform ((%f, %f) (%f, %f) (%f, %f))", + A, B, C, D, TX, TY]; +} + +- (void) setMatrix: (const float[6])replace +{ + matrix.m11 = replace[0]; + matrix.m12 = replace[1]; + matrix.m21 = replace[2]; + matrix.m22 = replace[3]; + matrix.tx = replace[4]; + matrix.ty = replace[5]; +} + +- (void) getMatrix: (float[6])replace +{ + replace[0] = matrix.m11; + replace[1] = matrix.m12; + replace[2] = matrix.m21; + replace[3] = matrix.m22; + replace[4] = matrix.tx; + replace[5] = matrix.ty; +} + +@end /* NSAffineTransform */ + diff --git a/Source/NSCell.m b/Source/NSCell.m index 303e0aa48..b97d86407 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -43,7 +43,6 @@ #include #include #include -#include #include diff --git a/Source/NSScroller.m b/Source/NSScroller.m index 2b9373337..724fc0e8a 100644 --- a/Source/NSScroller.m +++ b/Source/NSScroller.m @@ -38,7 +38,6 @@ #include #include #include -#include #include #include diff --git a/Source/NSView.m b/Source/NSView.m index 947031a72..a2f690240 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -47,7 +47,7 @@ #include #include #include -#include +#include @implementation NSView @@ -56,9 +56,9 @@ // Class variables // static NSString *viewThreadKey = @"NSViewThreadKey"; -static PSMatrix *flip = nil; +static NSAffineTransform *flip = nil; -static void (*concatImp)(PSMatrix*, SEL, PSMatrix*) = 0; +static void (*concatImp)(NSAffineTransform*, SEL, NSAffineTransform*) = 0; static SEL concatSel = @selector(concatenateWith:); static void (*invalidateImp)(NSView*, SEL) = 0; @@ -71,16 +71,17 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); { if (self == [NSView class]) { - Class matrixClass = [PSMatrix class]; - float vals[6] = { 1, 0, 0, -1, 0, 1 }; + Class matrixClass = [NSAffineTransform class]; + NSAffineTransformStruct ats = { 1, 0, 0, -1, 0, 1 }; - concatImp = (void (*)(PSMatrix*, SEL, PSMatrix*)) + concatImp = (void (*)(NSAffineTransform*, SEL, NSAffineTransform*)) [matrixClass instanceMethodForSelector: concatSel]; invalidateImp = (void (*)(NSView*, SEL)) [self instanceMethodForSelector: invalidateSel]; - flip = [[matrixClass matrixFrom: vals] retain]; + flip = [matrixClass new]; + [flip setTransformStruct: ats]; NSDebugLog(@"Initialize NSView class\n"); [self setVersion: 1]; @@ -174,10 +175,10 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); bounds.origin = NSZeroPoint; // Set bounds rectangle bounds.size = frame.size; - frameMatrix = [PSMatrix new]; // Map fromsuperview to frame - boundsMatrix = [PSMatrix new]; // Map fromsuperview to bounds - matrixToWindow = [PSMatrix new]; // Map to window coordinates - matrixFromWindow = [PSMatrix new]; // Map from window coordinates + frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame + boundsMatrix = [NSAffineTransform new]; // Map fromsuperview to bounds + matrixToWindow = [NSAffineTransform new]; // Map to window coordinates + matrixFromWindow = [NSAffineTransform new]; // Map from window coordinates [frameMatrix setFrameOrigin: frame.origin]; sub_views = [NSMutableArray new]; @@ -630,7 +631,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); - (NSPoint) convertPoint: (NSPoint)aPoint fromView: (NSView*)aView { NSPoint new; - PSMatrix *matrix; + NSAffineTransform *matrix; if (!aView) aView = [window contentView]; @@ -653,7 +654,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); - (NSPoint) convertPoint: (NSPoint)aPoint toView: (NSView*)aView { NSPoint new; - PSMatrix *matrix; + NSAffineTransform *matrix; if (!aView) aView = [window contentView]; @@ -675,7 +676,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); - (NSRect) convertRect: (NSRect)aRect fromView: (NSView*)aView { - PSMatrix *matrix; + NSAffineTransform *matrix; NSRect r; if (!aView) @@ -703,7 +704,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); - (NSRect) convertRect: (NSRect)aRect toView: (NSView*)aView { - PSMatrix *matrix; + NSAffineTransform *matrix; NSRect r; if (!aView) @@ -732,7 +733,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); - (NSSize) convertSize: (NSSize)aSize fromView: (NSView*)aView { NSSize new; - PSMatrix *matrix; + NSAffineTransform *matrix; if (!aView) aView = [window contentView]; @@ -755,7 +756,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); - (NSSize) convertSize: (NSSize)aSize toView: (NSView*)aView { NSSize new; - PSMatrix *matrix; + NSAffineTransform *matrix; if (!aView) aView = [window contentView]; @@ -1826,7 +1827,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); * visible rectangle cache if necessary. * All coordinate transformations use this matrix. */ -- (PSMatrix*) _matrixFromWindow +- (NSAffineTransform*) _matrixFromWindow { if (coordinates_valid == NO) [self _rebuildCoordinates]; @@ -1840,7 +1841,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); * visible rectangle cache if necessary. * All coordinate transformations use this matrix. */ -- (PSMatrix*) _matrixToWindow +- (NSAffineTransform*) _matrixToWindow { if (coordinates_valid == NO) [self _rebuildCoordinates]; @@ -1874,14 +1875,14 @@ static SEL invalidateSel = @selector(_invalidateCoordinates); NSRect superviewsVisibleRect; BOOL wasFlipped = [super_view isFlipped]; float vals[6]; - PSMatrix *pMatrix = [super_view _matrixToWindow]; + NSAffineTransform *pMatrix = [super_view _matrixToWindow]; [pMatrix getMatrix: vals]; [matrixToWindow setMatrix: vals]; (*concatImp)(matrixToWindow, concatSel, frameMatrix); if ([self isFlipped] != wasFlipped) { - flip->matrix[5] = bounds.size.height; + flip->matrix.ty = bounds.size.height; (*concatImp)(matrixToWindow, concatSel, flip); } (*concatImp)(matrixToWindow, concatSel, boundsMatrix); diff --git a/Source/NSWindow.m b/Source/NSWindow.m index bde889ac7..fa43265a7 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -48,7 +48,6 @@ #include #include #include -#include