提交 5fa58cb8 编写于 作者: J jchen

8025309: [parfait] JNI-related warnings from b107 for jdk.src.share.native.sun.java2d.pipe

Reviewed-by: prr, jgodinez
上级 2a1d935b
......@@ -53,6 +53,7 @@ Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans
unsigned char *bbuf;
jint *ibuf;
jint ipos;
jboolean hasException;
J2dTraceLn2(J2D_TRACE_INFO,
"BufferedRenderPipe_fillSpans: bpos=%d limit=%d",
......@@ -104,7 +105,10 @@ Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans
ibuf[1] = spanCount;
// flush the queue
JNU_CallMethodByName(env, NULL, rq, "flushNow", "(I)V", bpos);
JNU_CallMethodByName(env, &hasException, rq, "flushNow", "(I)V", bpos);
if (hasException) {
break;
}
// now start a new operation
ibuf = (jint *)bbuf;
......
......@@ -260,6 +260,10 @@ RegionToYXBandedRectangles(JNIEnv *env,
/* return; REMIND: What to do here? */
}
Region_StartIteration(env, &clipInfo);
if ((*env)->ExceptionCheck(env)) {
return 0;
}
numrects = Region_CountIterationRects(&clipInfo);
if ((unsigned long)numrects > initialBufferSize) {
*pRect = (RECT_T *) SAFE_SIZE_ARRAY_ALLOC(malloc, numrects, sizeof(RECT_T));
......
......@@ -653,12 +653,15 @@ Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly
pd->curx = x;
pd->cury = y;
}
(*env)->ReleasePrimitiveArrayCritical(env, yArray,
yPoints, JNI_ABORT);
}
(*env)->ReleasePrimitiveArrayCritical(env, yArray,
yPoints, JNI_ABORT);
(*env)->ReleasePrimitiveArrayCritical(env, xArray,
xPoints, JNI_ABORT);
}
if (xPoints == NULL || yPoints == NULL) {
return;
}
(*env)->ReleasePrimitiveArrayCritical(env, xArray,
xPoints, JNI_ABORT);
}
if (!oom) {
HANDLEENDPATH(pd, {oom = JNI_TRUE;});
......
......@@ -44,21 +44,27 @@ Java_sun_java2d_pipe_SpanClipRenderer_initIDs
{
/* Region fields */
pBandsArrayID = (*env)->GetFieldID(env, rc, "bands", "[I");
if (pBandsArrayID == NULL) {
return;
}
pEndIndexID = (*env)->GetFieldID(env, rc, "endIndex", "I");
if (pEndIndexID == NULL) {
return;
}
/* RegionIterator fields */
pRegionID = (*env)->GetFieldID(env, ric, "region",
"Lsun/java2d/pipe/Region;");
if (pRegionID == NULL) {
return;
}
pCurIndexID = (*env)->GetFieldID(env, ric, "curIndex", "I");
if (pCurIndexID == NULL) {
return;
}
pNumXbandsID = (*env)->GetFieldID(env, ric, "numXbands", "I");
if((pBandsArrayID == NULL)
|| (pEndIndexID == NULL)
|| (pRegionID == NULL)
|| (pCurIndexID == NULL)
|| (pNumXbandsID == NULL))
{
JNU_ThrowInternalError(env, "NULL field ID");
if (pNumXbandsID == NULL) {
return;
}
}
......@@ -129,10 +135,14 @@ Java_sun_java2d_pipe_SpanClipRenderer_fillTile
if ((*env)->GetArrayLength(env, boxArray) < 4) {
JNU_ThrowArrayIndexOutOfBoundsException(env, "band array");
return;
}
alphalen = (*env)->GetArrayLength(env, alphaTile);
box = (*env)->GetPrimitiveArrayCritical(env, boxArray, 0);
if (box == NULL) {
return;
}
w = box[2] - box[0];
h = box[3] - box[1];
......@@ -140,9 +150,14 @@ Java_sun_java2d_pipe_SpanClipRenderer_fillTile
if (alphalen < offset || (alphalen - offset) / tsize < h) {
(*env)->ReleasePrimitiveArrayCritical(env, boxArray, box, 0);
JNU_ThrowArrayIndexOutOfBoundsException(env, "alpha tile array");
return;
}
alpha = (*env)->GetPrimitiveArrayCritical(env, alphaTile, 0);
if (alpha == NULL) {
(*env)->ReleasePrimitiveArrayCritical(env, boxArray, box, 0);
return;
}
fill(alpha, offset, tsize, 0, 0, w, h, (jbyte) 0xff);
......@@ -182,6 +197,7 @@ Java_sun_java2d_pipe_SpanClipRenderer_eraseTile
if ((*env)->GetArrayLength(env, boxArray) < 4) {
JNU_ThrowArrayIndexOutOfBoundsException(env, "band array");
return;
}
alphalen = (*env)->GetArrayLength(env, alphaTile);
......@@ -196,6 +212,9 @@ Java_sun_java2d_pipe_SpanClipRenderer_eraseTile
}
box = (*env)->GetPrimitiveArrayCritical(env, boxArray, 0);
if (box == NULL) {
return;
}
lox = box[0];
loy = box[1];
......@@ -207,10 +226,20 @@ Java_sun_java2d_pipe_SpanClipRenderer_eraseTile
(alphalen - offset - (hix-lox)) / tsize < (hiy - loy - 1)) {
(*env)->ReleasePrimitiveArrayCritical(env, boxArray, box, 0);
JNU_ThrowArrayIndexOutOfBoundsException(env, "alpha tile array");
return;
}
bands = (*env)->GetPrimitiveArrayCritical(env, bandsArray, 0);
if (bands == NULL) {
(*env)->ReleasePrimitiveArrayCritical(env, boxArray, box, 0);
return;
}
alpha = (*env)->GetPrimitiveArrayCritical(env, alphaTile, 0);
if (alpha == NULL) {
(*env)->ReleasePrimitiveArrayCritical(env, bandsArray, bands, 0);
(*env)->ReleasePrimitiveArrayCritical(env, boxArray, box, 0);
return;
}
curIndex = saveCurIndex;
numXbands = saveNumXbands;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册