Esempio n. 1
0
void NVprPathRendererState::validate()
{
    if (valid) {
        return;
    }

    NVprPathCacheProcessor processor(owner, path, fill_rule);
    owner->processSegments(processor);
    if (owner->style.do_stroke) {
        glPathParameteriNV(path, GL_PATH_JOIN_STYLE_NV, lineJoinConverter(owner));
        glPathParameteriNV(path, GL_PATH_END_CAPS_NV, lineCapConverter(owner));
        glPathParameterfNV(path, GL_PATH_STROKE_WIDTH_NV, owner->style.stroke_width);
        glPathParameterfNV(path, GL_PATH_MITER_LIMIT_NV, owner->style.miter_limit);
        if (owner->style.dash_array.size()) {
            glPathDashArrayNV(path, GLsizei(owner->style.dash_array.size()), &owner->style.dash_array[0]);
            glPathParameteriNV(path, GL_PATH_DASH_CAPS_NV, lineCapConverter(owner));
            glPathParameterfNV(path, GL_PATH_DASH_OFFSET_NV, owner->style.dash_offset);
            GLenum dash_offset_reset = (owner->style.dash_phase == PathStyle::MOVETO_RESETS)
                ? GL_MOVE_TO_RESETS_NV
                : GL_MOVE_TO_CONTINUES_NV;
            glPathParameteriNV(path, GL_PATH_DASH_OFFSET_RESET_NV, dash_offset_reset);
        } else {
            glPathDashArrayNV(path, 0, NULL);
        }
    }
    valid = true;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVPathRendering_nglPathDashArrayNV(JNIEnv *env, jclass clazz, jint path, jint dashCount, jlong dashArray, jlong function_pointer) {
	const GLfloat *dashArray_address = (const GLfloat *)(intptr_t)dashArray;
	glPathDashArrayNVPROC glPathDashArrayNV = (glPathDashArrayNVPROC)((intptr_t)function_pointer);
	glPathDashArrayNV(path, dashCount, dashArray_address);
}