mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
Replace obsolte NSAffinetransform methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@24926 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
680ea7befd
commit
1c702a4308
9 changed files with 72 additions and 49 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2007-03-23 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/art/ReadRect.m,
|
||||
* Source/art/composite.m,
|
||||
* Source/art/shfill.m,
|
||||
* Source/cairo/CairoGState.m,
|
||||
* Source/gsc/GSGState.m,
|
||||
* Source/winlib/WIN32GState.m,
|
||||
* Source/xlib/XGGState.m: Replace calls to the now deprecated
|
||||
methods on NSAffineTransform with correct ones.
|
||||
|
||||
2007-03-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/art/ARTGState.h: Declare internal methods.
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
/* Get the bounding rect in pixel coordinates. */
|
||||
p = r.origin;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
x0 = floor(p.x); x1 = ceil(p.x);
|
||||
y0 = floor(p.y); y1 = ceil(p.y);
|
||||
|
||||
|
@ -58,15 +58,15 @@
|
|||
if (ceil(p.y)>y1) y1=ceil(p.y); } while (0)
|
||||
|
||||
p = r.origin; p.x += r.size.width;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
CHECK;
|
||||
|
||||
p = r.origin; p.x += r.size.width; p.y += r.size.height;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
CHECK;
|
||||
|
||||
p = r.origin; p.y += r.size.height;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
CHECK;
|
||||
#undef CHECK
|
||||
|
||||
|
|
|
@ -269,16 +269,16 @@ static void _rect_setup(rect_trace_t *t, NSRect r, int cx0, int cx1,
|
|||
t->cx1 = cx1;
|
||||
|
||||
p = r.origin;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
fx[0] = p.x; fy[0] = p.y;
|
||||
p = r.origin; p.x += r.size.width;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
fx[1] = p.x; fy[1] = p.y;
|
||||
p = r.origin; p.x += r.size.width; p.y += r.size.height;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
fx[2] = p.x; fy[2] = p.y;
|
||||
p = r.origin; p.y += r.size.height;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
fx[3] = p.x; fy[3] = p.y;
|
||||
|
||||
if (fabs(fx[0] - floor(fx[0] + .5)) < 0.001) fx[0] = floor(fx[0] + .5);
|
||||
|
@ -492,10 +492,10 @@ static BOOL _rect_advance(rect_trace_t *t, int *x0, int *x1)
|
|||
cx1 = clip_x1;
|
||||
cy1 = clip_y1;
|
||||
|
||||
sp = [ags->ctm pointInMatrixSpace: aRect.origin];
|
||||
sp = [ags->ctm transformPoint: aRect.origin];
|
||||
sp.x = floor(sp.x - ags->offset.x);
|
||||
sp.y = floor(ags->offset.y - sp.y);
|
||||
dp = [ctm pointInMatrixSpace: aPoint];
|
||||
dp = [ctm transformPoint: aPoint];
|
||||
dp.x = floor(dp.x - offset.x);
|
||||
dp.y = floor(offset.y - dp.y);
|
||||
|
||||
|
@ -874,10 +874,10 @@ static BOOL _rect_advance(rect_trace_t *t, int *x0, int *x1)
|
|||
cx1 = clip_x1;
|
||||
cy1 = clip_y1;
|
||||
|
||||
sp = [ags->ctm pointInMatrixSpace: aRect.origin];
|
||||
sp = [ags->ctm transformPoint: aRect.origin];
|
||||
sp.x = floor(sp.x - ags->offset.x);
|
||||
sp.y = floor(ags->offset.y - sp.y);
|
||||
dp = [ctm pointInMatrixSpace: aPoint];
|
||||
dp = [ctm transformPoint: aPoint];
|
||||
dp.x = floor(dp.x - offset.x);
|
||||
dp.y = floor(offset.y - dp.y);
|
||||
|
||||
|
|
|
@ -70,16 +70,16 @@ static void _rect_setup(rect_trace_t * t, NSRect r, int cx0, int cx1,
|
|||
t->cx1 = cx1;
|
||||
|
||||
p = r.origin;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
fx[0] = p.x; fy[0] = p.y;
|
||||
p = r.origin; p.x += r.size.width;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
fx[1] = p.x; fy[1] = p.y;
|
||||
p = r.origin; p.x += r.size.width; p.y += r.size.height;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
fx[2] = p.x; fy[2] = p.y;
|
||||
p = r.origin; p.y += r.size.height;
|
||||
p = [ctm pointInMatrixSpace: p];
|
||||
p = [ctm transformPoint: p];
|
||||
fx[3] = p.x; fy[3] = p.y;
|
||||
|
||||
if (fabs(fx[0] - floor(fx[0] + .5)) < 0.001) fx[0] = floor(fx[0] + .5);
|
||||
|
|
|
@ -975,7 +975,7 @@ _set_op(cairo_t *ct, NSCompositingOperation op)
|
|||
}
|
||||
*/
|
||||
[source->ctm boundingRectFor: aRect result: &aRect];
|
||||
aPoint = [ctm pointInMatrixSpace: aPoint];
|
||||
aPoint = [ctm transformPoint: aPoint];
|
||||
|
||||
x = aPoint.x;
|
||||
y = aPoint.y;
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
|
||||
- (NSPoint) pointInMatrixSpace: (NSPoint)aPoint
|
||||
{
|
||||
return [ctm pointInMatrixSpace: aPoint];
|
||||
return [ctm transformPoint: aPoint];
|
||||
}
|
||||
|
||||
- (NSPoint) deltaPointInMatrixSpace: (NSPoint)aPoint
|
||||
|
@ -453,8 +453,8 @@ typedef enum {
|
|||
|
||||
advancement = [font advancementForGlyph: glyph];
|
||||
/* Use only delta transformations (no offset). Is this conversion needed?*/
|
||||
advancement = [ctm sizeInMatrixSpace: NSMakeSize(advancement.width,
|
||||
[font ascender])];
|
||||
advancement = [ctm transformSize: NSMakeSize(advancement.width,
|
||||
[font ascender])];
|
||||
delta.x += advancement.width;
|
||||
delta.y += advancement.height;
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ typedef enum {
|
|||
|
||||
- (NSPoint) GSGetTextPosition
|
||||
{
|
||||
return [textCtm pointInMatrixSpace: NSMakePoint(0,0)];
|
||||
return [textCtm transformPoint: NSMakePoint(0,0)];
|
||||
}
|
||||
|
||||
- (void) GSSetTextCTM: (NSAffineTransform *)newCtm
|
||||
|
@ -720,7 +720,19 @@ typedef enum {
|
|||
/* ----------------------------------------------------------------------- */
|
||||
- (void)DPSconcat: (const float *)m
|
||||
{
|
||||
[ctm concatenateWithMatrix: m];
|
||||
NSAffineTransformStruct matrix;
|
||||
NSAffineTransform *new_ctm = [NSAffineTransform new];
|
||||
|
||||
matrix.m11 = m[0];
|
||||
matrix.m12 = m[1];
|
||||
matrix.m21 = m[2];
|
||||
matrix.m22 = m[3];
|
||||
matrix.tX = m[4];
|
||||
matrix.tY = m[5];
|
||||
[new_ctm setTransformStruct: matrix];
|
||||
|
||||
[ctm prependTransform: new_ctm];
|
||||
RELEASE(new_ctm);
|
||||
}
|
||||
|
||||
- (void)DPSinitmatrix
|
||||
|
@ -755,7 +767,7 @@ typedef enum {
|
|||
|
||||
- (void) GSConcatCTM: (NSAffineTransform *)newctm
|
||||
{
|
||||
[ctm concatenateWith: newctm];
|
||||
[ctm prependTransform: newctm];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
@ -833,9 +845,9 @@ typedef enum {
|
|||
- (void)DPScurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)x3
|
||||
: (float)y3
|
||||
{
|
||||
NSPoint p1 = [ctm pointInMatrixSpace: NSMakePoint(x1, y1)];
|
||||
NSPoint p2 = [ctm pointInMatrixSpace: NSMakePoint(x2, y2)];
|
||||
NSPoint p3 = [ctm pointInMatrixSpace: NSMakePoint(x3, y3)];
|
||||
NSPoint p1 = [ctm transformPoint: NSMakePoint(x1, y1)];
|
||||
NSPoint p2 = [ctm transformPoint: NSMakePoint(x2, y2)];
|
||||
NSPoint p3 = [ctm transformPoint: NSMakePoint(x3, y3)];
|
||||
|
||||
CHECK_PATH;
|
||||
[path curveToPoint: p3 controlPoint1: p1 controlPoint2: p2];
|
||||
|
@ -869,7 +881,7 @@ typedef enum {
|
|||
|
||||
- (void)DPSlineto: (float)x : (float)y
|
||||
{
|
||||
NSPoint p = [ctm pointInMatrixSpace: NSMakePoint(x, y)];
|
||||
NSPoint p = [ctm transformPoint: NSMakePoint(x, y)];
|
||||
|
||||
CHECK_PATH;
|
||||
[path lineToPoint: p];
|
||||
|
@ -877,7 +889,7 @@ typedef enum {
|
|||
|
||||
- (void)DPSmoveto: (float)x : (float)y
|
||||
{
|
||||
NSPoint p = [ctm pointInMatrixSpace: NSMakePoint(x, y)];
|
||||
NSPoint p = [ctm transformPoint: NSMakePoint(x, y)];
|
||||
|
||||
CHECK_PATH;
|
||||
[path moveToPoint: p];
|
||||
|
|
|
@ -478,29 +478,29 @@ fpfloat(FILE *stream, float f)
|
|||
|
||||
- (void) GSSetCTM: (NSAffineTransform *)ctm
|
||||
{
|
||||
float m[6];
|
||||
[ctm getMatrix: m];
|
||||
NSAffineTransformStruct matrix = [ctm transformStruct];
|
||||
|
||||
fprintf(gstream, "[");
|
||||
fpfloat(gstream, m[0]);
|
||||
fpfloat(gstream, m[1]);
|
||||
fpfloat(gstream, m[2]);
|
||||
fpfloat(gstream, m[3]);
|
||||
fpfloat(gstream, m[4]);
|
||||
fpfloat(gstream, m[5]);
|
||||
fpfloat(gstream, matrix.m11);
|
||||
fpfloat(gstream, matrix.m12);
|
||||
fpfloat(gstream, matrix.m21);
|
||||
fpfloat(gstream, matrix.m22);
|
||||
fpfloat(gstream, matrix.tX);
|
||||
fpfloat(gstream, matrix.tY);
|
||||
fprintf(gstream, "] setmatrix\n");
|
||||
}
|
||||
|
||||
- (void) GSConcatCTM: (NSAffineTransform *)ctm
|
||||
{
|
||||
float m[6];
|
||||
[ctm getMatrix: m];
|
||||
NSAffineTransformStruct matrix = [ctm transformStruct];
|
||||
|
||||
fprintf(gstream, "[");
|
||||
fpfloat(gstream, m[0]);
|
||||
fpfloat(gstream, m[1]);
|
||||
fpfloat(gstream, m[2]);
|
||||
fpfloat(gstream, m[3]);
|
||||
fpfloat(gstream, m[4]);
|
||||
fpfloat(gstream, m[5]);
|
||||
fpfloat(gstream, matrix.m11);
|
||||
fpfloat(gstream, matrix.m12);
|
||||
fpfloat(gstream, matrix.m21);
|
||||
fpfloat(gstream, matrix.m22);
|
||||
fpfloat(gstream, matrix.tX);
|
||||
fpfloat(gstream, matrix.tY);
|
||||
fprintf(gstream, "] concat\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ RECT GSWindowRectToMS(WIN32GState *s, NSRect r)
|
|||
static inline
|
||||
POINT GSViewPointToWin(WIN32GState *s, NSPoint p)
|
||||
{
|
||||
p = [s->ctm pointInMatrixSpace: p];
|
||||
p = [s->ctm transformPoint: p];
|
||||
return GSWindowPointToMS(s, p);
|
||||
}
|
||||
|
||||
|
|
|
@ -1290,7 +1290,7 @@ NSDebugLLog(@"XGGraphics", @"Clip %@ set to X rect %@",
|
|||
/* Note we update the current point according to the current
|
||||
transformation scaling, although the text isn't currently
|
||||
scaled (FIXME). */
|
||||
scale = [ctm sizeInMatrixSpace: NSMakeSize(1, 1)];
|
||||
scale = [ctm transformSize: NSMakeSize(1, 1)];
|
||||
//scale = NSMakeSize(1, 1);
|
||||
[path relativeMoveToPoint: NSMakePoint(width * scale.width, 0)];
|
||||
}
|
||||
|
@ -1337,7 +1337,7 @@ NSDebugLLog(@"XGGraphics", @"Clip %@ set to X rect %@",
|
|||
/* Note we update the current point according to the current
|
||||
transformation scaling, although the text isn't currently
|
||||
scaled (FIXME). */
|
||||
scale = [ctm sizeInMatrixSpace: NSMakeSize(1, 1)];
|
||||
scale = [ctm transformSize: NSMakeSize(1, 1)];
|
||||
//scale = NSMakeSize(1, 1);
|
||||
[path relativeMoveToPoint: NSMakePoint(width * scale.width, 0)];
|
||||
}
|
||||
|
@ -1427,7 +1427,7 @@ NSDebugLLog(@"XGGraphics", @"Clip %@ set to X rect %@",
|
|||
int w;
|
||||
NSSize ws;
|
||||
|
||||
ws = [ctm sizeInMatrixSpace: NSMakeSize(width,width)];
|
||||
ws = [ctm transformSize: NSMakeSize(width,width)];
|
||||
width = (ws.width + ws.height) / 2;
|
||||
|
||||
/*
|
||||
|
@ -1806,7 +1806,7 @@ NSDebugLLog(@"XGGraphics", @"Fill %@ X rect %d,%d,%d,%d",
|
|||
|
||||
// --- determine region to read --------------------------------------
|
||||
|
||||
rect.origin = [ctm pointInMatrixSpace: rect.origin];
|
||||
rect.origin = [ctm transformPoint: rect.origin];
|
||||
srect = XGWindowRectToX(self, rect);
|
||||
srect = XGIntersectionRect (srect, accessibleRectForWindow (source_win));
|
||||
ssize.width = srect.width;
|
||||
|
|
Loading…
Reference in a new issue