NSFont cache font for drawing in flipped views in manner analogous to cache of nonflipped screen font for drawing in regular views

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@21170 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adrian Robert 2005-04-30 16:11:22 +00:00
parent 9df5199aa1
commit 159eed5a6c
3 changed files with 30 additions and 8 deletions

View file

@ -1,9 +1,16 @@
2005-04-30 Adrian Robert <arobert@cogsci.ucsd.edu>
* Headers/AppKit/NSFont.h: Add 'cachedFlippedFont' ivar.
* Source/NSFont.m: Cache font for drawing in flipped views in
manner analogous to font for screen drawing.
2005-04-28 Adam Fedor <fedor@gnu.org>
* configure.ac: More complete check for portaudio
* Tools/gsnd/gsnd.m: Fix portaudio include
2005-04-27 Adrian Robert <arobert@cogsci.ucsd.edu>
* Headers/AppKit/NSApplication.h: Add app_is_launched ivar.
* Source/NSApplication.m (-run): Only go through launch process
and call -finishLaunching on first call.

View file

@ -88,6 +88,14 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix;
-screenFont (and retained). For screen fonts, it's nil.
*/
NSFont *cachedScreenFont;
/*
In the GNUstep implementation, fonts may encapsulate some rendering state
relating to view flipped state, therefore we generate a separate font for
this case. We don't create it by default, unless -set is called in a
flipped context.
*/
NSFont *cachedFlippedFont;
}
//

View file

@ -749,6 +749,7 @@ static void setNSFont(NSString *key, NSFont *font)
fontInfo = RETAIN([GSFontInfo fontInfoForFontName: fontName
matrix: fontMatrix
screenFont: screen]);
cachedFlippedFont = placeHolder;
if (!screenFont)
cachedScreenFont = placeHolder;
if (fontInfo == nil)
@ -789,6 +790,8 @@ static void setNSFont(NSString *key, NSFont *font)
RELEASE(fontName);
}
TEST_RELEASE(fontInfo);
if (cachedFlippedFont != placeHolder)
DESTROY(cachedFlippedFont);
if (cachedScreenFont != placeHolder)
DESTROY(cachedScreenFont);
[super dealloc];
@ -849,14 +852,18 @@ static void setNSFont(NSString *key, NSFont *font)
- (NSFont *)_flippedViewFont
{
float fontMatrix[6];
memcpy(fontMatrix, matrix, sizeof(matrix));
fontMatrix[3] *= -1;
return AUTORELEASE([placeHolder initWithName: fontName
matrix: fontMatrix
fix: YES
screenFont: screenFont
role: role]);
if (cachedFlippedFont == placeHolder)
{
float fontMatrix[6];
memcpy(fontMatrix, matrix, sizeof(matrix));
fontMatrix[3] *= -1;
cachedFlippedFont = [placeHolder initWithName: fontName
matrix: fontMatrix
fix: YES
screenFont: screenFont
role: role];
}
return AUTORELEASE(RETAIN(cachedFlippedFont));
}
static BOOL flip_hack;