From 734254bdc016e6c91936fa06e28899f07137bd1b Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Sun, 13 Aug 2006 09:33:11 +0000 Subject: [PATCH] Some fixups t the previous patch git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23273 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 4 + Source/winlib/WIN32GState.m | 196 +++++++++++++++++++----------------- 2 files changed, 105 insertions(+), 95 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2768121..4c3df58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-08-13 Christopher Armstrong + + * Source/winlib/WIN32GState.m: Fixups to last patch + 2006-08-10 Christopher Armstrong (carmstrong@fastmail.com.au) (patch committed by Greg Casamento) * Source/winlib/WIN32GState.m: Better 24bit image support, Slightly diff --git a/Source/winlib/WIN32GState.m b/Source/winlib/WIN32GState.m index 8f3db4d..1f65ac0 100644 --- a/Source/winlib/WIN32GState.m +++ b/Source/winlib/WIN32GState.m @@ -2,8 +2,8 @@ Copyright (C) 2002 Free Software Foundation, Inc. - Written by: 0) rect.size.width--; if (rect.size.height > 0) rect.size.height--; - rect.origin.y += 1; + rect.origin.y += 1; */ - path = [NSBezierPath bezierPathWithRect: rect]; + [path appendBezierPathWithRect: rect]; [self DPSstroke]; - path = oldPath; } - (void)DPSrectclip: (float)x : (float)y : (float)w : (float)h @@ -1011,7 +1014,7 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh, // Temporary variables for gathering pen information float* thePattern = NULL; DWORD* iPattern = NULL; - int count = 0; + int patternCount = 0; float phase = 0.0; SetBkMode(hDC, TRANSPARENT); @@ -1026,68 +1029,71 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh, switch (joinStyle) { - case NSBevelLineJoinStyle: - join = PS_JOIN_BEVEL; - break; - case NSMiterLineJoinStyle: - join = PS_JOIN_MITER; - break; - case NSRoundLineJoinStyle: - join = PS_JOIN_ROUND; - break; - default: - join = PS_JOIN_MITER; - break; + case NSBevelLineJoinStyle: + join = PS_JOIN_BEVEL; + break; + case NSMiterLineJoinStyle: + join = PS_JOIN_MITER; + break; + case NSRoundLineJoinStyle: + join = PS_JOIN_ROUND; + break; + default: + join = PS_JOIN_MITER; + break; } switch (lineCap) { - case NSButtLineCapStyle: - cap = PS_ENDCAP_FLAT; - break; - case NSSquareLineCapStyle: - cap = PS_ENDCAP_SQUARE; - break; - case NSRoundLineCapStyle: - cap = PS_ENDCAP_ROUND; - break; - default: - cap = PS_ENDCAP_SQUARE; - break; + case NSButtLineCapStyle: + cap = PS_ENDCAP_FLAT; + break; + case NSSquareLineCapStyle: + cap = PS_ENDCAP_SQUARE; + break; + case NSRoundLineCapStyle: + cap = PS_ENDCAP_ROUND; + break; + default: + cap = PS_ENDCAP_SQUARE; + break; } // Get the size of the pen line dash - [path getLineDash:NULL count:&count phase:NULL]; + [path getLineDash: NULL count: &patternCount phase: NULL]; - if (count > 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 = objc_malloc(sizeof(float) * count); - [path getLineDash:thePattern count:&count phase:&phase]; + if (patternCount > 0) + { + penStyle = PS_GEOMETRIC | PS_USERSTYLE; - iPattern = objc_malloc(sizeof(DWORD) * count); - int i = 0; - for (i = 0 ; i < count; i ++) - iPattern[i] = (DWORD)thePattern[i]; - objc_free(thePattern); - thePattern = NULL; - } + // 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 = objc_malloc(sizeof(float) * patternCount); + [path getLineDash: thePattern count: &patternCcount phase: &phase]; + + iPattern = objc_malloc(sizeof(DWORD) * patternCount); + int i = 0; + for (i = 0 ; i < patternCount; i ++) + iPattern[i] = (DWORD)thePattern[i]; + objc_free(thePattern); + thePattern = NULL; + } else - penStyle = PS_GEOMETRIC | PS_SOLID; + { + penStyle = PS_GEOMETRIC | PS_SOLID; + } pen = ExtCreatePen(penStyle | join | cap, lineWidth, &br, - 0, NULL); + patternCount, iPattern); if (iPattern) - { - objc_free(iPattern); - iPattern = NULL; - } + { + objc_free(iPattern); + iPattern = NULL; + } oldPen = SelectObject(hDC, pen);