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
This commit is contained in:
rfm 2006-08-13 09:33:11 +00:00
parent cc63b7bec9
commit d29799d998
2 changed files with 105 additions and 95 deletions

View file

@ -1,3 +1,7 @@
2006-08-13 Christopher Armstrong <carmstrong@fastmail.com.au>
* Source/winlib/WIN32GState.m: Fixups to last patch
2006-08-10 Christopher Armstrong (carmstrong@fastmail.com.au) 2006-08-10 Christopher Armstrong (carmstrong@fastmail.com.au)
(patch committed by Greg Casamento) (patch committed by Greg Casamento)
* Source/winlib/WIN32GState.m: Better 24bit image support, Slightly * Source/winlib/WIN32GState.m: Better 24bit image support, Slightly

View file

@ -2,8 +2,8 @@
Copyright (C) 2002 Free Software Foundation, Inc. Copyright (C) 2002 Free Software Foundation, Inc.
Written by: <author name="Fred Kiefer><email>FredKiefer@gmx.de</email></author> Written by: Fred Kiefer <FredKiefer@gmx.de>
Additions by: Christopher Armstrong (carmstrong@fastmail.com.au) Additions by: Christopher Armstrong <carmstrong@fastmail.com.au>
Date: March 2002 Date: March 2002
@ -21,7 +21,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.
*/ */
// Currently the use of alpha blending is switched off by default. // Currently the use of alpha blending is switched off by default.
@ -216,9 +217,10 @@ RECT GSXWindowRectToMS(WIN32GState *s, NSRect r)
int x; int x;
int y; int y;
NSRect destRect; NSRect destRect;
BOOL success; BOOL success = NO;
NSDebugLLog(@"WIN32GState", @"compositeGState: fromRect: %@ toPoint: %@ op: %d", NSDebugLLog(@"WIN32GState",
@"compositeGState: fromRect: %@ toPoint: %@ op: %d",
NSStringFromRect(sourceRect), NSStringFromPoint(destPoint), op); NSStringFromRect(sourceRect), NSStringFromPoint(destPoint), op);
rectFrom = GSViewRectToWin(source, sourceRect); rectFrom = GSViewRectToWin(source, sourceRect);
@ -262,7 +264,8 @@ RECT GSXWindowRectToMS(WIN32GState *s, NSRect r)
#ifdef USE_ALPHABLEND #ifdef USE_ALPHABLEND
// Use (0..1) fraction to set a (0..255) alpha constant value // Use (0..1) fraction to set a (0..255) alpha constant value
BYTE SourceConstantAlpha = (BYTE)(delta * 255); BYTE SourceConstantAlpha = (BYTE)(delta * 255);
BLENDFUNCTION blendFunc = {AC_SRC_OVER, 0, SourceConstantAlpha, AC_SRC_ALPHA}; BLENDFUNCTION blendFunc
= {AC_SRC_OVER, 0, SourceConstantAlpha, AC_SRC_ALPHA};
success = AlphaBlend(hDC, success = AlphaBlend(hDC,
x, y, (rectFrom.right - rectFrom.left), h, x, y, (rectFrom.right - rectFrom.left), h,
sourceDC, sourceDC,
@ -397,10 +400,12 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
int xres, yres; int xres, yres;
UINT fuColorUse; UINT fuColorUse;
if (isPlanar || !([colorSpaceName isEqualToString: NSDeviceRGBColorSpace] || if (isPlanar
[colorSpaceName isEqualToString: NSCalibratedRGBColorSpace])) || !([colorSpaceName isEqualToString: NSDeviceRGBColorSpace]
|| [colorSpaceName isEqualToString: NSCalibratedRGBColorSpace]))
{ {
NSLog(@"Bitmap type currently not supported %d %@", isPlanar, colorSpaceName); NSLog(@"Bitmap type currently not supported %d %@",
isPlanar, colorSpaceName);
return NULL; return NULL;
} }
@ -857,18 +862,16 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
- (void)DPSrectstroke: (float)x : (float)y : (float)w : (float)h - (void)DPSrectstroke: (float)x : (float)y : (float)w : (float)h
{ {
NSRect rect = [ctm rectInMatrixSpace: NSMakeRect(x, y, w, h)]; NSRect rect = [ctm rectInMatrixSpace: NSMakeRect(x, y, w, h)];
NSBezierPath *oldPath = path;
// Samll adjustment so that the line is visible /* // Samll adjustment so that the line is visible
if (rect.size.width > 0) if (rect.size.width > 0)
rect.size.width--; rect.size.width--;
if (rect.size.height > 0) if (rect.size.height > 0)
rect.size.height--; rect.size.height--;
rect.origin.y += 1; rect.origin.y += 1; */
path = [NSBezierPath bezierPathWithRect: rect]; [path appendBezierPathWithRect: rect];
[self DPSstroke]; [self DPSstroke];
path = oldPath;
} }
- (void)DPSrectclip: (float)x : (float)y : (float)w : (float)h - (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 // Temporary variables for gathering pen information
float* thePattern = NULL; float* thePattern = NULL;
DWORD* iPattern = NULL; DWORD* iPattern = NULL;
int count = 0; int patternCount = 0;
float phase = 0.0; float phase = 0.0;
SetBkMode(hDC, TRANSPARENT); SetBkMode(hDC, TRANSPARENT);
@ -1057,31 +1060,34 @@ HBITMAP GSCreateBitmap(HDC hDC, int pixelsWide, int pixelsHigh,
} }
// Get the size of the pen line dash // 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) if (patternCount > 0)
{ {
penStyle = PS_GEOMETRIC | PS_USERSTYLE; penStyle = PS_GEOMETRIC | PS_USERSTYLE;
// The user has defined a dash pattern for stroking on // The user has defined a dash pattern for stroking on
// the path. Note that we lose the floating point information // the path. Note that we lose the floating point information
// here, as windows only supports DWORD elements, not float. // here, as windows only supports DWORD elements, not float.
thePattern = objc_malloc(sizeof(float) * count); thePattern = objc_malloc(sizeof(float) * patternCount);
[path getLineDash:thePattern count:&count phase:&phase]; [path getLineDash: thePattern count: &patternCcount phase: &phase];
iPattern = objc_malloc(sizeof(DWORD) * count); iPattern = objc_malloc(sizeof(DWORD) * patternCount);
int i = 0; int i = 0;
for (i = 0 ; i < count; i ++) for (i = 0 ; i < patternCount; i ++)
iPattern[i] = (DWORD)thePattern[i]; iPattern[i] = (DWORD)thePattern[i];
objc_free(thePattern); objc_free(thePattern);
thePattern = NULL; thePattern = NULL;
} }
else else
{
penStyle = PS_GEOMETRIC | PS_SOLID; penStyle = PS_GEOMETRIC | PS_SOLID;
}
pen = ExtCreatePen(penStyle | join | cap, pen = ExtCreatePen(penStyle | join | cap,
lineWidth, lineWidth,
&br, &br,
0, NULL); patternCount, iPattern);
if (iPattern) if (iPattern)
{ {