< prev index next >

src/java.desktop/share/native/libfontmanager/sunFont.c

Print this page




 202 JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) {
 203 
 204     initFontIDs(env);
 205     return sunFontIDs;
 206 }
 207 
 208 /*
 209  * Class:     sun_font_StrikeCache
 210  * Method:    freeIntPointer
 211  * Signature: (I)V
 212  */
 213 JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeIntPointer
 214     (JNIEnv *env, jclass cacheClass, jint ptr) {
 215 
 216     /* Note this is used for freeing a glyph which was allocated
 217      * but never placed into the glyph cache. The caller holds the
 218      * only reference, therefore it is unnecessary to invalidate any
 219      * accelerated glyph cache cells as we do in freeInt/LongMemory().
 220      */
 221     if (ptr != 0) {
 222         free((void*)ptr);
 223     }
 224 }
 225 
 226 /*
 227  * Class:     sun_font_StrikeCache
 228  * Method:    freeLongPointer
 229  * Signature: (J)V
 230  */
 231 JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeLongPointer
 232     (JNIEnv *env, jclass cacheClass, jlong ptr) {
 233 
 234     /* Note this is used for freeing a glyph which was allocated
 235      * but never placed into the glyph cache. The caller holds the
 236      * only reference, therefore it is unnecessary to invalidate any
 237      * accelerated glyph cache cells as we do in freeInt/LongMemory().
 238      */
 239     if (ptr != 0L) {
 240         free(jlong_to_ptr(ptr));
 241     }
 242 }
 243 
 244 /*
 245  * Class:     sun_font_StrikeCache
 246  * Method:    freeIntMemory
 247  * Signature: ([I)V
 248  */
 249 JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeIntMemory
 250     (JNIEnv *env, jclass cacheClass, jintArray jmemArray, jlong pContext) {
 251 
 252     int len = (*env)->GetArrayLength(env, jmemArray);
 253     jint* ptrs =
 254         (jint*)(*env)->GetPrimitiveArrayCritical(env, jmemArray, NULL);
 255     int i;
 256 
 257     if (ptrs) {
 258         for (i=0; i< len; i++) {
 259             if (ptrs[i] != 0) {
 260                 GlyphInfo *ginfo = (GlyphInfo *)ptrs[i];
 261                 if (ginfo->cellInfo != NULL &&
 262                     ginfo->managed == MANAGED_GLYPH) {
 263                     // invalidate this glyph's accelerated cache cell
 264                     AccelGlyphCache_RemoveAllCellInfos(ginfo);
 265                 }
 266                 free((void*)ginfo);
 267             }
 268         }
 269         (*env)->ReleasePrimitiveArrayCritical(env, jmemArray, ptrs, JNI_ABORT);
 270     }
 271     if (!isNullScalerContext(jlong_to_ptr(pContext))) {
 272         free(jlong_to_ptr(pContext));
 273     }
 274 }
 275 
 276 /*
 277  * Class:     sun_font_StrikeCache
 278  * Method:    freeLongMemory
 279  * Signature: ([J)V
 280  */
 281 JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeLongMemory
 282     (JNIEnv *env, jclass cacheClass, jlongArray jmemArray, jlong pContext) {
 283 
 284     int len = (*env)->GetArrayLength(env, jmemArray);
 285     jlong* ptrs =
 286         (jlong*)(*env)->GetPrimitiveArrayCritical(env, jmemArray, NULL);




 202 JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) {
 203 
 204     initFontIDs(env);
 205     return sunFontIDs;
 206 }
 207 
 208 /*
 209  * Class:     sun_font_StrikeCache
 210  * Method:    freeIntPointer
 211  * Signature: (I)V
 212  */
 213 JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeIntPointer
 214     (JNIEnv *env, jclass cacheClass, jint ptr) {
 215 
 216     /* Note this is used for freeing a glyph which was allocated
 217      * but never placed into the glyph cache. The caller holds the
 218      * only reference, therefore it is unnecessary to invalidate any
 219      * accelerated glyph cache cells as we do in freeInt/LongMemory().
 220      */
 221     if (ptr != 0) {
 222         free((void*)((intptr_t)ptr));
 223     }
 224 }
 225 
 226 /*
 227  * Class:     sun_font_StrikeCache
 228  * Method:    freeLongPointer
 229  * Signature: (J)V
 230  */
 231 JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeLongPointer
 232     (JNIEnv *env, jclass cacheClass, jlong ptr) {
 233 
 234     /* Note this is used for freeing a glyph which was allocated
 235      * but never placed into the glyph cache. The caller holds the
 236      * only reference, therefore it is unnecessary to invalidate any
 237      * accelerated glyph cache cells as we do in freeInt/LongMemory().
 238      */
 239     if (ptr != 0L) {
 240         free(jlong_to_ptr(ptr));
 241     }
 242 }
 243 
 244 /*
 245  * Class:     sun_font_StrikeCache
 246  * Method:    freeIntMemory
 247  * Signature: ([I)V
 248  */
 249 JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeIntMemory
 250     (JNIEnv *env, jclass cacheClass, jintArray jmemArray, jlong pContext) {
 251 
 252     int len = (*env)->GetArrayLength(env, jmemArray);
 253     jint* ptrs =
 254         (jint*)(*env)->GetPrimitiveArrayCritical(env, jmemArray, NULL);
 255     int i;
 256 
 257     if (ptrs) {
 258         for (i=0; i< len; i++) {
 259             if (ptrs[i] != 0) {
 260                 GlyphInfo *ginfo = (GlyphInfo *)((intptr_t)ptrs[i]);
 261                 if (ginfo->cellInfo != NULL &&
 262                     ginfo->managed == MANAGED_GLYPH) {
 263                     // invalidate this glyph's accelerated cache cell
 264                     AccelGlyphCache_RemoveAllCellInfos(ginfo);
 265                 }
 266                 free(ginfo);
 267             }
 268         }
 269         (*env)->ReleasePrimitiveArrayCritical(env, jmemArray, ptrs, JNI_ABORT);
 270     }
 271     if (!isNullScalerContext(jlong_to_ptr(pContext))) {
 272         free(jlong_to_ptr(pContext));
 273     }
 274 }
 275 
 276 /*
 277  * Class:     sun_font_StrikeCache
 278  * Method:    freeLongMemory
 279  * Signature: ([J)V
 280  */
 281 JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeLongMemory
 282     (JNIEnv *env, jclass cacheClass, jlongArray jmemArray, jlong pContext) {
 283 
 284     int len = (*env)->GetArrayLength(env, jmemArray);
 285     jlong* ptrs =
 286         (jlong*)(*env)->GetPrimitiveArrayCritical(env, jmemArray, NULL);


< prev index next >