< prev index next >

modules/javafx.graphics/src/main/native-font/coretext.c

Print this page

        

*** 632,653 **** JNIEXPORT jint JNICALL OS_NATIVE(CTRunGetGlyphs) (JNIEnv *env, jclass that, jlong runRef, jint slotMask, jint start, jintArray bufferRef) { CTRunRef run = (CTRunRef)runRef; const CGGlyph * glyphs = CTRunGetGlyphsPtr(run); int i = 0; if (glyphs) { jint* buffer = (*env)->GetPrimitiveArrayCritical(env, bufferRef, NULL); if (buffer) { - CFIndex count = CTRunGetGlyphCount(run); while(i < count) { buffer[start + i] = slotMask | (glyphs[i] & 0xFFFF); i++; } (*env)->ReleasePrimitiveArrayCritical(env, bufferRef, buffer, 0); } } return i; } JNIEXPORT jint JNICALL OS_NATIVE(CTRunGetPositions) (JNIEnv *env, jclass that, jlong runRef, jint start, jfloatArray bufferRef) --- 632,673 ---- JNIEXPORT jint JNICALL OS_NATIVE(CTRunGetGlyphs) (JNIEnv *env, jclass that, jlong runRef, jint slotMask, jint start, jintArray bufferRef) { CTRunRef run = (CTRunRef)runRef; const CGGlyph * glyphs = CTRunGetGlyphsPtr(run); + CFIndex count = CTRunGetGlyphCount(run); + if(count == 0) { + return 0; + } + + CGGlyph* tempGlyphs = NULL; + if(!glyphs) + { + tempGlyphs = (CGGlyph*) malloc(count * sizeof(CGGlyph)); + if(!tempGlyphs) { + return 0; + } + + CTRunGetGlyphs(run, CFRangeMake(0 ,0), tempGlyphs); + glyphs = tempGlyphs; + } + int i = 0; if (glyphs) { jint* buffer = (*env)->GetPrimitiveArrayCritical(env, bufferRef, NULL); if (buffer) { while(i < count) { buffer[start + i] = slotMask | (glyphs[i] & 0xFFFF); i++; } (*env)->ReleasePrimitiveArrayCritical(env, bufferRef, buffer, 0); } } + + if(tempGlyphs) { + free(tempGlyphs); + } return i; } JNIEXPORT jint JNICALL OS_NATIVE(CTRunGetPositions) (JNIEnv *env, jclass that, jlong runRef, jint start, jfloatArray bufferRef)
< prev index next >