mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 07:01:22 +00:00
merged in changes from trunk to work with moved NSAffineTransform
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/themes@24134 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3825d42113
commit
f92292517e
7 changed files with 91 additions and 350 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,6 +1,22 @@
|
||||||
2006-11-17 Richard Frith-Macdoanld <rfm@gnu.org>
|
2006-11-19 Richard Frith-Macdoanld <rfm@gnu.org>
|
||||||
|
|
||||||
Sync with trunc at revision 24120.
|
* Merged in changes from trunk at revision 24133.
|
||||||
|
|
||||||
|
2006-11-19 Richard Frith-Macdoanld <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSAffineTransform.m:
|
||||||
|
* Headers/AppKit/NSAffineTransform.h:
|
||||||
|
Remove basic implementation (now in base for MacOS-X compatibility)
|
||||||
|
retaining gui specific methods and GNUstep extensions (to deprecate?)
|
||||||
|
* Source/NSImage.m:
|
||||||
|
* Source/NSStringDrawing.m:
|
||||||
|
* Source/NSView.m:
|
||||||
|
Update to use transformStruct accessor method rather than trying to
|
||||||
|
work with the affine transform ivars directly.
|
||||||
|
|
||||||
|
2006-11-18 Richard Frith-Macdoanld <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSScrollView.m: Adjust corner view when scroller is on right.
|
||||||
|
|
||||||
2006-11-17 Richard Frith-Macdoanld <rfm@gnu.org>
|
2006-11-17 Richard Frith-Macdoanld <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
Author: Ovidiu Predescu <ovidiu@net-community.com>
|
Author: Ovidiu Predescu <ovidiu@net-community.com>
|
||||||
Date: August 1997
|
Date: August 1997
|
||||||
Rewrite for macOS-X compatibility: Richard Frith-Macdonald, 1999
|
Rewrite for MacOS-X compatibility: Richard Frith-Macdonald, 1999
|
||||||
|
|
||||||
This file is part of the GNUstep GUI Library.
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
@ -29,43 +29,15 @@
|
||||||
#define _GNUstep_H_NSAffineTransform
|
#define _GNUstep_H_NSAffineTransform
|
||||||
#import <GNUstepBase/GSVersionMacros.h>
|
#import <GNUstepBase/GSVersionMacros.h>
|
||||||
|
|
||||||
#include <Foundation/NSObject.h>
|
#import <Foundation/NSAffineTransform.h>
|
||||||
#include <Foundation/NSGeometry.h>
|
|
||||||
|
|
||||||
@class NSBezierPath;
|
@class NSBezierPath;
|
||||||
|
|
||||||
typedef struct {
|
@interface NSAffineTransform (GUIAdditions)
|
||||||
float m11;
|
|
||||||
float m12;
|
|
||||||
float m21;
|
|
||||||
float m22;
|
|
||||||
float tX;
|
|
||||||
float tY;
|
|
||||||
} NSAffineTransformStruct;
|
|
||||||
|
|
||||||
@interface NSAffineTransform : NSObject <NSCopying, NSCoding>
|
|
||||||
{
|
|
||||||
@public
|
|
||||||
NSAffineTransformStruct matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSAffineTransform*) transform;
|
|
||||||
- (void) appendTransform: (NSAffineTransform*)aTransform;
|
|
||||||
- (void) concat;
|
- (void) concat;
|
||||||
- (id) initWithTransform: (NSAffineTransform*)aTransform;
|
|
||||||
- (void) invert;
|
|
||||||
- (void) prependTransform: (NSAffineTransform*)aTransform;
|
|
||||||
- (void) rotateByDegrees: (float)angle;
|
|
||||||
- (void) rotateByRadians: (float)angleRad;
|
|
||||||
- (void) scaleBy: (float)scale;
|
|
||||||
- (void) scaleXBy: (float)scaleX yBy: (float)scaleY;
|
|
||||||
- (void) set;
|
- (void) set;
|
||||||
- (void) setTransformStruct: (NSAffineTransformStruct)val;
|
|
||||||
- (NSBezierPath*) transformBezierPath: (NSBezierPath*)aPath;
|
- (NSBezierPath*) transformBezierPath: (NSBezierPath*)aPath;
|
||||||
- (NSPoint) transformPoint: (NSPoint)aPoint;
|
|
||||||
- (NSSize) transformSize: (NSSize)aSize;
|
|
||||||
- (NSAffineTransformStruct) transformStruct;
|
|
||||||
- (void) translateXBy: (float)tranX yBy: (float)tranY;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
|
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
|
||||||
|
@ -77,7 +49,7 @@ typedef struct {
|
||||||
- (void) setFrameOrigin: (NSPoint)point;
|
- (void) setFrameOrigin: (NSPoint)point;
|
||||||
- (void) setFrameRotation: (float)angle;
|
- (void) setFrameRotation: (float)angle;
|
||||||
|
|
||||||
/* Old Apple name for -invert */
|
/* Deprecated: use -invert */
|
||||||
- (void) inverse;
|
- (void) inverse;
|
||||||
|
|
||||||
- (BOOL) isRotated;
|
- (BOOL) isRotated;
|
||||||
|
@ -93,7 +65,9 @@ typedef struct {
|
||||||
- (NSSize) sizeInMatrixSpace: (NSSize)size;
|
- (NSSize) sizeInMatrixSpace: (NSSize)size;
|
||||||
- (NSRect) rectInMatrixSpace: (NSRect)rect;
|
- (NSRect) rectInMatrixSpace: (NSRect)rect;
|
||||||
|
|
||||||
|
/* Deprecated: use -setTransformStruct: */
|
||||||
- (void) setMatrix: (const float[6])replace;
|
- (void) setMatrix: (const float[6])replace;
|
||||||
|
/* Deprecated: use -transformStruct */
|
||||||
- (void) getMatrix: (float[6])replace;
|
- (void) getMatrix: (float[6])replace;
|
||||||
|
|
||||||
- (void) takeMatrixFromTransform: (NSAffineTransform *)aTransform;
|
- (void) takeMatrixFromTransform: (NSAffineTransform *)aTransform;
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -39,7 +40,13 @@
|
||||||
#include "AppKit/NSBezierPath.h"
|
#include "AppKit/NSBezierPath.h"
|
||||||
#include "AppKit/PSOperators.h"
|
#include "AppKit/PSOperators.h"
|
||||||
|
|
||||||
|
typedef struct internal
|
||||||
|
{
|
||||||
|
@defs(NSAffineTransform)
|
||||||
|
} *iptr;
|
||||||
|
|
||||||
/* Private definitions */
|
/* Private definitions */
|
||||||
|
#define matrix (((iptr)self)->_matrix)
|
||||||
#define A matrix.m11
|
#define A matrix.m11
|
||||||
#define B matrix.m12
|
#define B matrix.m12
|
||||||
#define C matrix.m21
|
#define C matrix.m21
|
||||||
|
@ -71,46 +78,11 @@ matrix_multiply (NSAffineTransformStruct MA, NSAffineTransformStruct MB)
|
||||||
return MC;
|
return MC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation NSAffineTransform
|
|
||||||
|
|
||||||
static NSAffineTransformStruct identityTransform = {
|
static NSAffineTransformStruct identityTransform = {
|
||||||
1.0, 0.0, 0.0, 1.0, 0.0, 0.0
|
1.0, 0.0, 0.0, 1.0, 0.0, 0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
@implementation NSAffineTransform (GUIAdditions)
|
||||||
* Return an autoreleased instance of this class.
|
|
||||||
*/
|
|
||||||
+ (NSAffineTransform*) transform
|
|
||||||
{
|
|
||||||
NSAffineTransform *t;
|
|
||||||
|
|
||||||
t = (NSAffineTransform*)NSAllocateObject(self, 0, NSDefaultMallocZone());
|
|
||||||
t->matrix = identityTransform;
|
|
||||||
return AUTORELEASE(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an autoreleased instance of this class.
|
|
||||||
*/
|
|
||||||
+ (id) new
|
|
||||||
{
|
|
||||||
NSAffineTransform *t;
|
|
||||||
|
|
||||||
t = (NSAffineTransform*)NSAllocateObject(self, 0, NSDefaultMallocZone());
|
|
||||||
t->matrix = identityTransform;
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Appends the transform matrix to the receiver. This is done by performing a
|
|
||||||
* matrix multiplication of the receiver with aTransform so that aTransform
|
|
||||||
* is the first transform applied to the user coordinate. The new
|
|
||||||
* matrix then replaces the receiver's matrix.
|
|
||||||
*/
|
|
||||||
- (void) appendTransform: (NSAffineTransform*)aTransform
|
|
||||||
{
|
|
||||||
matrix = matrix_multiply(matrix, aTransform->matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concatenates the receiver's matrix with the one in the current graphics
|
* Concatenates the receiver's matrix with the one in the current graphics
|
||||||
|
@ -128,142 +100,18 @@ static NSAffineTransformStruct identityTransform = {
|
||||||
PSconcat(m);
|
PSconcat(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the transformation matrix instance to the identity matrix.
|
|
||||||
* The identity matrix transforms a point to itself.
|
|
||||||
*/
|
|
||||||
- (id) init
|
|
||||||
{
|
|
||||||
matrix = identityTransform;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the receiever's instance with the instance represented
|
|
||||||
* by aTransform.
|
|
||||||
*/
|
|
||||||
- (id) initWithTransform: (NSAffineTransform*)aTransform
|
|
||||||
{
|
|
||||||
matrix = aTransform->matrix;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculates the inverse of the receiver's matrix and replaces the
|
|
||||||
* receiever's matrix with it.
|
|
||||||
*/
|
|
||||||
- (void) invert
|
|
||||||
{
|
|
||||||
float newA, newB, newC, newD, newTX, newTY;
|
|
||||||
float det;
|
|
||||||
|
|
||||||
det = A * D - B * C;
|
|
||||||
if (det == 0)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
NSDebugLLog(@"NSAffineTransform",
|
|
||||||
@"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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepends the transform matrix to the receiver. This is done by performing a
|
|
||||||
* matrix multiplication of the receiver with aTransform so that aTransform
|
|
||||||
* is the last transform applied to the user coordinate. The new
|
|
||||||
* matrix then replaces the receiver's matrix.
|
|
||||||
*/
|
|
||||||
- (void) prependTransform: (NSAffineTransform*)aTransform
|
|
||||||
{
|
|
||||||
matrix = matrix_multiply(aTransform->matrix, matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the rotation specified by angle in degrees. Points transformed
|
|
||||||
* with the transformation matrix of the receiver are rotated counter-clockwise
|
|
||||||
* by the number of degrees specified by angle.
|
|
||||||
*/
|
|
||||||
- (void) rotateByDegrees: (float)angle
|
|
||||||
{
|
|
||||||
[self rotateByRadians: pi * angle / 180];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the rotation specified by angle in radians. Points transformed
|
|
||||||
* with the transformation matrix of the receiver are rotated counter-clockwise
|
|
||||||
* by the number of radians specified by angle.
|
|
||||||
*/
|
|
||||||
- (void) rotateByRadians: (float)angleRad
|
|
||||||
{
|
|
||||||
float sine = sin (angleRad);
|
|
||||||
float cosine = cos (angleRad);
|
|
||||||
NSAffineTransformStruct rotm;
|
|
||||||
rotm.m11 = cosine; rotm.m12 = sine; rotm.m21 = -sine; rotm.m22 = cosine;
|
|
||||||
rotm.tX = rotm.tY = 0;
|
|
||||||
matrix = matrix_multiply(rotm, matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scales the transformation matrix of the reciever by the factor specified
|
|
||||||
* by scale.
|
|
||||||
*/
|
|
||||||
- (void) scaleBy: (float)scale
|
|
||||||
{
|
|
||||||
NSAffineTransformStruct scam = identityTransform;
|
|
||||||
scam.m11 = scale; scam.m22 = scale;
|
|
||||||
matrix = matrix_multiply(scam, matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scales the X axis of the receiver's transformation matrix
|
|
||||||
* by scaleX and the Y axis of the transformation matrix by scaleY.
|
|
||||||
*/
|
|
||||||
- (void) scaleXBy: (float)scaleX yBy: (float)scaleY
|
|
||||||
{
|
|
||||||
NSAffineTransformStruct scam = identityTransform;
|
|
||||||
scam.m11 = scaleX; scam.m22 = scaleY;
|
|
||||||
matrix = matrix_multiply(scam, matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the currently active graphics context's transformation
|
* Get the currently active graphics context's transformation
|
||||||
* matrix and set it into the receiver.
|
* matrix and set it into the receiver.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
- (void) set
|
- (void) set
|
||||||
{
|
{
|
||||||
GSSetCTM(GSCurrentContext(), self);
|
GSSetCTM(GSCurrentContext(), self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>Applies the receiver's transformation matrix to each point in
|
||||||
* Sets the structure which represents the matrix of the reciever.
|
|
||||||
* The struct is of the form:</p>
|
|
||||||
* <p>{m11, m12, m21, m22, tX, tY}</p>
|
|
||||||
*/
|
|
||||||
- (void) setTransformStruct: (NSAffineTransformStruct)val
|
|
||||||
{
|
|
||||||
matrix = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Applies the receiver's transformation matrix to each point in
|
|
||||||
* the bezier path, then returns the result. The original bezier
|
* the bezier path, then returns the result. The original bezier
|
||||||
* path is not modified.
|
* path is not modified.
|
||||||
* </p>
|
* </p>
|
||||||
|
@ -276,104 +124,7 @@ static NSAffineTransformStruct identityTransform = {
|
||||||
return AUTORELEASE(path);
|
return AUTORELEASE(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@end /* NSAffineTransform (GUIAdditions) */
|
||||||
* Transforms a single point based on the transformation matrix.
|
|
||||||
* Returns the resulting point.
|
|
||||||
*/
|
|
||||||
- (NSPoint) transformPoint: (NSPoint)aPoint
|
|
||||||
{
|
|
||||||
NSPoint new;
|
|
||||||
|
|
||||||
new.x = A * aPoint.x + C * aPoint.y + TX;
|
|
||||||
new.y = B * aPoint.x + D * aPoint.y + TY;
|
|
||||||
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms the NSSize represented by aSize using the reciever's
|
|
||||||
* transformation matrix. Returns the resulting NSSize.
|
|
||||||
*/
|
|
||||||
- (NSSize) transformSize: (NSSize)aSize
|
|
||||||
{
|
|
||||||
NSSize new;
|
|
||||||
|
|
||||||
new.width = A * aSize.width + C * aSize.height;
|
|
||||||
if (new.width < 0)
|
|
||||||
new.width = - new.width;
|
|
||||||
new.height = B * aSize.width + D * aSize.height;
|
|
||||||
if (new.height < 0)
|
|
||||||
new.height = - new.height;
|
|
||||||
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Returns the <code>NSAffineTransformStruct</code> structure
|
|
||||||
* which represents the matrix of the reciever.
|
|
||||||
* The struct is of the form:</p>
|
|
||||||
* <p>{m11, m12, m21, m22, tX, tY}</p>
|
|
||||||
*/
|
|
||||||
- (NSAffineTransformStruct) transformStruct
|
|
||||||
{
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the translation specified by tranX and tranY to the receiver's matrix.
|
|
||||||
* Points transformed by the reciever's matrix after this operation will
|
|
||||||
* be shifted in position based on the specified translation.
|
|
||||||
*/
|
|
||||||
- (void) translateXBy: (float)tranX yBy: (float)tranY
|
|
||||||
{
|
|
||||||
NSAffineTransformStruct tranm = identityTransform;
|
|
||||||
tranm.tX = tranX;
|
|
||||||
tranm.tY = tranY;
|
|
||||||
matrix = matrix_multiply(tranm, matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) copyWithZone: (NSZone*)zone
|
|
||||||
{
|
|
||||||
return NSCopyObject(self, 0, zone);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (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;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aCoder
|
|
||||||
{
|
|
||||||
float replace[6];
|
|
||||||
|
|
||||||
[aCoder decodeArrayOfObjCType: @encode(float)
|
|
||||||
count: 6
|
|
||||||
at: replace];
|
|
||||||
[self setMatrix: replace];
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
|
||||||
{
|
|
||||||
float replace[6];
|
|
||||||
|
|
||||||
[self getMatrix: replace];
|
|
||||||
[aCoder encodeArrayOfObjCType: @encode(float)
|
|
||||||
count: 6
|
|
||||||
at: replace];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end /* NSAffineTransform */
|
|
||||||
|
|
||||||
@implementation NSAffineTransform (GNUstep)
|
@implementation NSAffineTransform (GNUstep)
|
||||||
|
|
||||||
|
@ -571,13 +322,6 @@ static NSAffineTransformStruct identityTransform = {
|
||||||
return new;
|
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
|
- (void) setMatrix: (const float[6])replace
|
||||||
{
|
{
|
||||||
matrix.m11 = replace[0];
|
matrix.m11 = replace[0];
|
||||||
|
@ -600,12 +344,7 @@ static NSAffineTransformStruct identityTransform = {
|
||||||
|
|
||||||
- (void) takeMatrixFromTransform: (NSAffineTransform *)aTransform
|
- (void) takeMatrixFromTransform: (NSAffineTransform *)aTransform
|
||||||
{
|
{
|
||||||
matrix.m11 = aTransform->matrix.m11;
|
matrix = [aTransform transformStruct];
|
||||||
matrix.m12 = aTransform->matrix.m12;
|
|
||||||
matrix.m21 = aTransform->matrix.m21;
|
|
||||||
matrix.m22 = aTransform->matrix.m22;
|
|
||||||
matrix.tX = aTransform->matrix.tX;
|
|
||||||
matrix.tY = aTransform->matrix.tY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1046,17 +1046,20 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
|
|
||||||
/* If the effective transform is the identity transform and there's
|
/* If the effective transform is the identity transform and there's
|
||||||
no dissolve, we can composite from our cache. */
|
no dissolve, we can composite from our cache. */
|
||||||
if (delta == 1.0
|
|
||||||
&& fabs(transform->matrix.m11 - 1.0) < 0.01
|
if (delta == 1.0)
|
||||||
&& fabs(transform->matrix.m12) < 0.01
|
{
|
||||||
&& fabs(transform->matrix.m21) < 0.01
|
NSAffineTransformStruct ts = [transform transformStruct];
|
||||||
&& fabs(transform->matrix.m22 - 1.0) < 0.01)
|
|
||||||
|
if (fabs(ts.m11 - 1.0) < 0.01 && fabs(ts.m12) < 0.01
|
||||||
|
&& fabs(ts.m21) < 0.01 && fabs(ts.m22 - 1.0) < 0.01)
|
||||||
{
|
{
|
||||||
[self compositeToPoint: dstRect.origin
|
[self compositeToPoint: dstRect.origin
|
||||||
fromRect: srcRect
|
fromRect: srcRect
|
||||||
operation: op];
|
operation: op];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We can't composite or dissolve directly from the image reps, so we
|
/* We can't composite or dissolve directly from the image reps, so we
|
||||||
create a temporary off-screen window large enough to hold the
|
create a temporary off-screen window large enough to hold the
|
||||||
|
@ -1078,6 +1081,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
NSCachedImageRep *cache;
|
NSCachedImageRep *cache;
|
||||||
|
NSAffineTransformStruct ts;
|
||||||
NSSize s;
|
NSSize s;
|
||||||
NSPoint p;
|
NSPoint p;
|
||||||
double x0, y0, x1, y1, w, h;
|
double x0, y0, x1, y1, w, h;
|
||||||
|
@ -1134,8 +1138,10 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
|
|
||||||
/* Set up the effective transform. We also save a gState with this
|
/* Set up the effective transform. We also save a gState with this
|
||||||
transform to make it easier to do the final composite. */
|
transform to make it easier to do the final composite. */
|
||||||
transform->matrix.tX = p.x;
|
ts = [transform transformStruct];
|
||||||
transform->matrix.tY = p.y;
|
ts.tX = p.x;
|
||||||
|
ts.tY = p.y;
|
||||||
|
[transform setTransformStruct: ts];
|
||||||
[ctxt GSSetCTM: transform];
|
[ctxt GSSetCTM: transform];
|
||||||
|
|
||||||
gState = [ctxt GSDefineGState];
|
gState = [ctxt GSDefineGState];
|
||||||
|
|
|
@ -832,6 +832,15 @@ static float scrollerWidth;
|
||||||
NSSize border = _sizeForBorderType(_borderType);
|
NSSize border = _sizeForBorderType(_borderType);
|
||||||
NSRectEdge bottomEdge, topEdge;
|
NSRectEdge bottomEdge, topEdge;
|
||||||
float headerViewHeight = 0;
|
float headerViewHeight = 0;
|
||||||
|
NSRectEdge verticalScrollerEdge = NSMinXEdge;
|
||||||
|
NSInterfaceStyle style;
|
||||||
|
|
||||||
|
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
|
||||||
|
if (style == NSMacintoshInterfaceStyle
|
||||||
|
|| style == NSWindows95InterfaceStyle)
|
||||||
|
{
|
||||||
|
verticalScrollerEdge = NSMaxXEdge;
|
||||||
|
}
|
||||||
|
|
||||||
/* Determine edge positions. */
|
/* Determine edge positions. */
|
||||||
if (_rFlags.flipped_view)
|
if (_rFlags.flipped_view)
|
||||||
|
@ -880,24 +889,15 @@ static float scrollerWidth;
|
||||||
if (_hasVertScroller)
|
if (_hasVertScroller)
|
||||||
{
|
{
|
||||||
NSRect vertScrollerRect;
|
NSRect vertScrollerRect;
|
||||||
NSRectEdge edge = NSMinXEdge;
|
|
||||||
NSInterfaceStyle style;
|
|
||||||
|
|
||||||
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
|
|
||||||
if (style == NSMacintoshInterfaceStyle
|
|
||||||
|| style == NSWindows95InterfaceStyle)
|
|
||||||
{
|
|
||||||
edge = NSMaxXEdge;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSDivideRect (contentRect, &vertScrollerRect, &contentRect,
|
NSDivideRect (contentRect, &vertScrollerRect, &contentRect,
|
||||||
scrollerWidth, edge);
|
scrollerWidth, verticalScrollerEdge);
|
||||||
|
|
||||||
[_vertScroller setFrame: vertScrollerRect];
|
[_vertScroller setFrame: vertScrollerRect];
|
||||||
|
|
||||||
/* Substract 1 for the line that separates the vertical scroller
|
/* Substract 1 for the line that separates the vertical scroller
|
||||||
* from the clip view (and eventually the horizontal scroller). */
|
* from the clip view (and eventually the horizontal scroller). */
|
||||||
NSDivideRect (contentRect, NULL, &contentRect, 1, edge);
|
NSDivideRect (contentRect, NULL, &contentRect, 1, verticalScrollerEdge);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare the horizontal scroller. */
|
/* Prepare the horizontal scroller. */
|
||||||
|
@ -930,7 +930,13 @@ static float scrollerWidth;
|
||||||
/* Now place the corner view. */
|
/* Now place the corner view. */
|
||||||
if (_hasCornerView)
|
if (_hasCornerView)
|
||||||
{
|
{
|
||||||
[_cornerView setFrameOrigin: headerRect.origin];
|
NSPoint p = headerRect.origin;
|
||||||
|
|
||||||
|
if (verticalScrollerEdge == NSMaxXEdge)
|
||||||
|
{
|
||||||
|
p.x += contentRect.size.width;
|
||||||
|
}
|
||||||
|
[_cornerView setFrameOrigin: p];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now place the rulers. */
|
/* Now place the rulers. */
|
||||||
|
@ -1040,12 +1046,12 @@ static float scrollerWidth;
|
||||||
return [_contentView backgroundColor];
|
return [_contentView backgroundColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setDrawsBackground:(BOOL)flag
|
- (void) setDrawsBackground: (BOOL)flag
|
||||||
{
|
{
|
||||||
[_contentView setDrawsBackground: flag];
|
[_contentView setDrawsBackground: flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)drawsBackground
|
- (BOOL) drawsBackground
|
||||||
{
|
{
|
||||||
return [_contentView drawsBackground];
|
return [_contentView drawsBackground];
|
||||||
}
|
}
|
||||||
|
@ -1454,6 +1460,7 @@ static float scrollerWidth;
|
||||||
BOOL hadHeaderView = _hasHeaderView;
|
BOOL hadHeaderView = _hasHeaderView;
|
||||||
BOOL hadCornerView = _hasCornerView;
|
BOOL hadCornerView = _hasCornerView;
|
||||||
NSView *aView = nil;
|
NSView *aView = nil;
|
||||||
|
|
||||||
_hasHeaderView = ([[self documentView]
|
_hasHeaderView = ([[self documentView]
|
||||||
respondsToSelector: @selector(headerView)]
|
respondsToSelector: @selector(headerView)]
|
||||||
&& (aView=[(NSTableView *)[self documentView] headerView]));
|
&& (aView=[(NSTableView *)[self documentView] headerView]));
|
||||||
|
@ -1484,7 +1491,7 @@ static float scrollerWidth;
|
||||||
{
|
{
|
||||||
if (hadCornerView == NO)
|
if (hadCornerView == NO)
|
||||||
{
|
{
|
||||||
[self addSubview:aView];
|
[self addSubview: aView];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -352,9 +352,9 @@ static int use_screen_fonts(void)
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
NSAffineTransform *ctm = GSCurrentCTM(ctxt);
|
NSAffineTransform *ctm = GSCurrentCTM(ctxt);
|
||||||
|
NSAffineTransformStruct ts = [ctm transformStruct];
|
||||||
|
|
||||||
if (ctm->matrix.m11 != 1.0 || ctm->matrix.m12 != 0.0 ||
|
if (ts.m11 != 1.0 || ts.m12 != 0.0 || ts.m21 != 0.0 || fabs(ts.m22) != 1.0)
|
||||||
ctm->matrix.m21 != 0.0 || fabs(ctm->matrix.m22) != 1.0)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,16 +306,12 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
NSRect superviewsVisibleRect;
|
NSRect superviewsVisibleRect;
|
||||||
BOOL wasFlipped = _super_view->_rFlags.flipped_view;
|
BOOL wasFlipped = _super_view->_rFlags.flipped_view;
|
||||||
NSAffineTransform *pMatrix = [_super_view _matrixToWindow];
|
NSAffineTransform *pMatrix = [_super_view _matrixToWindow];
|
||||||
NSAffineTransform *tMatrix = nil;
|
NSAffineTransformStruct ts = [pMatrix transformStruct];
|
||||||
|
|
||||||
[_matrixToWindow takeMatrixFromTransform: pMatrix];
|
|
||||||
|
|
||||||
/* prepend translation */
|
/* prepend translation */
|
||||||
tMatrix = _matrixToWindow;
|
ts.tX = NSMinX(_frame) * ts.m11 + NSMinY(_frame) * ts.m21 + ts.tX;
|
||||||
tMatrix->matrix.tX = NSMinX(_frame) * tMatrix->matrix.m11 +
|
ts.tY = NSMinX(_frame) * ts.m12 + NSMinY(_frame) * ts.m22 + ts.tY;
|
||||||
NSMinY(_frame) * tMatrix->matrix.m21 + tMatrix->matrix.tX;
|
[_matrixToWindow setTransformStruct: ts];
|
||||||
tMatrix->matrix.tY = NSMinX(_frame) * tMatrix->matrix.m12 +
|
|
||||||
NSMinY(_frame) * tMatrix->matrix.m22 + tMatrix->matrix.tY;
|
|
||||||
|
|
||||||
/* prepend rotation */
|
/* prepend rotation */
|
||||||
if (_frameMatrix != nil)
|
if (_frameMatrix != nil)
|
||||||
|
@ -330,11 +326,14 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
* exactly overlays the original. To do that, we must translate
|
* exactly overlays the original. To do that, we must translate
|
||||||
* the origin by the height of the view.
|
* the origin by the height of the view.
|
||||||
*/
|
*/
|
||||||
flip->matrix.tY = _frame.size.height;
|
ts = [flip transformStruct];
|
||||||
|
ts.tY = _frame.size.height;
|
||||||
|
[flip setTransformStruct: ts];
|
||||||
(*preImp)(_matrixToWindow, preSel, flip);
|
(*preImp)(_matrixToWindow, preSel, flip);
|
||||||
}
|
}
|
||||||
(*preImp)(_matrixToWindow, preSel, _boundsMatrix);
|
(*preImp)(_matrixToWindow, preSel, _boundsMatrix);
|
||||||
[_matrixFromWindow takeMatrixFromTransform: _matrixToWindow];
|
ts = [_matrixToWindow transformStruct];
|
||||||
|
[_matrixFromWindow setTransformStruct: ts];
|
||||||
[_matrixFromWindow invert];
|
[_matrixFromWindow invert];
|
||||||
|
|
||||||
superviewsVisibleRect = [self convertRect: [_super_view visibleRect]
|
superviewsVisibleRect = [self convertRect: [_super_view visibleRect]
|
||||||
|
|
Loading…
Reference in a new issue