comparison src/share/native/sun/font/DrawGlyphList.c @ 9879:3540bddf866b

8043508: JVM core dumps with very long text in tooltip Reviewed-by: bae, jgodinez
author prr
date Thu, 31 Jul 2014 10:47:51 -0700
parents 1a3de3cdc684
children eeac0c758228
comparison
equal deleted inserted replaced
3:dd38f115ff78 4:3690454c68de
50 #define FLOOR_ASSIGN(l, r)\ 50 #define FLOOR_ASSIGN(l, r)\
51 if ((r)<0) (l) = ((int)floor(r)); else (l) = ((int)(r)) 51 if ((r)<0) (l) = ((int)floor(r)); else (l) = ((int)(r))
52 52
53 GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist) { 53 GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist) {
54 54
55 int g, bytesNeeded; 55 int g;
56 size_t bytesNeeded;
56 jlong *imagePtrs; 57 jlong *imagePtrs;
57 jfloat* positions = NULL; 58 jfloat* positions = NULL;
58 GlyphInfo *ginfo; 59 GlyphInfo *ginfo;
59 GlyphBlitVector *gbv; 60 GlyphBlitVector *gbv;
60 61
69 (*env)->GetObjectField(env, glyphlist, sunFontIDs.glyphListPos) 70 (*env)->GetObjectField(env, glyphlist, sunFontIDs.glyphListPos)
70 : NULL; 71 : NULL;
71 72
72 bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len; 73 bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len;
73 gbv = (GlyphBlitVector*)malloc(bytesNeeded); 74 gbv = (GlyphBlitVector*)malloc(bytesNeeded);
75 if (gbv == NULL) {
76 return NULL;
77 }
74 gbv->numGlyphs = len; 78 gbv->numGlyphs = len;
75 gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector)); 79 gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector));
76 80
77 imagePtrs = (*env)->GetPrimitiveArrayCritical(env, glyphImages, NULL); 81 imagePtrs = (*env)->GetPrimitiveArrayCritical(env, glyphImages, NULL);
78 if (imagePtrs == NULL) { 82 if (imagePtrs == NULL) {
477 * rendered fractional metrics, there's typically more space between the 481 * rendered fractional metrics, there's typically more space between the
478 * glyphs. Perhaps disabling X-axis grid-fitting will help with that. 482 * glyphs. Perhaps disabling X-axis grid-fitting will help with that.
479 */ 483 */
480 GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist) { 484 GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist) {
481 485
482 int g, bytesNeeded; 486 int g;
487 size_t bytesNeeded;
483 jlong *imagePtrs; 488 jlong *imagePtrs;
484 jfloat* positions = NULL; 489 jfloat* positions = NULL;
485 GlyphInfo *ginfo; 490 GlyphInfo *ginfo;
486 GlyphBlitVector *gbv; 491 GlyphBlitVector *gbv;
487 492
498 jboolean subPixPos = 503 jboolean subPixPos =
499 (*env)->GetBooleanField(env,glyphlist, sunFontIDs.lcdSubPixPos); 504 (*env)->GetBooleanField(env,glyphlist, sunFontIDs.lcdSubPixPos);
500 505
501 bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len; 506 bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len;
502 gbv = (GlyphBlitVector*)malloc(bytesNeeded); 507 gbv = (GlyphBlitVector*)malloc(bytesNeeded);
508 if (gbv == NULL) {
509 return NULL;
510 }
503 gbv->numGlyphs = len; 511 gbv->numGlyphs = len;
504 gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector)); 512 gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector));
505 513
506 imagePtrs = (*env)->GetPrimitiveArrayCritical(env, glyphImages, NULL); 514 imagePtrs = (*env)->GetPrimitiveArrayCritical(env, glyphImages, NULL);
507 if (imagePtrs == NULL) { 515 if (imagePtrs == NULL) {