mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 08:30:56 +00:00
Fix up clipping
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4246 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
115b3cdbf6
commit
6e14f79d10
7 changed files with 27 additions and 26 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
1999-05-12 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
|
||||||
|
* 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 <fedor@gnu.org>
|
1999-05-11 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Source/NSButtonCell.m ([NSButtonCell
|
* Source/NSButtonCell.m ([NSButtonCell
|
||||||
|
|
|
@ -51,6 +51,8 @@ extern const float *NSFontIdentityMatrix;
|
||||||
NSString *fontName;
|
NSString *fontName;
|
||||||
float matrix[6];
|
float matrix[6];
|
||||||
|
|
||||||
|
BOOL matrixExplicitlySet;
|
||||||
|
|
||||||
// Reserved for back-end use
|
// Reserved for back-end use
|
||||||
void *be_font_reserved;
|
void *be_font_reserved;
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,11 +399,11 @@
|
||||||
{
|
{
|
||||||
if ([self isHighlighted] && ([self highlightsBy] & NSPushInCellMask))
|
if ([self isHighlighted] && ([self highlightsBy] & NSPushInCellMask))
|
||||||
{
|
{
|
||||||
NSDrawGrayBezel(cellFrame, cellFrame);
|
NSDrawGrayBezel(cellFrame, NSZeroRect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSDrawButton(cellFrame, cellFrame);
|
NSDrawButton(cellFrame, NSZeroRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,11 +501,7 @@
|
||||||
rect.origin = cellFrame.origin;
|
rect.origin = cellFrame.origin;
|
||||||
rect.size.width = imageSize.width;
|
rect.size.width = imageSize.width;
|
||||||
rect.size.height = cellFrame.size.height;
|
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];
|
[self _drawImage: imageToDisplay inFrame: rect];
|
||||||
PSgrestore();
|
|
||||||
|
|
||||||
// draw title
|
// draw title
|
||||||
rect.origin.x += imageSize.width + xDist;
|
rect.origin.x += imageSize.width + xDist;
|
||||||
|
@ -519,11 +515,7 @@
|
||||||
rect.origin.y = cellFrame.origin.y;
|
rect.origin.y = cellFrame.origin.y;
|
||||||
rect.size.width = imageSize.width;
|
rect.size.width = imageSize.width;
|
||||||
rect.size.height = cellFrame.size.height;
|
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];
|
[self _drawImage: imageToDisplay inFrame: rect];
|
||||||
PSgrestore();
|
|
||||||
|
|
||||||
// draw title
|
// draw title
|
||||||
rect.origin = cellFrame.origin;
|
rect.origin = cellFrame.origin;
|
||||||
|
@ -535,11 +527,7 @@
|
||||||
case NSImageBelow:
|
case NSImageBelow:
|
||||||
// draw image below title
|
// draw image below title
|
||||||
cellFrame.size.height /= 2;
|
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];
|
[self _drawImage: imageToDisplay inFrame: cellFrame];
|
||||||
PSgrestore();
|
|
||||||
cellFrame.origin.y += cellFrame.size.height;
|
cellFrame.origin.y += cellFrame.size.height;
|
||||||
[self _drawText: titleToDisplay inFrame: cellFrame];
|
[self _drawText: titleToDisplay inFrame: cellFrame];
|
||||||
break;
|
break;
|
||||||
|
@ -547,22 +535,14 @@
|
||||||
case NSImageAbove:
|
case NSImageAbove:
|
||||||
// draw image above title
|
// draw image above title
|
||||||
cellFrame.size.height /= 2;
|
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];
|
[self _drawText: titleToDisplay inFrame: cellFrame];
|
||||||
PSgrestore();
|
|
||||||
cellFrame.origin.y += cellFrame.size.height;
|
cellFrame.origin.y += cellFrame.size.height;
|
||||||
[self _drawImage: imageToDisplay inFrame: cellFrame];
|
[self _drawImage: imageToDisplay inFrame: cellFrame];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageOverlaps:
|
case NSImageOverlaps:
|
||||||
// draw title over the image
|
// 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];
|
[self _drawImage: imageToDisplay inFrame: cellFrame];
|
||||||
PSgrestore();
|
|
||||||
[self _drawText: titleToDisplay inFrame: cellFrame];
|
[self _drawText: titleToDisplay inFrame: cellFrame];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -690,7 +690,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
||||||
}
|
}
|
||||||
else if ([self isBezeled])
|
else if ([self isBezeled])
|
||||||
{
|
{
|
||||||
NSDrawWhiteBezel(cellFrame, cellFrame);
|
NSDrawWhiteBezel(cellFrame, NSZeroRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[self drawInteriorWithFrame: cellFrame inView: controlView];
|
[self drawInteriorWithFrame: cellFrame inView: controlView];
|
||||||
|
@ -708,9 +708,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
||||||
if (cell_highlighted != lit)
|
if (cell_highlighted != lit)
|
||||||
{
|
{
|
||||||
cell_highlighted = lit;
|
cell_highlighted = lit;
|
||||||
PSgsave();
|
|
||||||
[self drawWithFrame: cellFrame inView: controlView];
|
[self drawWithFrame: cellFrame inView: controlView];
|
||||||
PSgrestore();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,9 +170,12 @@ void setNSFont(NSString* key, NSFont* font)
|
||||||
+ (NSFont*)fontWithName:(NSString*)name
|
+ (NSFont*)fontWithName:(NSString*)name
|
||||||
size:(float)fontSize
|
size:(float)fontSize
|
||||||
{
|
{
|
||||||
|
NSFont *font;
|
||||||
float fontMatrix[6] = { fontSize, 0, 0, fontSize, 0, 0 };
|
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
|
+ (void)useFont:(NSString*)name
|
||||||
|
|
|
@ -1238,6 +1238,7 @@ setupLine(GSTextLine *line, NSAttributedString *str, NSRange range,
|
||||||
NSPoint point;
|
NSPoint point;
|
||||||
NSView *view = [NSView focusView];
|
NSView *view = [NSView focusView];
|
||||||
|
|
||||||
|
PSgsave();
|
||||||
NSRectClip(rect);
|
NSRectClip(rect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1252,6 +1253,7 @@ setupLine(GSTextLine *line, NSAttributedString *str, NSRange range,
|
||||||
point.y = rect.origin.y + rect.size.height;
|
point.y = rect.origin.y + rect.size.height;
|
||||||
|
|
||||||
[self drawAtPoint: point];
|
[self drawAtPoint: point];
|
||||||
|
PSgrestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSSize) size
|
- (NSSize) size
|
||||||
|
|
|
@ -330,6 +330,8 @@ NSString *NSLigatureAttributeName = @"NSLigatureAttributeName";
|
||||||
NSString *NSBaselineOffsetAttributeName = @"NSBaselineOffsetAttributeName";
|
NSString *NSBaselineOffsetAttributeName = @"NSBaselineOffsetAttributeName";
|
||||||
NSString *NSKernAttributeName = @"NSKernAttributeName";
|
NSString *NSKernAttributeName = @"NSKernAttributeName";
|
||||||
|
|
||||||
|
/* NSFont matrix */
|
||||||
|
const float NSFontIdentityMatrix[] = {1, 0, 0, 1, 0, 0};
|
||||||
|
|
||||||
/* Drawing engine externs */
|
/* Drawing engine externs */
|
||||||
NSString *NSBackendContext = @"NSBackendContext";
|
NSString *NSBackendContext = @"NSBackendContext";
|
||||||
|
|
Loading…
Reference in a new issue