mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
Change NSBezierPath to use NSInteger and CGFloat and adjust uses to
this. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@36054 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
73dcf13efd
commit
255ee1a3d8
5 changed files with 48 additions and 20 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-02-01 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/cairo/CairoGState.m
|
||||
* Source/gsc/GSGState.m
|
||||
* Source/gsc/GSStreamContext.m
|
||||
* Source/winlib/WIN32GState.m: Adopt to CGFloat changes on NSBezierPath.
|
||||
|
||||
2013-01-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* back/Source/gsc/GSContext.m
|
||||
|
|
|
@ -686,10 +686,11 @@ static inline float floatToUserSpace(NSAffineTransform *ctm, double d)
|
|||
|
||||
- (void) _setPath
|
||||
{
|
||||
unsigned count = [path elementCount];
|
||||
unsigned i;
|
||||
NSInteger count = [path elementCount];
|
||||
NSInteger i;
|
||||
SEL elmsel = @selector(elementAtIndex:associatedPoints:);
|
||||
IMP elmidx = [path methodForSelector: elmsel];
|
||||
NSBezierPathElement (*elmidx)(id, SEL, NSInteger, NSPoint*) =
|
||||
(NSBezierPathElement (*)(id, SEL, NSInteger, NSPoint*))[path methodForSelector: elmsel];
|
||||
|
||||
// reset current cairo path
|
||||
cairo_new_path(_ct);
|
||||
|
|
|
@ -1083,9 +1083,11 @@ typedef enum {
|
|||
|
||||
- (void) GSSendBezierPath: (NSBezierPath *)newpath
|
||||
{
|
||||
int count = 10;
|
||||
float dash_pattern[10];
|
||||
float phase;
|
||||
NSInteger count = 10;
|
||||
CGFloat dash_pattern[10];
|
||||
CGFloat phase;
|
||||
float fpattern[10];
|
||||
NSInteger i;
|
||||
|
||||
// Appending to the current path is a lot faster than copying!
|
||||
//ASSIGNCOPY(path, newpath);
|
||||
|
@ -1102,7 +1104,12 @@ typedef enum {
|
|||
[self DPSsetflat: [newpath flatness]];
|
||||
|
||||
[newpath getLineDash: dash_pattern count: &count phase: &phase];
|
||||
[self DPSsetdash: dash_pattern : count : phase];
|
||||
// Convert from CGFloat to float
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
fpattern[i] = dash_pattern[i];
|
||||
}
|
||||
[self DPSsetdash: fpattern : count : phase];
|
||||
}
|
||||
|
||||
- (void) GSRectClipList: (const NSRect *)rects : (int) count
|
||||
|
|
|
@ -696,9 +696,10 @@ fpfloat(FILE *stream, float f)
|
|||
{
|
||||
NSBezierPathElement type;
|
||||
NSPoint pts[3];
|
||||
int i, count = 10;
|
||||
float pattern[10];
|
||||
float phase = 0.0;
|
||||
NSInteger i, count = 10;
|
||||
CGFloat pattern[10];
|
||||
CGFloat phase = 0.0;
|
||||
float fpattern[10];
|
||||
|
||||
[self DPSnewpath];
|
||||
[self DPSsetlinewidth: [path lineWidth]];
|
||||
|
@ -708,8 +709,13 @@ fpfloat(FILE *stream, float f)
|
|||
[self DPSsetflat: [path flatness]];
|
||||
|
||||
[path getLineDash: pattern count: &count phase: &phase];
|
||||
// Convert from CGFloat to float
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
fpattern[i] = pattern[i];
|
||||
}
|
||||
// Always sent the dash pattern. When NULL this will reset to a solid line.
|
||||
[self DPSsetdash: pattern : count : phase];
|
||||
[self DPSsetdash: fpattern : count : phase];
|
||||
|
||||
count = [path elementCount];
|
||||
for (i = 0; i < count; i++)
|
||||
|
|
|
@ -1251,13 +1251,20 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
|
||||
- (void) DPSsetdash: (const float*)thePattern : (int)count : (float)phase
|
||||
{
|
||||
CGFloat pattern[count];
|
||||
|
||||
if (!path)
|
||||
{
|
||||
path = [NSBezierPath new];
|
||||
}
|
||||
|
||||
// Convert from float to CGFloat
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
pattern[i] = thePattern[i];
|
||||
}
|
||||
// FIXME: Convert to ctm first
|
||||
[path setLineDash: thePattern count: count phase: phase];
|
||||
[path setLineDash: pattern count: count phase: phase];
|
||||
}
|
||||
|
||||
- (void)DPScurrentmiterlimit: (float *)limit
|
||||
|
@ -1324,10 +1331,8 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
DWORD penStyle;
|
||||
|
||||
// Temporary variables for gathering pen information
|
||||
float* thePattern = NULL;
|
||||
DWORD* iPattern = NULL;
|
||||
int patternCount = 0;
|
||||
float phase = 0.0;
|
||||
NSInteger patternCount = 0;
|
||||
|
||||
SetBkMode(hDC, TRANSPARENT);
|
||||
br.lbStyle = BS_SOLID;
|
||||
|
@ -1376,20 +1381,22 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
|
|||
|
||||
if (patternCount > 0)
|
||||
{
|
||||
NSInteger i = 0;
|
||||
CGFloat* thePattern[patternCount];
|
||||
CGFloat phase = 0.0;
|
||||
|
||||
penStyle = PS_GEOMETRIC | PS_USERSTYLE;
|
||||
|
||||
// The user has defined a dash pattern for stroking on
|
||||
// the path. Note that we lose the floating point information
|
||||
// here, as windows only supports DWORD elements, not float.
|
||||
thePattern = malloc(sizeof(float) * patternCount);
|
||||
[path getLineDash: thePattern count: &patternCount phase: &phase];
|
||||
|
||||
iPattern = malloc(sizeof(DWORD) * patternCount);
|
||||
int i = 0;
|
||||
for (i = 0 ; i < patternCount; i ++)
|
||||
iPattern[i] = (DWORD)thePattern[i];
|
||||
free(thePattern);
|
||||
thePattern = NULL;
|
||||
{
|
||||
iPattern[i] = (DWORD)thePattern[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue