diff options
Diffstat (limited to 'src/share/native/sun')
-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 | ||||
-rw-r--r-- | src/share/native/sun/java2d/opengl/OGLTextRenderer.c | 10 |
5 files changed, 29 insertions, 9 deletions
diff --git a/src/share/native/sun/font/AccelGlyphCache.c b/src/share/native/sun/font/AccelGlyphCache.c index 73e94a91c..7d293fd7a 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 d7fd1fbe6..b83f7e00e 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 93baaea47..66ec606af 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 3bd914518..84fa28f08 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); } diff --git a/src/share/native/sun/java2d/opengl/OGLTextRenderer.c b/src/share/native/sun/java2d/opengl/OGLTextRenderer.c index b709be3cc..fa98114f7 100644 --- a/src/share/native/sun/java2d/opengl/OGLTextRenderer.c +++ b/src/share/native/sun/java2d/opengl/OGLTextRenderer.c @@ -244,6 +244,7 @@ static void OGLTR_AddToGlyphCache(GlyphInfo *glyph, jboolean rgbOrder) { GLenum pixelFormat; + CacheCellInfo *ccinfo; J2dTraceLn(J2D_TRACE_INFO, "OGLTR_AddToGlyphCache"); @@ -258,11 +259,12 @@ OGLTR_AddToGlyphCache(GlyphInfo *glyph, jboolean rgbOrder) } AccelGlyphCache_AddGlyph(glyphCache, glyph); + ccinfo = (CacheCellInfo *) glyph->cellInfo; - if (glyph->cellInfo != NULL) { + if (ccinfo != NULL) { // store glyph image in texture cell j2d_glTexSubImage2D(GL_TEXTURE_2D, 0, - glyph->cellInfo->x, glyph->cellInfo->y, + ccinfo->x, ccinfo->y, glyph->width, glyph->height, pixelFormat, GL_UNSIGNED_BYTE, glyph->image); } @@ -668,7 +670,7 @@ OGLTR_DrawGrayscaleGlyphViaCache(OGLContext *oglc, } } - cell = ginfo->cellInfo; + cell = (CacheCellInfo *) (ginfo->cellInfo); cell->timesRendered++; x1 = (jfloat)x; @@ -871,7 +873,7 @@ OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps, } } - cell = ginfo->cellInfo; + cell = (CacheCellInfo *) (ginfo->cellInfo); cell->timesRendered++; // location of the glyph in the destination's coordinate space |