diff options
Diffstat (limited to 'src/share/native/sun/font')
-rw-r--r-- | src/share/native/sun/font/AccelGlyphCache.c | 1 | ||||
-rw-r--r-- | src/share/native/sun/font/fontscalerdefs.h | 13 | ||||
-rw-r--r-- | src/share/native/sun/font/freetypeScaler.c | 3 | ||||
-rw-r--r-- | src/share/native/sun/font/sunFont.c | 11 |
4 files changed, 23 insertions, 5 deletions
diff --git a/src/share/native/sun/font/AccelGlyphCache.c b/src/share/native/sun/font/AccelGlyphCache.c index b1d4087b5..f6e34c755 100644 --- a/src/share/native/sun/font/AccelGlyphCache.c +++ b/src/share/native/sun/font/AccelGlyphCache.c @@ -325,6 +325,7 @@ AccelGlyphCache_AddCellInfo(GlyphInfo *glyph, CacheCellInfo *cellInfo) cellInfo->glyphInfo = glyph; cellInfo->nextGCI = glyph->cellInfo; glyph->cellInfo = cellInfo; + glyph->managed = MANAGED_GLYPH; } /** diff --git a/src/share/native/sun/font/fontscalerdefs.h b/src/share/native/sun/font/fontscalerdefs.h index db5edf4d4..9b5ad7fe4 100644 --- a/src/share/native/sun/font/fontscalerdefs.h +++ b/src/share/native/sun/font/fontscalerdefs.h @@ -84,15 +84,26 @@ typedef float t2kScalar; #define t2kScalarAverage(a, b) (((a) + (b)) / (t2kScalar)(2)) + /* managed: 1 means the glyph has a hardware cached + * copy, and its freeing is managed by the the usual + * 2D disposer code. + * A value of 0 means its either unaccelerated (and so has no cellInfos) + * or we want to free this in a different way. + * The field uses previously unused padding, so doesn't enlarge + * the structure. + */ +#define UNMANAGED_GLYPH 0 +#define MANAGED_GLYPH 1 typedef struct GlyphInfo { float advanceX; float advanceY; UInt16 width; UInt16 height; UInt16 rowBytes; + UInt8 managed; float topLeftX; float topLeftY; - struct _CacheCellInfo *cellInfo; + void *cellInfo; UInt8 *image; } GlyphInfo; diff --git a/src/share/native/sun/font/freetypeScaler.c b/src/share/native/sun/font/freetypeScaler.c index 6e7edb11b..39768c467 100644 --- a/src/share/native/sun/font/freetypeScaler.c +++ b/src/share/native/sun/font/freetypeScaler.c @@ -782,6 +782,7 @@ Java_sun_font_FreetypeFontScaler_getGlyphImageNative( return ptr_to_jlong(glyphInfo); } glyphInfo->cellInfo = NULL; + glyphInfo->managed = UNMANAGED_GLYPH; glyphInfo->rowBytes = width; glyphInfo->width = width; glyphInfo->height = height; @@ -1130,7 +1131,7 @@ static void addToGP(GPData* gpdata, FT_Outline*outline) { current_type = SEG_LINETO; } } else if (FT_CURVE_TAG(outline->tags[i]) == FT_CURVE_TAG_CUBIC) { - /* Bit 1 is meaningful for ‘off’ points only. + /* Bit 1 is meaningful for 'off' points only. If set, it indicates a third-order Bezier arc control point; and a second-order control point if unset. */ current_type = SEG_CUBICTO; diff --git a/src/share/native/sun/font/sunFont.c b/src/share/native/sun/font/sunFont.c index 0140e7019..4c6949e20 100644 --- a/src/share/native/sun/font/sunFont.c +++ b/src/share/native/sun/font/sunFont.c @@ -233,7 +233,8 @@ JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeIntMemory for (i=0; i< len; i++) { if (ptrs[i] != 0) { GlyphInfo *ginfo = (GlyphInfo *)ptrs[i]; - if (ginfo->cellInfo != NULL) { + if (ginfo->cellInfo != NULL && + ginfo->managed == MANAGED_GLYPH) { // invalidate this glyph's accelerated cache cell AccelGlyphCache_RemoveAllCellInfos(ginfo); } @@ -264,7 +265,8 @@ JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeLongMemory for (i=0; i< len; i++) { if (ptrs[i] != 0L) { GlyphInfo *ginfo = (GlyphInfo *) jlong_to_ptr(ptrs[i]); - if (ginfo->cellInfo != NULL) { + if (ginfo->cellInfo != NULL && + ginfo->managed == MANAGED_GLYPH) { AccelGlyphCache_RemoveAllCellInfos(ginfo); } free((void*)ginfo); @@ -285,7 +287,7 @@ Java_sun_font_StrikeCache_getGlyphCacheDescription GlyphInfo *info; size_t baseAddr; - if ((*env)->GetArrayLength(env, results) < 10) { + if ((*env)->GetArrayLength(env, results) < 13) { return; } @@ -310,6 +312,9 @@ Java_sun_font_StrikeCache_getGlyphCacheDescription nresults[8] = (size_t)&(info->topLeftY)-baseAddr; nresults[9] = (size_t)&(info->image)-baseAddr; nresults[10] = (jlong)(uintptr_t)info; /* invisible glyph */ + nresults[11] = (size_t)&(info->cellInfo)-baseAddr; + nresults[12] = (size_t)&(info->managed)-baseAddr; + (*env)->ReleasePrimitiveArrayCritical(env, results, nresults, 0); } |