Esempio n. 1
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    setPenT4
 * Signature: ([F)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_setPenT4
  (JNIEnv *env, jobject obj, jfloatArray t4)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (t4 == NULL) {
	(*cdata->stroker)->setPenT4(cenv, cdata->stroker, NULL);
    } else {
	jfloat* ct4;
	if (((*env)->GetArrayLength(env, t4)) < 4) {
	    doeError_set(cenv, dcPRError, dcPRError_BAD_pent4);
	    CJError_throw(cenv);
	    return;
	}
	ct4 = (*env)->GetPrimitiveArrayCritical(env, t4, NULL);
	(*cdata->stroker)->setPenT4(cenv, cdata->stroker, (f32*)ct4);
	(*env)->ReleasePrimitiveArrayCritical(env, t4, ct4, JNI_ABORT);
    }
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 2
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    cClassInitialize
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_cClassInitialize
  (JNIEnv *env, jclass cls)
{
    doeE	cenv	= doeE_make();
    doeE_setPCtxt(cenv, env);

    CJPathConsumer_staticInitialize(cenv);
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }

    dcPathDasher_staticInitialize(cenv);
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }

    doeE_destroy(cenv);

    /*
     * Cacheing the class specific data
     */
    clsDasher	= (*env)->NewGlobalRef(env, cls);
    fidCData	= (*env)->GetFieldID(env, cls, "cData", "J");
}
Esempio n. 3
0
/*
 * Disposer Method Called by Disposer thread
 * All the native memory associated with stroker is  cleaned here.
 */
void PathStroker_DisposeOps(JNIEnv *env, jlong ops)
{
    doeObject	cobj;
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(ops);
    doeE	cenv;

    /* protect against getting called twice */
    if (cdata == NULL) {
        return;
    }

    cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    cobj = (doeObject)(cdata->stroker);
    (*cobj)->_cleanup(cenv, cobj);
    doeMem_free(cenv, cobj);

    cobj = (doeObject)(cdata->cjout);
    (*cobj)->_cleanup(cenv, cobj);
    doeMem_free(cenv, cobj);

    doeMem_free(cenv, cdata);

    doeE_destroy(cenv);
}
Esempio n. 4
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    setOutputT6
 * Signature: ([F)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_setOutputT6
  (JNIEnv *env, jobject obj, jfloatArray t6)
{
    PathDasher	cdata	= (PathDasher)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (t6 == NULL) {
	(*cdata->dasher)->setOutputT6(cenv, cdata->dasher, NULL);
    } else {
	jfloat*	ct6;
	if (((*env)->GetArrayLength(env, t6)) < 6) {
	    doeError_set(cenv, dcPRError, dcPRError_BAD_outputt6);
	    CJError_throw(cenv);
	    return;
	}
	ct6 = (*env)->GetPrimitiveArrayCritical(env, t6, NULL);
	(*cdata->dasher)->setOutputT6(cenv, cdata->dasher, (f32*)ct6);
	(*env)->ReleasePrimitiveArrayCritical(env, t6, ct6, JNI_ABORT);
    }
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 5
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    cInitialize
 * Signature: (Lsun/dc/path/PathConsumer;)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_cInitialize
  (JNIEnv *env, jobject obj, jobject out)
{
    jclass	cls;
    jfieldID	fid;
    jmethodID	mid;

    PathStroker	cdata;

    doeE	cenv	= doeE_make();
    doeE_setPCtxt(cenv, env);

    cdata = (PathStroker)doeMem_malloc(cenv, sizeof(PathStrokerData));
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }
    (*env)->SetLongField(env, obj, fidCData, ptr_to_jlong(cdata));

    /* __________________________
     * the c environment variable
     */
    cdata->env = cenv;

    /* Register the data for disposal */
    Disposer_AddRecord(env, obj, PathStroker_DisposeOps, ptr_to_jlong(cdata));

    /* __________________________________
     * the corresponding CJ path consumer
     * (always created so as to be able to deal with any type of
     *  incoming out path consumers)
     */
    cdata->cjout = CJPathConsumer_create(cenv, out);
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }

    /* ________________________________________________
     * determines if "out" has a native implementation.
     */
    cls = (*env)->GetObjectClass(env, out);
    mid = (*env)->GetMethodID(env, cls, "getCPathConsumer", "()J");
    cdata->cout = (dcPathConsumer)
	jlong_to_ptr((*env)->CallLongMethod(env, out, mid));

    /* ________________________
     * the actual c PathStroker
     */
    if (cdata->cout) {
	cdata->stroker = dcPathStroker_create(cenv, cdata->cout);
    } else {
	cdata->stroker = dcPathStroker_create(cenv, (dcPathConsumer)cdata->cjout);
    }
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }
}
Esempio n. 6
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    reset
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_reset
  (JNIEnv *env, jobject obj)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    (*cdata->stroker)->reset(cenv, cdata->stroker);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 7
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    appendQuadratic
 * Signature: (FFFF)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_appendQuadratic
  (JNIEnv *env, jobject obj, jfloat xm, jfloat ym, jfloat x1, jfloat y1)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));
    dcPathConsumer
		cstroker= (dcPathConsumer)(cdata->stroker);

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    (*cstroker)->appendQuadratic(cenv, cstroker, xm, ym, x1, y1);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 8
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    beginSubpath
 * Signature: (FF)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_beginSubpath
  (JNIEnv *env, jobject obj, jfloat x0, jfloat y0)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));
    dcPathConsumer
		cstroker= (dcPathConsumer)(cdata->stroker);

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    (*cstroker)->beginSubpath(cenv, cstroker, x0, y0);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 9
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    closedSubpath
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_closedSubpath
  (JNIEnv *env, jobject obj)
{
    PathDasher	cdata	= (PathDasher)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));
    dcPathConsumer
		cdasher	= (dcPathConsumer)(cdata->dasher);

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    (*cdasher)->closedSubpath(cenv, cdasher);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 10
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    cClassFinalize
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_cClassFinalize
  (JNIEnv *env, jclass cls)
{
    doeE	cenv	= doeE_make();
    doeE_setPCtxt(cenv, env);

    CJPathConsumer_staticFinalize(cenv);
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }
    dcPathStroker_staticFinalize(cenv);
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }
    doeE_destroy(cenv);

    (*env)->DeleteGlobalRef(env, clsStroker);
}
Esempio n. 11
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    cClassInitialize
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_cClassInitialize
  (JNIEnv *env, jclass cls)
{
    jfieldID	fid;

    doeE	cenv	= doeE_make();
    doeE_setPCtxt(cenv, env);

    CJPathConsumer_staticInitialize(cenv);
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }
    dcPathStroker_staticInitialize(cenv);
    if (doeError_occurred(cenv)) {
	CJError_throw(cenv);
	return;
    }
    doeE_destroy(cenv);

    /* ________________________________
     * Cacheing the class specific data
     */
    clsStroker	= (*env)->NewGlobalRef(env, cls);
    fidCData	= (*env)->GetFieldID(env, cls, "cData", "J");

    fid	    = (*env)->GetStaticFieldID (env, cls, "ROUND", "I");
    jround  = (*env)->GetStaticIntField(env, cls, fid);

    fid	    = (*env)->GetStaticFieldID (env, cls, "SQUARE", "I");
    jsquare = (*env)->GetStaticIntField(env, cls, fid);

    fid	    = (*env)->GetStaticFieldID (env, cls, "BUTT", "I");
    jbutt   = (*env)->GetStaticIntField(env, cls, fid);

    fid	    = (*env)->GetStaticFieldID (env, cls, "MITER", "I");
    jmiter  = (*env)->GetStaticIntField(env, cls, fid);

    fid	    = (*env)->GetStaticFieldID (env, cls, "BEVEL", "I");
    jbevel  = (*env)->GetStaticIntField(env, cls, fid);
}
Esempio n. 12
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    setDash
 * Signature: ([FF)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_setDash
  (JNIEnv *env, jobject obj, jfloatArray dash, jfloat offset)
{
    PathDasher	cdata	= (PathDasher)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (dash == NULL) {
	(*cdata->dasher)->setDash(cenv, cdata->dasher, NULL, 0, offset);
    } else {
	jint	len	= (*env)->GetArrayLength(env, dash);
	jfloat*	cdash	= (*env)->GetPrimitiveArrayCritical(env, dash, NULL);  

	(*cdata->dasher)->setDash(cenv, cdata->dasher, cdash, len, offset);
	(*env)->ReleasePrimitiveArrayCritical(env, dash, cdash, JNI_ABORT);
    }
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 13
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    setCorners
 * Signature: (IF)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_setCorners
  (JNIEnv *env, jobject obj, jint corners, jfloat miterlimit)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (corners == jround)
	corners = dcPathStroker_ROUND;
    else
	if (corners == jmiter)
	    corners = dcPathStroker_MITER;
	else
	    if (corners == jbevel)
		corners = dcPathStroker_BEVEL;

    (*cdata->stroker)->setCorners(cenv, cdata->stroker, corners, miterlimit);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 14
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    setCaps
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_setCaps
  (JNIEnv *env, jobject obj, jint caps)
{
    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    if (caps == jround)
	caps = dcPathStroker_ROUND;
    else
	if (caps == jsquare)
	    caps = dcPathStroker_SQUARE;
	else
	    if (caps == jbutt)
		caps = dcPathStroker_BUTT;

    (*cdata->stroker)->setCaps(cenv, cdata->stroker, caps);
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}
Esempio n. 15
0
/*
 * Class:     sun_dc_pr_PathDasher
 * Method:    dispose
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathDasher_dispose
  (JNIEnv *env, jobject obj)
{
    PathDasher	cdata	= (PathDasher)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));
    doeObject	cobj;

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    cobj = (doeObject)(cdata->dasher);
    (*cobj)->_cleanup(cenv, cobj);
    doeMem_free(cenv, cobj);

    cobj = (doeObject)(cdata->cjout);
    (*cobj)->_cleanup(cenv, cobj);
    doeMem_free(cenv, cobj);

    doeMem_free(cenv, cdata);

    doeE_destroy(cenv);
}
Esempio n. 16
0
/*
 * Class:     sun_dc_pr_PathStroker
 * Method:    setOutputConsumer
 * Signature: (Lsun/dc/path/PathConsumer;)V
 */
JNIEXPORT void JNICALL Java_sun_dc_pr_PathStroker_setOutputConsumer
  (JNIEnv *env, jobject obj, jobject out)
{
    jclass	cls;
    jmethodID	mid;

    PathStroker	cdata	= (PathStroker)jlong_to_ptr(((*env)->GetLongField(env, obj, fidCData)));

    doeE	cenv	= cdata->env;
    doeE_setPCtxt(cenv, env);
    doeError_reset(cenv);

    /* ________________________________________________
     * determines if "out" has a native implementation.
     */
    cls = (*env)->GetObjectClass(env, out);
    mid = (*env)->GetMethodID(env, cls, "getCPathConsumer", "()J");
    cdata->cout = (dcPathConsumer)
	jlong_to_ptr((*env)->CallLongMethod(env, out, mid));

    if (cdata->cout) {
	(*cdata->stroker)->setOutputConsumer(cenv, cdata->stroker, cdata->cout);
    } else {
	/*
	 * update CJ stub to use new java path consumer
	 */
	(*cdata->cjout)->setJPathConsumer(cenv, cdata->cjout, out);
	if (doeError_occurred(cenv)) {
	    CJError_throw(cenv);
	    return;
	}
	(*cdata->stroker)->setOutputConsumer(cenv, cdata->stroker,
					 (dcPathConsumer)cdata->cjout);
    }
    if (doeError_occurred(cenv))
	CJError_throw(cenv);
}