JNIEXPORT void JNICALL Java_sun_java2d_d3d_D3DRenderer_drawPoly (JNIEnv *env, jobject d3dr, jintArray xpointsArray, jintArray ypointsArray, jint nPoints, jboolean isClosed, jint transX, jint transY) { jint *xPoints, *yPoints; J2dTraceLn(J2D_TRACE_INFO, "D3DRenderer_drawPoly"); xPoints = (jint *)env->GetPrimitiveArrayCritical(xpointsArray, NULL); if (xPoints != NULL) { yPoints = (jint *)env->GetPrimitiveArrayCritical(ypointsArray, NULL); if (yPoints != NULL) { D3DContext *d3dc = D3DRQ_GetCurrentContext(); D3DRenderer_DrawPoly(d3dc, nPoints, isClosed, transX, transY, xPoints, yPoints); if (d3dc != NULL) { HRESULT res = d3dc->EndScene(); D3DRQ_MarkLostIfNeeded(res, D3DRQ_GetCurrentDestination()); } env->ReleasePrimitiveArrayCritical(ypointsArray, yPoints, JNI_ABORT); } env->ReleasePrimitiveArrayCritical(xpointsArray, xPoints, JNI_ABORT); } }
/** * This method is invoked in the (relatively rare) case where one or * more glyphs is about to be kicked out of the glyph cache texture. * Here we simply flush the vertex queue of the current context in case * any pending vertices are dependent upon the current glyph cache layout. */ static void D3DGlyphCache_FlushGlyphVertexCache() { D3DContext *d3dc = D3DRQ_GetCurrentContext(); if (d3dc != NULL) { J2dTraceLn(J2D_TRACE_INFO, "D3DGlyphCache_FlushGlyphVertexCache"); d3dc->FlushVertexQueue(); } }
JNIEXPORT void JNICALL Java_sun_java2d_d3d_D3DTextRenderer_drawGlyphList (JNIEnv *env, jobject self, jint numGlyphs, jboolean usePositions, jboolean subPixPos, jboolean rgbOrder, jint lcdContrast, jfloat glyphListOrigX, jfloat glyphListOrigY, jlongArray imgArray, jfloatArray posArray) { unsigned char *images; J2dTraceLn(J2D_TRACE_INFO, "D3DTextRenderer_drawGlyphList"); images = (unsigned char *) env->GetPrimitiveArrayCritical(imgArray, NULL); if (images != NULL) { D3DContext *d3dc = D3DRQ_GetCurrentContext(); D3DSDOps *dstOps = D3DRQ_GetCurrentDestination(); if (usePositions) { unsigned char *positions = (unsigned char *) env->GetPrimitiveArrayCritical(posArray, NULL); if (positions != NULL) { D3DTR_DrawGlyphList(d3dc, dstOps, numGlyphs, usePositions, subPixPos, rgbOrder, lcdContrast, glyphListOrigX, glyphListOrigY, images, positions); env->ReleasePrimitiveArrayCritical(posArray, positions, JNI_ABORT); } } else { D3DTR_DrawGlyphList(d3dc, dstOps, numGlyphs, usePositions, subPixPos, rgbOrder, lcdContrast, glyphListOrigX, glyphListOrigY, images, NULL); } // reset current state, and ensure rendering is flushed to dest if (d3dc != NULL) { d3dc->FlushVertexQueue(); } env->ReleasePrimitiveArrayCritical(imgArray, images, JNI_ABORT); } }