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

@ -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;