src/solaris/native/sun/java2d/x11/XRBackendNative.c

Print this page




 807             gids[i] = jgids[i];
 808         }
 809         XRenderFreeGlyphs(awt_display,
 810                           (GlyphSet) glyphSet, gids, glyphCnt);
 811         (*env)->ReleasePrimitiveArrayCritical(env, gidArray,
 812                                               jgids, JNI_ABORT);
 813         if (gids != stack_ids) {
 814             free(gids);
 815         }
 816     }
 817 }
 818 
 819 JNIEXPORT jint JNICALL
 820 Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative
 821  (JNIEnv *env, jclass cls, jlong format) {
 822   return XRenderCreateGlyphSet(awt_display, (XRenderPictFormat *) jlong_to_ptr(format));
 823 }
 824 
 825 JNIEXPORT void JNICALL
 826 Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative
 827  (JNIEnv *env, jclass cls, jint op, jint src, jint dst, jlong maskFmt,
 828   jintArray eltArray, jintArray  glyphIDArray, jint eltCnt, jint glyphCnt) {

 829     jint i;
 830     jint *ids;
 831     jint *elts;
 832     XGlyphElt32 *xelts;
 833     unsigned int *xids;
 834     XGlyphElt32 selts[24];
 835     unsigned int sids[256];
 836     int charCnt = 0;
 837 
 838     if (eltCnt <= 24) {
 839       xelts = &selts[0];
 840     }else {
 841       xelts = (XGlyphElt32 *) malloc(sizeof(XGlyphElt32) * eltCnt);
 842       if (xelts == NULL) {
 843           return;
 844       }
 845     }
 846 
 847     if (glyphCnt <= 256) {
 848       xids = &sids[0];


 878         }
 879         return;
 880     }
 881 
 882     for (i=0; i < glyphCnt; i++) {
 883       xids[i] = ids[i];
 884     }
 885 
 886     for (i=0; i < eltCnt; i++) {
 887       xelts[i].nchars = elts[i*4 + 0];
 888       xelts[i].xOff = elts[i*4 + 1];
 889       xelts[i].yOff = elts[i*4 + 2];
 890       xelts[i].glyphset = (GlyphSet) elts[i*4 + 3];
 891       xelts[i].chars = &xids[charCnt];
 892 
 893       charCnt += xelts[i].nchars;
 894     }
 895 
 896     XRenderCompositeText32(awt_display, op, (Picture) src, (Picture) dst,
 897                            (XRenderPictFormat *) jlong_to_ptr(maskFmt),
 898                             0, 0, 0, 0, xelts, eltCnt);
 899 
 900     (*env)->ReleasePrimitiveArrayCritical(env, glyphIDArray, ids, JNI_ABORT);
 901     (*env)->ReleasePrimitiveArrayCritical(env, eltArray, elts, JNI_ABORT);
 902 
 903     if (xelts != &selts[0]) {
 904         free(xelts);
 905     }
 906 
 907     if (xids != &sids[0]) {
 908         free(xids);
 909     }
 910 }
 911 
 912 JNIEXPORT void JNICALL
 913 Java_sun_java2d_xr_XRBackendNative_setGCMode
 914  (JNIEnv *env, jobject this, jlong gc, jboolean copy) {
 915   GC xgc = (GC) jlong_to_ptr(gc);
 916 
 917   if (copy == JNI_TRUE) {
 918     XSetFunction(awt_display, xgc, GXcopy);




 807             gids[i] = jgids[i];
 808         }
 809         XRenderFreeGlyphs(awt_display,
 810                           (GlyphSet) glyphSet, gids, glyphCnt);
 811         (*env)->ReleasePrimitiveArrayCritical(env, gidArray,
 812                                               jgids, JNI_ABORT);
 813         if (gids != stack_ids) {
 814             free(gids);
 815         }
 816     }
 817 }
 818 
 819 JNIEXPORT jint JNICALL
 820 Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative
 821  (JNIEnv *env, jclass cls, jlong format) {
 822   return XRenderCreateGlyphSet(awt_display, (XRenderPictFormat *) jlong_to_ptr(format));
 823 }
 824 
 825 JNIEXPORT void JNICALL
 826 Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative
 827  (JNIEnv *env, jclass cls, jint op, jint src, jint dst, 
 828   jint sx, jint sy, jlong maskFmt, jintArray eltArray, 
 829   jintArray  glyphIDArray, jint eltCnt, jint glyphCnt) {
 830     jint i;
 831     jint *ids;
 832     jint *elts;
 833     XGlyphElt32 *xelts;
 834     unsigned int *xids;
 835     XGlyphElt32 selts[24];
 836     unsigned int sids[256];
 837     int charCnt = 0;
 838 
 839     if (eltCnt <= 24) {
 840       xelts = &selts[0];
 841     }else {
 842       xelts = (XGlyphElt32 *) malloc(sizeof(XGlyphElt32) * eltCnt);
 843       if (xelts == NULL) {
 844           return;
 845       }
 846     }
 847 
 848     if (glyphCnt <= 256) {
 849       xids = &sids[0];


 879         }
 880         return;
 881     }
 882 
 883     for (i=0; i < glyphCnt; i++) {
 884       xids[i] = ids[i];
 885     }
 886 
 887     for (i=0; i < eltCnt; i++) {
 888       xelts[i].nchars = elts[i*4 + 0];
 889       xelts[i].xOff = elts[i*4 + 1];
 890       xelts[i].yOff = elts[i*4 + 2];
 891       xelts[i].glyphset = (GlyphSet) elts[i*4 + 3];
 892       xelts[i].chars = &xids[charCnt];
 893 
 894       charCnt += xelts[i].nchars;
 895     }
 896 
 897     XRenderCompositeText32(awt_display, op, (Picture) src, (Picture) dst,
 898                            (XRenderPictFormat *) jlong_to_ptr(maskFmt),
 899                             sx, sy, 0, 0, xelts, eltCnt);
 900 
 901     (*env)->ReleasePrimitiveArrayCritical(env, glyphIDArray, ids, JNI_ABORT);
 902     (*env)->ReleasePrimitiveArrayCritical(env, eltArray, elts, JNI_ABORT);
 903 
 904     if (xelts != &selts[0]) {
 905         free(xelts);
 906     }
 907 
 908     if (xids != &sids[0]) {
 909         free(xids);
 910     }
 911 }
 912 
 913 JNIEXPORT void JNICALL
 914 Java_sun_java2d_xr_XRBackendNative_setGCMode
 915  (JNIEnv *env, jobject this, jlong gc, jboolean copy) {
 916   GC xgc = (GC) jlong_to_ptr(gc);
 917 
 918   if (copy == JNI_TRUE) {
 919     XSetFunction(awt_display, xgc, GXcopy);