mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:30:48 +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
233ecebddd
commit
c33366d4d0
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>
|
1999-02-15 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
* Source/NSBox.m Source/NSButtonCell.m Source/NSCell.m
|
* Source/NSBox.m Source/NSButtonCell.m Source/NSCell.m
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
@interface PSMatrix : NSObject <NSCopying>
|
@interface PSMatrix : NSObject <NSCopying>
|
||||||
{
|
{
|
||||||
|
@public
|
||||||
float matrix[6];
|
float matrix[6];
|
||||||
float rotationAngle;
|
float rotationAngle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,9 @@
|
||||||
// Class variables
|
// Class variables
|
||||||
//
|
//
|
||||||
static NSString *viewThreadKey = @"NSViewThreadKey";
|
static NSString *viewThreadKey = @"NSViewThreadKey";
|
||||||
|
static void (*concatImp)(PSMatrix*, SEL, PSMatrix*) = 0;
|
||||||
|
static SEL concatSel = @selector(concatenateWith:);
|
||||||
|
static PSMatrix *flip = nil;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Class methods
|
// Class methods
|
||||||
|
@ -63,6 +66,13 @@ static NSString *viewThreadKey = @"NSViewThreadKey";
|
||||||
{
|
{
|
||||||
if (self == [NSView class])
|
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");
|
NSDebugLog(@"Initialize NSView class\n");
|
||||||
[self setVersion: 1];
|
[self setVersion: 1];
|
||||||
}
|
}
|
||||||
|
@ -572,32 +582,30 @@ static NSString *viewThreadKey = @"NSViewThreadKey";
|
||||||
|
|
||||||
- (PSMatrix*) _concatenateMatricesInReverseOrderFromPath: (NSArray*)viewsPath
|
- (PSMatrix*) _concatenateMatricesInReverseOrderFromPath: (NSArray*)viewsPath
|
||||||
{
|
{
|
||||||
unsigned i = [viewsPath count];
|
|
||||||
PSMatrix *matrix = [[PSMatrix new] autorelease];
|
PSMatrix *matrix = [[PSMatrix new] autorelease];
|
||||||
|
unsigned i = [viewsPath count];
|
||||||
|
NSView *matrices[i];
|
||||||
NSView *parent;
|
NSView *parent;
|
||||||
BOOL wasFlipped;
|
BOOL wasFlipped;
|
||||||
BOOL isFlipped;
|
BOOL isFlipped;
|
||||||
|
|
||||||
if (i-- < 2)
|
if (i-- < 2)
|
||||||
return matrix;
|
return matrix;
|
||||||
parent = [viewsPath objectAtIndex: i];
|
[viewsPath getObjects: matrices];
|
||||||
|
parent = matrices[i];
|
||||||
wasFlipped = [parent isFlipped];
|
wasFlipped = [parent isFlipped];
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
NSView *view = [viewsPath objectAtIndex: i];
|
NSView *view = matrices[i];
|
||||||
|
|
||||||
[matrix concatenateWith: view->frameMatrix];
|
(*concatImp)(matrix, concatSel, view->frameMatrix);
|
||||||
isFlipped = [view isFlipped];
|
isFlipped = [view isFlipped];
|
||||||
if (isFlipped != wasFlipped)
|
if (isFlipped != wasFlipped)
|
||||||
{
|
{
|
||||||
PSMatrix *flip = nil;
|
flip->matrix[5] = view->bounds.size.height;
|
||||||
float vals[6] = { 1, 0, 0, -1, 0, 1 };
|
(*concatImp)(matrix, concatSel, flip);
|
||||||
|
|
||||||
vals[5] = view->bounds.size.height;
|
|
||||||
flip = [PSMatrix matrixFrom: vals];
|
|
||||||
[matrix concatenateWith: flip];
|
|
||||||
}
|
}
|
||||||
[matrix concatenateWith: view->boundsMatrix];
|
(*concatImp)(matrix, concatSel, view->boundsMatrix);
|
||||||
parent = view;
|
parent = view;
|
||||||
wasFlipped = isFlipped;
|
wasFlipped = isFlipped;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue