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
static void
useProxy(doeE env, dcPathConsumer pc, dcFastPathProducer proxy)
{
    dcPathFillerData*	p = (dcPathFillerData*)pc;
    dcFastPathProducer	fpp = p->thisFPP;

    ((dcPathConsumerFace*)&dcPathStoreClass)->useProxy(env, pc, proxy);
    if (doeError_occurred(env))	return;

    (*proxy)->getBox(env, proxy, p->pathBox);
    if (doeError_occurred(env))	return;

#ifdef DEBUG
   /*
    * Set the exception to indicate that some segments of the path have
    * way too large coordinates. The exception will be eaten at java level.
    * See 4485298 for more info.
    */
    if (!(	dcPathFiller_validLoCoord(p->pathBox[0])	&&
		dcPathFiller_validLoCoord(p->pathBox[1])	&&
		dcPathFiller_validHiCoord(p->pathBox[2])	&&
		dcPathFiller_validHiCoord(p->pathBox[3]))) {
	doeError_set(env, dcPathException, dcPathException_BAD_PATH_useProxy);
    }
#endif

 }
Esempio n. 3
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. 4
0
static void
setFillMode(doeE env, dcPathFiller pf, ixx fillmode)
{
    dcPathFillerData* p = (dcPathFillerData*)pf;

    if (stateCheck(p, setFillModeDone)) {
	doeError_set(env, dcPRError, dcPRError_UNEX_setUsage);
	return;
    }

    if (fillmode != dcPathFiller_NZFILL && fillmode != dcPathFiller_EOFILL) {
	doeError_set(env, dcPRError, dcPRError_UNK_fillmode);
	return;
    }
    p->redundantReset = FALSE;
    p->fillmode = fillmode;
    stateSet(p, setFillModeDone);
}
Esempio n. 5
0
static void
writeAlpha16(	doeE env, dcPathFiller pf,
		u16* alpha, i32 xstride, i32 ystride, i32 pix0offset)
{
    dcPathFillerData*	p = (dcPathFillerData*)pf;
    dcLLFiller		ll;

    if (!stateCheck(p, setOutputAreaDone)) {
	doeError_set(env, dcPRError, dcPRError_UNEX_writeAlpha);
	return;
    }
    if (alpha == NULL || xstride <= 0 || ystride <= 0 || pix0offset < 0) {
	doeError_set(env, dcPRError, dcPRError_BAD_alphadest);
	return;
    }

    ll = dcLLFiller_get(env);
    if (doeError_occurred(env))
	return;

    if (p->fastOutput) {
	FastOutputPC		fopc = p->fastOutputPC;
	dcFastPathProducer	fpp  = p->thisFPP;

	(*ll)->setParams(env, ll, p->fillmode, p->outW, p->outH);
	(*fopc)->setUpAlpha16(	env, fopc, ll,
				-p->outLoX, -p->outLoY,
				alpha, xstride, ystride, pix0offset);
	(*fpp)->sendTo(env, fpp, (dcPathConsumer)fopc);
    } else {
	i32 tilew = MIN(p->outW -  ((p->tileXI - 1) << dcPathFiller_tileSizeL2S),
			dcPathFiller_tileSize);
	(*ll)->setParams(env, ll, p->fillmode, tilew, p->rowH);
	sendTileToLLFiller(env, pf, ll);
	(*ll)->writeAlpha16(env, ll, alpha, xstride, ystride, pix0offset);
    }
    dcLLFiller_release(env, ll);

    nextTile(env,pf);
}
Esempio n. 6
0
static void
getAlphaBox(doeE env, dcPathFiller pf, i32* box)
{
    dcPathFillerData*	p = (dcPathFillerData*)pf;

    if (!((dcPathStoreData*)p)->pathDefined) {
	doeError_set(env, dcPRError, dcPRError_UNEX_getAlphaBox);
	return;
    }

    box[0] = (i32)floor(p->pathBox[0]);
    box[1] = (i32)floor(p->pathBox[1]);
    box[2] = (i32)ceil (p->pathBox[2]);
    box[3] = (i32)ceil (p->pathBox[3]);
}
Esempio n. 7
0
static ixx
getTileState(doeE env, dcPathFiller pf)
{
    dcPathFillerData*	p = (dcPathFillerData*)pf;
    Run			r;
    ixx			lscount;
    LeftSide		ls;

    if (!stateCheck(p, setOutputAreaDone)) {
	doeError_set(env, dcPRError, dcPRError_UNEX_getTileState);
	return -1;
    }

    /* "fast output" situations are never trivial */
    if (p->fastOutput) {
	return dcPathFiller_TILE_IS_GENERAL;
    }

    /* two conditions must be met for a tile to be trivial:
	1. the tile itself must contain no runs
	2. the list lsEffects must consist exclusively of
	   "full height" left sides
     */
    r = p->tileRuns[p->tileXI][p->tileYI];
    if (r != NULL) {
	return dcPathFiller_TILE_IS_GENERAL;
    }

    lscount = 0;
    for (ls = p->lsEffects; ls != NULL; ls = ls->next) {
	if (ls->y0 == 0.0F && ls->y1 == p->rowHTiF) {
	    lscount++;
	    continue;
	}
	if (ls->y1 == 0.0F && ls->y0 == p->rowHTiF) {
	    lscount--;
	    continue;
	}
	return dcPathFiller_TILE_IS_GENERAL;
    }

    if (p->fillmode == dcPathFiller_EOFILL)
	lscount &= 1;

    return (lscount != 0)?
		dcPathFiller_TILE_IS_ALL_1 :
		dcPathFiller_TILE_IS_ALL_0;
}
Esempio n. 8
0
static void
nextTile(doeE env, dcPathFiller pf)
{
    dcPathFillerData*	p = (dcPathFillerData*)pf;

    if (!stateCheck(p, setOutputAreaDone)) {
	doeError_set(env, dcPRError, dcPRError_UNEX_nextTile);
	return;
    }

    if (p->fastOutput) {
	stateReset(p, setOutputAreaDone);
	return;
    }

    /* advance x tile index */
    p->tileXI++;
    if (p->tileXI > p->outWTi) { /* tileXI in [1, outWITi] */
	/* clear left side effects */
	LeftSide_releaseList(env, p->lsEffects);
	p->lsEffects = NULL;

	p->tileXI = 1; /* 0 is left-open tile */
	p->tileYI++;

	if (p->tileYI >= p->outHTi) {
	    stateReset(p, setOutputAreaDone);
	    return;
	}

	p->rowH = p->outH - (p->tileYI << dcPathFiller_tileSizeL2S);
	if (p->rowH > dcPathFiller_tileSize)
	    p->rowH = dcPathFiller_tileSize;
	p->rowHTiF = (f32)p->rowH / dcPathFiller_tileSizeF;
    }

    /* update left side effects */
    {   Run r;

	for (r = p->tileRuns[p->tileXI - 1][p->tileYI]; r != NULL; r = r->next) {
	    f32		rspy0 = r->rspy0;
	    f32		rspy1 = r->rspy1;
	    LeftSide	ls, lslink, tmp;

	    /* no rightside projection? */
	    if (rspy1 == rspyImpossibleTss) {
		continue;
	    }

	    /* constrain [rsp] to the interval [0,rowHTiF] */
	    if (rspy0 < 0.0F)		rspy0 = 0.0F;
	    if (rspy1 < 0.0F)		rspy1 = 0.0F;
	    if (rspy0 > p->rowHTiF)	rspy0 = p->rowHTiF;
	    if (rspy1 > p->rowHTiF)	rspy1 = p->rowHTiF;

	    /* for each [ls] in [lsEffects] check whether [rsp]
	       extends it; if so, modify [rsp] accordingly and remove
	       [ls] from [lsEffects] */
	    ls =	p->lsEffects;
	    lslink =	NULL;
	    while (ls != NULL) {
		if (rspy1 == ls->y0 || rspy0 == ls->y1) {
		    if (rspy1 == ls->y0)	rspy1 = ls->y1;
		    else			rspy0 = ls->y0;
		    if (lslink == NULL)
			p->lsEffects = ls->next;
		    else
			lslink->next = ls->next;

		    tmp = ls->next;
		    ls->next = NULL;
		    LeftSide_releaseList(env, ls);
		    ls = tmp;
		} else {
		    lslink = ls;
		    ls = ls->next;
		}
	    }

	    /* if [rsp] still produces an effect, insert it in [lsEffect] */
	    if (rspy0 != rspy1) {
		ls = LeftSide_create(env, p->poolLeftSide); if (ls == NULL) return;
		ls->y0 = rspy0;
		ls->y1 = rspy1;
		ls->next = p->lsEffects;
		p->lsEffects = ls;
	    }
	}
    }
}
Esempio n. 9
0
static void
setOutputArea(doeE env, dcPathFiller pf, f32 outlox, f32 outloy, i32 w, i32 h)
{
    dcPathFillerData*	p = (dcPathFillerData*)pf;
    dcFastPathProducer	fpp = p->thisFPP;
    i32			xi, yi;

    /* check state, parameters */
    if (!((dcPathStoreData*)p)->pathDefined) {
	doeError_set(env, dcPRError, dcPRError_UNEX_setOutputArea);
	return;
    }
    if (w <= 0 || h <= 0) {
	doeError_set(env, dcPRError, dcPRError_BAD_outputarea);
	return;
    }
    if (!(	dcPathFiller_validLoCoord(outlox)	&&
		dcPathFiller_validLoCoord(outloy)	&&
		dcPathFiller_validHiCoord(outlox + w)	&&
		dcPathFiller_validHiCoord(outloy + h))) {
	doeError_set(env, dcPRException, dcPRException_BAD_COORD_setOutputArea);
	return;
    }

    stateSet(p, setOutputAreaDone);

    p->outLoX = outlox;
    p->outLoY = outloy;
    p->outW   = w;
    p->outH   = h;
    p->outWTiF = w / dcPathFiller_tileSizeF;
    p->outHTiF = h / dcPathFiller_tileSizeF;

    if (p->tileRuns != NULL)
	doeMem_free(env, p->tileRuns);

    p->fastOutput =	w <= dcPathFiller_tileSize	&&
			h <= dcPathFiller_tileSize	&&
			p->pathBox[0] >= outlox		&&
			p->pathBox[1] >= outloy		&&
			p->pathBox[2] <= outlox + w	&&
			p->pathBox[3] <= outloy + h;

    if (p->fastOutput)
	return;

    /* allocate [tileRuns], indexed [xindex][yindex];
       (here we reuse [w] and [h] as width and height in tiles) */
    p->outWTi = w = (p->outW + dcPathFiller_tileSize - 1) >> dcPathFiller_tileSizeL2S;
    p->outHTi = h = (p->outH + dcPathFiller_tileSize - 1) >> dcPathFiller_tileSizeL2S;
    
    p->tileRuns = doeMem_malloc(env, 
			  sizeof(Run*)*(w + 1)	/* array  of (Run*), indexed by X */
			+ sizeof(Run )*(w + 1)*h/* arrays of (Run),  indexed by Y */
		  );
    if (p->tileRuns == NULL) {
	doeError_setNoMemory(env);
	return;
    }
    for (xi = 0; xi <= w; xi++) {
	p->tileRuns[xi] = (Run*)(p->tileRuns + w + 1) + xi * h;
    }
    for (yi = 0; yi < h; yi++) {
	for (xi = 0; xi <= w; xi++) {
	    p->tileRuns[xi][yi] = NULL;
	}
    }

    (*fpp)->sendTo(env, fpp, p->runsBuilder);
    if (doeError_occurred(env)) {
	doeError_setNoMemory(env);
	return;
    }

    /* set things so [nextTile] will advance to the 1st tile */
    p->tileXI = w;
    p->tileYI = -1;
    (*pf)->nextTile(env, pf);
}
Esempio n. 10
0
static void
PC_useProxy(doeE env, dcPathConsumer pc, dcFastPathProducer proxy)
{
    doeError_set(env, dcPathError, dcPathError_UNEX_useProxy);
}