diff --git a/ChangeLog b/ChangeLog index 36f3b90b9..633b0a1a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +1999-05-12 Adam Fedor + + + * Source/NSButtonCell.m (-drawWithFrame:inView:): Don't set a clip + rect (not needed since we know what we're drawing). + (-drawInteriorWithFrame:inView): Remove gsave/grestore. + * Source/NSCell.m: Likewise. + * Source/NSStringDrawing.m ([NSAttributedString -drawInRect:]): + gsave/grestore around rectclip. + + * Headers/gnustep/gui/NSFont.h: ivar to show when matrix was + explicitly set. + * Source/NSFont.m (+fontWithName:size:): Reset it. + 1999-05-11 Adam Fedor * Source/NSButtonCell.m ([NSButtonCell diff --git a/Headers/gnustep/gui/NSFont.h b/Headers/gnustep/gui/NSFont.h index 595ddcb05..03656674a 100644 --- a/Headers/gnustep/gui/NSFont.h +++ b/Headers/gnustep/gui/NSFont.h @@ -51,6 +51,8 @@ extern const float *NSFontIdentityMatrix; NSString *fontName; float matrix[6]; + BOOL matrixExplicitlySet; + // Reserved for back-end use void *be_font_reserved; } diff --git a/Source/NSButtonCell.m b/Source/NSButtonCell.m index 97fea3d35..c7d880542 100644 --- a/Source/NSButtonCell.m +++ b/Source/NSButtonCell.m @@ -399,11 +399,11 @@ { if ([self isHighlighted] && ([self highlightsBy] & NSPushInCellMask)) { - NSDrawGrayBezel(cellFrame, cellFrame); + NSDrawGrayBezel(cellFrame, NSZeroRect); } else { - NSDrawButton(cellFrame, cellFrame); + NSDrawButton(cellFrame, NSZeroRect); } } @@ -501,11 +501,7 @@ rect.origin = cellFrame.origin; rect.size.width = imageSize.width; rect.size.height = cellFrame.size.height; - /* Have to save the gstate, since a new clip rect may be defined - when drawing */ - PSgsave(); [self _drawImage: imageToDisplay inFrame: rect]; - PSgrestore(); // draw title rect.origin.x += imageSize.width + xDist; @@ -519,11 +515,7 @@ rect.origin.y = cellFrame.origin.y; rect.size.width = imageSize.width; rect.size.height = cellFrame.size.height; - /* Have to save the gstate, since a new clip rect may be defined - when drawing */ - PSgsave(); [self _drawImage: imageToDisplay inFrame: rect]; - PSgrestore(); // draw title rect.origin = cellFrame.origin; @@ -535,11 +527,7 @@ case NSImageBelow: // draw image below title cellFrame.size.height /= 2; - /* Have to save the gstate, since a new clip rect may be defined - when drawing */ - PSgsave(); [self _drawImage: imageToDisplay inFrame: cellFrame]; - PSgrestore(); cellFrame.origin.y += cellFrame.size.height; [self _drawText: titleToDisplay inFrame: cellFrame]; break; @@ -547,22 +535,14 @@ case NSImageAbove: // draw image above title cellFrame.size.height /= 2; - /* Have to save the gstate, since a new clip rect may be defined - when drawing */ - PSgsave(); [self _drawText: titleToDisplay inFrame: cellFrame]; - PSgrestore(); cellFrame.origin.y += cellFrame.size.height; [self _drawImage: imageToDisplay inFrame: cellFrame]; break; case NSImageOverlaps: // draw title over the image - /* Have to save the gstate, since a new clip rect may be defined - when drawing */ - PSgsave(); [self _drawImage: imageToDisplay inFrame: cellFrame]; - PSgrestore(); [self _drawText: titleToDisplay inFrame: cellFrame]; break; } diff --git a/Source/NSCell.m b/Source/NSCell.m index a23e1dff7..fd7bf9400 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -690,7 +690,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect) } else if ([self isBezeled]) { - NSDrawWhiteBezel(cellFrame, cellFrame); + NSDrawWhiteBezel(cellFrame, NSZeroRect); } [self drawInteriorWithFrame: cellFrame inView: controlView]; @@ -708,9 +708,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect) if (cell_highlighted != lit) { cell_highlighted = lit; - PSgsave(); [self drawWithFrame: cellFrame inView: controlView]; - PSgrestore(); } } diff --git a/Source/NSFont.m b/Source/NSFont.m index 6fde0ef3d..dd5bffc76 100644 --- a/Source/NSFont.m +++ b/Source/NSFont.m @@ -170,9 +170,12 @@ void setNSFont(NSString* key, NSFont* font) + (NSFont*)fontWithName:(NSString*)name size:(float)fontSize { + NSFont *font; float fontMatrix[6] = { fontSize, 0, 0, fontSize, 0, 0 }; - return [self fontWithName:name matrix:fontMatrix]; + font = [self fontWithName: name matrix: fontMatrix]; + font->matrixExplicitlySet = NO; + return font; } + (void)useFont:(NSString*)name diff --git a/Source/NSStringDrawing.m b/Source/NSStringDrawing.m index fb64ad3a6..86443f550 100644 --- a/Source/NSStringDrawing.m +++ b/Source/NSStringDrawing.m @@ -1238,6 +1238,7 @@ setupLine(GSTextLine *line, NSAttributedString *str, NSRange range, NSPoint point; NSView *view = [NSView focusView]; + PSgsave(); NSRectClip(rect); /* @@ -1252,6 +1253,7 @@ setupLine(GSTextLine *line, NSAttributedString *str, NSRange range, point.y = rect.origin.y + rect.size.height; [self drawAtPoint: point]; + PSgrestore(); } - (NSSize) size diff --git a/Source/externs.m b/Source/externs.m index 49c13f0f1..18698c6cd 100644 --- a/Source/externs.m +++ b/Source/externs.m @@ -330,6 +330,8 @@ NSString *NSLigatureAttributeName = @"NSLigatureAttributeName"; NSString *NSBaselineOffsetAttributeName = @"NSBaselineOffsetAttributeName"; NSString *NSKernAttributeName = @"NSKernAttributeName"; +/* NSFont matrix */ +const float NSFontIdentityMatrix[] = {1, 0, 0, 1, 0, 0}; /* Drawing engine externs */ NSString *NSBackendContext = @"NSBackendContext";