Example #1
0
int
HandleIOError(Display * display) {
    // for really bad errors, we should exit the thread we're on
    SplashCleanup(SplashGetInstance());
    pthread_exit(NULL);
    return 0;
}
SPLASHEXPORT void
SplashSetFileJarName(const char* fileName, const char* jarName) {
    Splash *splash = SplashGetInstance();

    free(splash->fileName);
    splash->fileName = SplashConvertStringAlloc(fileName, &splash->fileNameLen);

    free(splash->jarName);
    splash->jarName = SplashConvertStringAlloc(jarName, &splash->jarNameLen);
}
SPLASHEXPORT void
SplashInit()
{
    Splash *splash = SplashGetInstance();

    memset(splash, 0, sizeof(Splash));
    splash->currentFrame = -1;
    initFormat(&splash->imageFormat, QUAD_RED_MASK, QUAD_GREEN_MASK,
        QUAD_BLUE_MASK, QUAD_ALPHA_MASK);
    SplashInitPlatform(splash);
}
SPLASHEXPORT void
SplashClose()
{
    Splash *splash = SplashGetInstance();

    if (splash->isVisible > 0) {
        SplashLock(splash);
        splash->isVisible = -1;
        SplashClosePlatform(splash);
        SplashUnlock(splash);
    }
}
static int
SplashLoadStream(SplashStream * stream)
{
    int success = 0;
    int c;
    size_t i;

    Splash *splash = SplashGetInstance();
    if (splash->isVisible < 0) {
        return 0;
    }

    SplashLock(splash);

    /* the formats we support can be easily distinguished by the first byte */
    c = stream->peek(stream);
    if (c != -1) {
        for (i = 0; i < sizeof(formats) / sizeof(FILEFORMAT); i++) {
            if (c == formats[i].sign) {
                success = formats[i].decodeStream(splash, stream);
                break;
            }
        }
    }
    stream->close(stream);

    if (!success) {             // failed to decode
        if (splash->isVisible == 0) {
            SplashCleanup(splash);
        }
        SplashUnlock(splash);   // SplashClose locks
        if (splash->isVisible == 0) {
            SplashClose();
        }
    }
    else {
        splash->currentFrame = 0;
        if (splash->isVisible == 0) {
            SplashStart(splash);
        } else {
            SplashReconfigure(splash);
            splash->time = SplashTime();
        }
        SplashUnlock(splash);
    }
    return success;
}
Example #6
0
/*
* Class:     java_awt_SplashScreen
* Method:    _getInstance
* Signature: ()J
*/
JNIEXPORT jlong JNICALL 
Java_java_awt_SplashScreen__1getInstance(JNIEnv * env, jclass thisClass)
{
    return ptr_to_jlong(SplashGetInstance());
}