예제 #1
0
static int      _s52_draw_cb    (gpointer user_data)
// return TRUE for the signal to be called again
{
    s52engine *engine = (s52engine*)user_data;

    //g_print("s52egl:_s52_draw_cb(): begin .. \n");

    if (NULL == engine) {
        g_print("_s52_draw_cb(): no engine ..\n");
        goto exit;
    }

    // wait for libS52 to init - no use to go further - bailout
    if (TRUE == engine->do_S52init) {
        g_print("s52egl:_s52_draw_cb(): re-starting .. waiting for S52_init() to finish\n");
        goto exit;
    }

    if ((NULL==engine->eglDisplay) || (EGL_NO_DISPLAY==engine->eglDisplay)) {
        g_print("_s52_draw_cb(): no display ..\n");
        goto exit;
    }

    // no draw at all, the window is not visible
    if ((FALSE==engine->do_S52draw) && (FALSE==engine->do_S52drawLast)) {
        //g_print("s52egl:_s52_draw_cb(): nothing to draw (do_S52draw & do_S52drawLast FALSE)\n");
        goto exit;
    }

#ifndef S52_USE_EGL
    _egl_beg(engine);
#endif

    // draw background
    if (TRUE == engine->do_S52draw) {
        if (TRUE == engine->do_S52setViewPort) {
            eglQuerySurface(engine->eglDisplay, engine->eglSurface, EGL_WIDTH,  &engine->width);
            eglQuerySurface(engine->eglDisplay, engine->eglSurface, EGL_HEIGHT, &engine->height);

            S52_setViewPort(0, 0, engine->width, engine->height);

            engine->do_S52setViewPort = FALSE;
        }

        S52_draw();
        engine->do_S52draw = FALSE;
    }

    // draw AIS
    if (TRUE == engine->do_S52drawLast) {

#ifdef USE_FAKE_AIS
        _s52_updTimeTag(engine);
#endif
        S52_drawLast();
    }

#ifndef S52_USE_EGL
    _egl_end(engine);
#endif


exit:

    // debug
    //g_print("s52egl:_s52_draw_cb(): end .. \n");

    return EGL_TRUE;
}
예제 #2
0
파일: s52gtk3egl.c 프로젝트: vadp/S52
static int      _s52_draw_cb(GtkWidget *widget,
							 GdkEventExpose *event,
							 gpointer user_data)
// return TRUE for the signal to be called again
{
    (void)widget;
    (void)event;

    struct s52engine *engine = (struct s52engine*)user_data;
    //g_print("s52egl:_s52_draw_cb(): begin .. \n");

    /*
    GTimeVal now;  // 2 glong (at least 32 bits each - but amd64 !?
    g_get_current_time(&now);
    if (0 == (now.tv_sec - engine->timeLastDraw.tv_sec))
        goto exit;
    //*/

    if (NULL == engine) {
        g_print("_s52_draw_cb(): no engine ..\n");
        goto exit;
    }

    if ((NULL==engine->eglDisplay) || (EGL_NO_DISPLAY==engine->eglDisplay)) {
        g_print("_s52_draw_cb(): no display ..\n");
        goto exit;
    }

    // wait for libS52 to init - no use to go further - bailout
    if (TRUE == engine->state.do_S52init) {
        g_print("s52egl:_s52_draw_cb(): re-starting .. waiting for S52_init() to finish\n");
        goto exit;
    }

    // no draw at all, the window is not visible
    if ((FALSE==engine->do_S52draw) && (FALSE==engine->do_S52drawLast)) {
        //g_print("s52egl:_s52_draw_cb(): nothing to draw (do_S52draw & do_S52drawLast FALSE)\n");
        goto exit;
    }

#if !defined(S52_USE_EGL)
    _egl_beg(engine, "test");
#endif

    // draw background
    if (TRUE == engine->do_S52draw) {
        if (TRUE == engine->do_S52setViewPort) {
            eglQuerySurface(engine->eglDisplay, engine->eglSurface, EGL_WIDTH,  &engine->width);
            eglQuerySurface(engine->eglDisplay, engine->eglSurface, EGL_HEIGHT, &engine->height);

            S52_setViewPort(0, 0, engine->width, engine->height);

            engine->do_S52setViewPort = FALSE;
        }

        S52_draw();
        engine->do_S52draw = FALSE;
    }

    // draw AIS
    if (TRUE == engine->do_S52drawLast) {

#ifdef USE_FAKE_AIS
        _s52_updTimeTag(engine);
#endif
        S52_drawLast();
    }

#if !defined(S52_USE_EGL)
    _egl_end(engine);
#endif


exit:

    // debug
    //g_print("s52egl:_s52_draw_cb(): end .. \n");

    return EGL_TRUE;
}