mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Optimisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3716 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d6da78443c
commit
320a9d10c4
3 changed files with 25 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Feb 16 5:30:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSView.m: Optimise coordinate conversion.
|
||||
* Headers/AppKit/PSMatrix.h: ditto
|
||||
|
||||
1999-02-15 Michael Hanni <mhanni@sprintmail.com>
|
||||
|
||||
* Source/NSBox.m Source/NSButtonCell.m Source/NSCell.m
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
@interface PSMatrix : NSObject <NSCopying>
|
||||
{
|
||||
@public
|
||||
float matrix[6];
|
||||
float rotationAngle;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@
|
|||
// Class variables
|
||||
//
|
||||
static NSString *viewThreadKey = @"NSViewThreadKey";
|
||||
static void (*concatImp)(PSMatrix*, SEL, PSMatrix*) = 0;
|
||||
static SEL concatSel = @selector(concatenateWith:);
|
||||
static PSMatrix *flip = nil;
|
||||
|
||||
//
|
||||
// Class methods
|
||||
|
@ -63,6 +66,13 @@ static NSString *viewThreadKey = @"NSViewThreadKey";
|
|||
{
|
||||
if (self == [NSView class])
|
||||
{
|
||||
Class matrixClass = [PSMatrix class];
|
||||
float vals[6] = { 1, 0, 0, -1, 0, 1 };
|
||||
|
||||
concatImp = (void (*)(PSMatrix*, SEL, PSMatrix*))
|
||||
[matrixClass instanceMethodForSelector: concatSel];
|
||||
flip = [[matrixClass matrixFrom: vals] retain];
|
||||
|
||||
NSDebugLog(@"Initialize NSView class\n");
|
||||
[self setVersion: 1];
|
||||
}
|
||||
|
@ -572,32 +582,30 @@ static NSString *viewThreadKey = @"NSViewThreadKey";
|
|||
|
||||
- (PSMatrix*) _concatenateMatricesInReverseOrderFromPath: (NSArray*)viewsPath
|
||||
{
|
||||
unsigned i = [viewsPath count];
|
||||
PSMatrix *matrix = [[PSMatrix new] autorelease];
|
||||
unsigned i = [viewsPath count];
|
||||
NSView *matrices[i];
|
||||
NSView *parent;
|
||||
BOOL wasFlipped;
|
||||
BOOL isFlipped;
|
||||
|
||||
if (i-- < 2)
|
||||
return matrix;
|
||||
parent = [viewsPath objectAtIndex: i];
|
||||
[viewsPath getObjects: matrices];
|
||||
parent = matrices[i];
|
||||
wasFlipped = [parent isFlipped];
|
||||
while (i-- > 0)
|
||||
{
|
||||
NSView *view = [viewsPath objectAtIndex: i];
|
||||
NSView *view = matrices[i];
|
||||
|
||||
[matrix concatenateWith: view->frameMatrix];
|
||||
(*concatImp)(matrix, concatSel, view->frameMatrix);
|
||||
isFlipped = [view isFlipped];
|
||||
if (isFlipped != wasFlipped)
|
||||
{
|
||||
PSMatrix *flip = nil;
|
||||
float vals[6] = { 1, 0, 0, -1, 0, 1 };
|
||||
|
||||
vals[5] = view->bounds.size.height;
|
||||
flip = [PSMatrix matrixFrom: vals];
|
||||
[matrix concatenateWith: flip];
|
||||
flip->matrix[5] = view->bounds.size.height;
|
||||
(*concatImp)(matrix, concatSel, flip);
|
||||
}
|
||||
[matrix concatenateWith: view->boundsMatrix];
|
||||
(*concatImp)(matrix, concatSel, view->boundsMatrix);
|
||||
parent = view;
|
||||
wasFlipped = isFlipped;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue